C*********************************************************************** C C Model Change Bulletin C C MCB#4 03/22/2018 C C AERMAP (dated 18081) C C This Model Change Bulletin documents changes made to the AERMAP Terrain C Preprocessor for the AERMOD Dispersion Model. A brief description of C the changes is provided below. Additional details are also available C in the Fortran source code. C C C This revised version of AERMAP (dated 18081) includes the following C modifications relative to the previous version (dated 11103): C C-- Bug Fixes: C C 1. Made array RMIN allocatable in subroutine CALCHC to avoid C gfortran errors on Linux systems C C C-- Enhancements: C C 1. Modified several subroutines and main program AERMOD C to allow for command line arguments for input runstream C input filename and output filename. If no arguments specified C AERMAP uses aermap.inp and aermap.out as the default filenames C C*********************************************************************** C C This revised version of AERMAP (dated 11103) includes the C following modifications relative to the previous version C (dated 09040); see MCB#3 and updated User's Guide Addendum: C C----- Bug Fixes: C C 1. Corrected formatting issue for message indicating that C source location is not assigned to a terrain file, in C sub_demsrc. This error condition resulted in a Fortran C runtime error with version 09040. C C----- Enhancements: C C 1. Modified several subroutines to increase maximum length C of source IDs from 8 to 12 characters, to be consistent C with enhancement introduced with version 11059 of AERMOD. C C----- Miscellaneous: C C 1. Modified subroutine ERRHDL to set an upper limit on line C number included in error messages to avoid overflowing C the field. C C C----- MODIFIED BY: Roger W. Brode C U.S. EPA, OAQPS/AQAD C Air Quality Modeling Group C C April 13, 2011 C C----- MODIFIED FROM: AERMAP C (Version Dated 09040) C C*********************************************************************** C C This revised version of AERMAP (dated 09040) includes the C following modifications relative to the previous version C (dated 06341); see MCB#2: C C----- Bug Fixes: C C 1. Corrected errors with processing of DEM data for Alaska, C including handling of non-uniform delta-x and delta-y DEM C node spacing. These corrections also permit use of all C types of Alaska DEM data, including 1-Degree, 15-Minute, C and 7.5-Minute data. C C 2. Corrected error that may occur with some cross-UTM zone C applications when NAD (datum) conversions are performed. C C 3. Modified several subroutines to address errors and potential C issues associated with receptors and sources located beyond C the range of DEM profiles that are not accounted for by checks C included in previous versions. These problems have primarily C been associated with non-standard (non-USGS) DEM files that C were converted from other data formats. Receptors located C in gaps between terrain files due to NAD conversions and C receptors located within gaps inside terrain files are more C clearly identified and documented. Receptor (and source) C elevations for gap locations are assigned a missing code C of -9999.0, unless the new 'FILLGAPS' option on the DATAFILE C keyword for DEM files is specified. Modified the MAIN C program unit to loop through all terrain files until a C non-missing (non-gap) elevation is determined. Also improved C the handling of "edge receptors" beyond the range of profiles C within 7.5-minute DEM files to check for the north-south C displacement in selecting the closest elevation nodes. C These issues with edge and gap receptors should be eliminated C with the enhancements to AERMAP to support the use of USGS C National Elevation Dataset (NED) input data (see item #1 C below under Enhancements). Note that the 'FILLGAPS' option C is not available for NED files since these gaps should C not occur with the use of NED data. C C 4. Modified subroutine OUCARD to correct errors with OU C pathway options, which required that RECEPTOR keyword C precede the SOURCLOC keyword in the input file. C C 5. Modified subroutine SOLOCA to recognize all source types C currently supported by AERMOD on the SO pathway, including C POINTCAP, POINTHOR, and OPENPIT. C C 6. Fixed bugs related to assignment of domain for cases with C 7.5-minute DEM files based on UTM coordinates and domain C based on geographic coordinates using the DOMAINLL keyword. C This bug could have resulted in AERMAP errors for domain C outside the range of DEM data for applications where the C domain extends close to the edge of the data. C C 7. Modified subroutines DEMREC, DEMSRC, and CHKEXT to allow C for non-standard (non-USGS) terrain files with boundaries C that follow UTM lines rather than latitude/longitude lines C in assigning receptors, sources, and domain corners to C terrain files. C C 8. Modified subroutine INITER_DEM to correct the application C of the adjustment for elevation of local datum (LOCEL) for C DEM files. C C 9. Modified subroutines INITER_DEM, RECELV, and SRCELV C to address potential problems with handling of nodes C assigned missing elevations in DEM and NED files. C C C----- Enhancements: C C 1. Added capability to process USGS National Elevation Dataset C (NED) input data in place of DEM data. AERMAP currently C supports NED data files in the GeoTIFF format, requiring C only the *.tif file downloaded from the USGS Seamless C Data Server (http://seamless.usgs.gov/). AERMAP allows C for multiple NED files, and supports GeoTIFF files C in geographic or projected (UTM) coordinates, although NED C data from the USGS Seamless Data Server should be in C geographic coordinates. Note that GeoTIFF is NOT the C default data format for NED data downloaded from the C Seamless Data Server. The user must modify the download C request to specify the format as GeoTIFF. C C 2. Incorporated capability for processing "mixed" DEM files C in a single AERMAP run, including all types of Alaska DEMs, C as well as non-Alaskan 1-Degree and 7.5-Minute DEMs. C Receptor elevations are assigned based on the first C DEM file encountered that contains the receptor, unless C the receptor is located within a data gap inside the file. C Users are required to identify more refined, higher C resolution data first in the runstream input file C if a receptor is located within more than one DEM file. C This permits the use of the highest resolution data C available to estimate elevations, even though the higher C resolution data may not be available for the entire modeling C domain. This enhancement allows the use of 1-degree DEM C data to fill in gaps within the coverage of 7.5-minute DEM C data, such as 7.5-minute quadrangles that are entirely over C water. AERMAP also allows "mixed" resolution NED files, C with the same restrictions as for DEM files. However, C AERMAP does NOT support both DEM and NED files in the same C AERMAP run. C C 3. The DOMAINXY or DOMAINLL keyword is no longer required C on the CO pathway. When the user-specified domain is C omitted, AERMAP will use all of the elevation data C included in the input files in the calculation of C critical hill height scales. C C 4. Array storage limits in AERMAP are now dynamically C allocated at runtime, based on the data requirements C of the specific application. This includes explicit C treatment of the number of DEM/NED files, sources, C receptors, profiles per data file and the maximum C number of nodes per profile. C C 5. Added support for the INCLUDED keyword on the SO and C RE pathways to allow source and receptor data from C separate files to be included in the AERMAP input. C C 6. Modified subroutine CALCHC to use a more accurate C approach for calculating distances based on C geographic coordinates, from the NGS INVERSE program. C Modified code for optimizing hill height calculation C by skipping DEM or NED files when possible to be more C generic in order to support the use of mixed and C non-standard DEM files. Also modified subroutine C CALCHC to improve optimization for processing hill C height calculations, including changes to take C advantage of more accurate distance calculation C for geographic files to calculate distances between C profiles. C C 7. Modified subroutine DATFIL to include an option on the C DATAFILE keyword for NED data to generate a GeoTIFF debug C output file containing results for all TIFFTags and GeoKeys C contained within the file. The DATAFILE keyword for NED C data also includes an option for user-specified elevation C units for NED data on the DATAFILE keyword. C C The optional keyword for the TIFF debug file is C 'TIFFDEBUG'. AERMAP generates a hard-coded filename C for the TiffDebug file as 'TiffDebugFile_nnnnn.dbg', C where 'nnnnn' is the NED file number based on the C order listed in the AERMAP.INP file. The optional C user-specified elevation units can be specified as C 'FEET', 'METERS', 'DECIFEET', 'DECIMETERS', 'DECAFEET', C or 'DECAMETERS' (note that secondary keywords are not C case-sensitive). Most NED GeoTIFF files currently do C not include the GeoKey to identify the elevation units. C The default assumed by AERMAP in those cases is 'METERS', C based on documentation provided by the USGS for NED C data. If elevations units are specified within the C GeoTIFF file and a conflict is found between the GeoKey C in the NED file and the user-specified units, a C fatal error message is generated to abort processing. C Also note that the optional 'CHECK' parameter available C on the DATAFILE keyword for DEM files is not applicable C to NED data. C C 8. Increased maximum length for filenames to 200 (controlled C by the ILEN_FLD parameter in mod_main1.f), and the maximum C input string length to 512 (controlled by the ISTRG C parameter in mod_main1.f). Also modified subroutine DEFINE C to allow double quotes (") as field delimiters in the C AERMAP.INP file to support filenames with embedded spaces. C Note that the double quotes do not count toward the limit C for the maximum field length. C C 9. Added an optional keyword for the CO pathway to allow C the user to specify a pathname for the NADCON grid shift C files (such as CONUS.LAS and CONUS.LOS). The optional C keyword is NADGRIDS. The pathname can include embedded C spaces if double quotes (") are used as field delimiters. C The default path for the NADCON grid shift files without C the NADGRIDS keyword is the local folder containing the C AERMAP.INP file. Also moved the call to subroutine C NGRIDS to follow calls to subroutines DEMCHK and NEDCHK C such that the NADCON grid shift files are only accessed C if needed, based on the value of NADA specified by the C user and the reference datums for all of the terrain files. C C C----- Miscellaneous: C C 1. Modified several subroutines, including UTMGEO, NADCON, C DEMREC, DEMSRC, RECCNV, SRCCNV, RECELV, and SRCELV, to C use standard convention of negative values for West C longitude. This simplifies some aspects of the code, C improves consistency with other tools, such as AERSURFACE, C improves ability to support alternative elevation data C sources, such as NED, and improves portability of AERMAP C for applications beyond the Northern/Western hemispheres. C C As part of these modifications, the DOMAINLL and DOMAINXY C keywords both expect the domain to be defined by the C coordinates for the lower-left and upper-right corners of C the domain. The DOMAINLL keyword in previous versions C required the domain to be specified based on the lower- C right and upper-left corners. Code has been included in C AERMAP to support older AERMAP.INP files by adjusting the C DOMAINLL inputs as necessary to conform with the new C convention. A warning message is generated in these cases, C and the adjusted DOMAINLL inputs are included in the C AERMAP.OUT file, as well as the RECEPTOR and SOURCLOC C output files. The direct access terrain file format C has also been modified to use I3 for the UTM zone field, C to accommodate negative UTM zones, which are used to C indicate Southern Hemisphere coordinates. C C 2. Adjusted "map array" outputs in MAPPARAMS.OUT debug C file to allow for mixed DEM files and to improve C handling of non-standard DEM files, converted from C other formats. C C 3. Modified data structures for storing DEM file corner C coordinates (new subroutine CNRCNV) to improve the C readability of code, eliminate redundancy, and to C use consistent reference points for domain. C C 4. Modified subroutine OPENFL in NADCON.F to assume C record length based on bytes rather than words C when reading the binary NAD grid files (*.las and C *.los files). This will improve the portability of C AERMAP to other platforms and compilers, but may C require inclusion of compiler options to specify the C record length based on bytes for some compilers, such C as the /assume:byterecl option for the Intel Fotran C compiler used to generate the Windows-based executable C for AERMAP. C C 5. Modified subroutine SOCARD to ignore the SRCPARAM C keyword on the SO pathway, but issue a warning message. C Previous versions of AERMAP did not allow for the C SRCPARAM keyword, causing a fatal error. This may C facilitate the inclusion of portions of AERMOD input C files with source locations into the AERMAP.INP file C more easily in some cases. C C 6. Replaced ELEV logical variable, used to specify that C terrain elevations would be provided by the user, with C new EXTRACT logical variable to specify that terrain C elevations will be extracted from DEM data (the default C option). EXTRACT=.true. in version 09040 code is C equivalent with ELEV=.false. in previous versions. C C 7. Modified subroutines SRCOUT and RECOUT to include C model rundate and runtime in the header of the C source and receptor output files. Also modified C appropriate subroutines to include a header with C version date, rundate and runtime in the debug C output files. C C 8. Modified data structures and formats to support use C of double precision for elevation variables. C C 9. Modified subroutine HEADER in aermap.f to use ASCII C form feed character [ACHAR(12)] to eliminate need for C non-standard option of CARRIAGECONTROL = 'FORTRAN' in C OPEN statement for 'aermap.out' file, and modified C subroutine FILOPN to eliminate the use of the C CARRIAGECONTROL = 'Fortran' option when opening the C aermap.out file. This improves the portability of the C AERMAP code. Also modified subroutines SETUP and COCARD C to remove '1X' from format statements for echoing runstream C inputs to output file since Fortran carriage-control is no C longer applied. This eliminates the column shift in the C input portion of the aermap.out file. C C 10. Miscellaneous code clean-up, including; C C a. modifying subroutine DEMCHK to eliminate redundant C information in the MAPDETAIL.OUT debug file, eliminate C reading of the Record B data to optimize runtime, and C simplify logic related to determining the file record type; C b. modify the DOMDETAIL.OUT debug file to include C information on the direct access files used to store C elevations for the portion of each terrain file that C falls within the user-specified domain; C c. including error checking on the length of user-specified C filenames to trap on filenames that the limit based on the C ILEN_FLD parameter; C d. modifying criterion for "latitude out-of-range" warning C from 60 to 66 degrees; C e. cleaning up unused portions of NADCON code; C f. additional initialization of variables where needed; C g. error checking on consistency between UTM zone on ANCHORXY C keyword and the UTM zone(s) based on the domain or C range of data; and C h. cleanup of unused error and warning messages and C reordering of messages. C C C----- MODIFIED BY: Roger W. Brode C U.S. EPA, OAQPS/AQAD C Air Quality Modeling Group C C Clint R. Tillerson C MACTEC Federal Programs, Inc. C C February 9, 2009 C C----- MODIFIED FROM: AERMAP C (Version Dated 06341) C C*********************************************************************** C* C* This revised version of AERMAP (dated 06341) includes the C* following modifications relative to version 04300; see MCB#1: C* C* - Corrected several problems associated with NAD conversion C* process. Previous version did not properly account for C* shift in UTM coordinates due to different ellipsoids used C* for the different datums, which is typically about 200m in C* the Northing coordinate. Modified the incorporation of C* the NADCON program to use an iterative calculation for C* conversions from NAD82 to NAD27. Other issues related to C* how NADA values were processed have been addressed. C* C* - Corrected initialization problem that resulted in erroneous C* calculation for the first elevation (either source or C* receptor elevation, depending on inputs). C* C* - Corrected array subscript out-of-bounds problem associated C* with reading blank NAD value from header record of old DEM C* files (typically 1-degree DEMs) that may have resulted C* in runtime errors in previous version. C* C* - Corrected problem that may occur when reading data from DEM C* files that do not include carriage returns or line feeds C* (i.e., one continuous ASCII record). Problem in previous C* version would result in runtime error for some DEM files. C* C* - Corrected problem with the procedure to optimize hill C* height scale calculations by checking for maximum elevation C* from non-local DEM files and assigning that elevation to the C* closest point between the receptor and the DEM file. The C* previous version of AERMAP would skip some files that should C* not have been skipped. C* C* - Incorporated additional optimization for calculation of C* critical hill height scales by skipping profiles within DEM C* files in CALCHC based on maximum elevation within the C* profile and based on closest distance between receptor and C* DEM file for adjacent DEMs and closest distance between C* receptor and profile for local DEMs. The maximum elevation C* within a profile was added to the index file for the direct C* access files containing DEM nodes within the domain. C* C* - Corrected problems (related to NAD conversion issues) for C* applications that cross UTM zone boundaries. C* C* - Corrected runtime error that may occur in DISTLL for C* receptors (or sources) that are collocated with a DEM node. C* C* - Modified procedure used to identify which DEM file a C* receptor or source is located within: initial check is made C* based on zero distance tolerance relative to edges of the C* DEM files; warnings are issued for receptors and sources C* not located within a DEM based on initial check; and a C* second check is made for receptors that may be located C* within a "gap" between adjacent DEM files with different C* datums due to the NAD conversion. The distance tolerance C* used to assign "gap" receptors to a DEM file is based on C* the maximum datum shift for that application. One half of C* the datum shift is used for the tolerance in order to C* assign the receptor to the closest DEM file. Any receptor C* or source not located based on second check will generate C* a fatal error message. C* C* - Modified the procedure to calculate receptor and source C* elevations to use four closest nodes within the DEM file C* containing the source or receptor. Also modified procedure C* for assigning elevations to receptors located beyond the C* range of profiles along the edges of 7.5-minute DEM files C* to account for proximity to nodes in the Northing as well C* the Easting directions. The datum "gap" receptors are also C* treated as "extended edge" receptors. Also reverted to the C* original 2-D (bilinear) interpolation for calculating source C* and receptor elevations based on four (or two) closest nodes. C* C* - Modified CALCHC to use distances between receptors and C* DEM nodes based on UTM coordinates for 7.5-minute DEMs; C* arc-distances based on Lat/Lon coordinates are still C* used for 1-degree DEMs. C* C* - Moved call to DEMCHK to follow check for fatal errors C* during SETUP, and added error checking after return from C* DEMCHK to avoid proceeding with invalid data. C* C* - Added optional "CHECK" option to CO DATAFILE card to C* activate full check of DEM file in subroutine DEMCHK; C* default operation is to check the first 20480 characters C* to determine file type (DOS, UNIX, no CR/LF, Binary). C* C* - Added user options to control "debug" output files on C* new CO DEBUGOPT card. Debug options include "HILL" for C* hill height scale calculations (performed in subroutine C* CALCHC), "RECEPTOR" for receptor related information, and C* "SOURCE" for source related information. User can also C* specify "ALL" to request debug outputs for all three. C* Previous informational files regarding DEM files and domain C* setup (MAPDETAIL.OUT, MAPPARAMS.OUT, and DOMDETAIL.OUT) C* are automatically generated. Content of debug files C* has also been modified to be more useful in documenting C* and resolving problems with the code or with the setup C* of the input data. C* C* - Reinserted code for subroutine DATTYP to process the C* DATATYPE keyword (current options include DEM1 or DEM7), C* and incorporated error checking for inconsistencies between C* DATATYPE card and input DEM files. C* C* - A number of miscellaneous changes to the code have been made C* to provide better documentation of the processing steps and C* better structure to the code. Some extraneous code has also C* been deleted. The number of miscellaneous changes is too C* numerous to list in detail. C* C* C* Modified by: Roger W. Brode C* U.S. EPA, OAQPS, AQMG C* C* MODIFIED FROM: (Version Dated 04300) C* C*********************************************************************** C* C* (Version Dated 04300) C* C* MODIFIED FROM: (Version Dated 03107) C* C* MODIFIED BY: Peter Eckhoff, U.S. EPA C* August, 2003 C* C* C* Modified to: C* C* - correct reported bugs C* - add a better method of reading DEM files with C* different record lengths C* - add additional error checking statements C* - add domain independent hill height algorithm C* - initialize all variables C* - add, but comment out OPEN statements C* thereby allowing a Command Line Interface to be C* the default input method. C* - add several output files that will aid in understanding C* the processes taking place and to supply a visual C* method for spotting discrepancies in the DEM files C* C* C* MODIFIED FROM: (Version Dated 02222) C* C* MODIFIED BY: Peter Eckhoff, U.S. EPA C* November, 2002 C* C* C* Modified to: C* C* - correct where in the DEM header the meter to decimeter factor is C* generated C* - correct for when a receptor/source is directly over a node and the C* resulting elevation is zero (See Dick Perry code/ Bharvey from 9/4 email) C* - in some rare instances, the DCOS argument is greater than 1.0, added C* a check to make it 1.0 C* - update SDST2DEM from version 0.014 to 0.018 (this is a separate program) C* - correct NADA selection C* - correct a process where receptors lying well within empty-node C* areas of a DEM file (not just lying near an edge), the receptors C* are assigned large negative numbers (Jason Maranche - email) C* C* C* MODIFIED FROM: (Version Dated 02222) C* C* MODIFIED BY: Russell F. Lee C* With financial support from Lakes Environmental C* C* Modified to correct: C* C* - an error in defining unit numbers for LUOUT and NAPAR C* - in the variable IS intended to select the Clarke 1866 ellipsoid C* parameters C* - an error that could cause array limits to be exceeded if more C* than one user-defined grid files are used C* - an error in a READ format and a FUNCTION statement C* Modified to allow international users to bypass subroutine NADCON21 C* C* C* MODIFIED FROM: (Version Dated 99211) C* C* MODIFIED BY: Peter Eckhoff, U.S. EPA C* July, 2002 C* C* Modified to add the following features: C* - converting anchor, receptor, source and elevation coordinates C* from North American Datum (NAD) of 1927 and other datums C* to NAD 1983 using the Unites States Geological Survey (USGS) C* sanctioned program, NADCON version 2.1, C* - updating coordinates to GRS80, C* - standardizing the code to Fortran 90, C* - eliminating compiler specific commands such as the C* Lahey-specific Command Line Interface subroutines, C* - changing all coordinate related variables so they are now double C* precision which eliminates having to drop the first digit of C* the northing values, C* - using file OPEN statements to read in the I/O file names, C* - adding the ability to process 200 DEM files instead of just 20. C* C* A preprocessor routine was added to the AERMAP package for C* converting the USGS C* Spatial Data Transfer Standard (SDTS) file format data C* back to the old Digital Elevation Model (DEM) format. C* The preprocessor is based on the Sol Katz conversion program, C* SDTS2DEM, version 0.014 and is executed as an interactive batch C* file. Additional information and links are available from the C* web site: http://www.gisdatadepot.com. C* C* NADCON IS THE FEDERAL STANDARD FOR NAD27 TO NAD83 DATUM C* TRANSFORMATIONS. The NADCON program, Version 2.10, was modified C* into a set of subroutines and then edited into AERMAP. C* ADDITIONAL INFORMATION CONCERNING NADCON IS AVAILABLE C* FROM THE NGS WEB SITE AT: C* C* HTTP://WWW.NGS.NOAA.GOV:80/TOOLS/NADCON/NADCON.HTML C* C* The Subroutine UTMGEO has been modified to accept the C* output from NADCON and to convert the Lat/Lon values to C* UTM coordinates based on the GRS80 ellipsoid. The semimajor and C* semiminor axis values for the International 1909 standard have C* been replaced by the GRS80 axis values in UTMGEO. C* C* AERMAP has been rewritten to Fortran 90 standards. C* C* C* MODIFIED FROM: (Version Dated 98022) C* C* MODIFIED BY: Roger W. Brode, PES, Inc. C* July 20, 1999 C* C* Modified for compatibility with the Lahey LF90 compiler. C* C* C* MODIFIED FROM: (Version Dated 97119) C* C* MODIFIED BY: Roger W. Brode C* January 22, 1998 C* C* Modified to correct an error that occurs with 1-degree DEM data C* when the number of sources exceeds the number receptors, and to C* prevent an error that may occur if a source or receptor is C* collocated with a node of the DEM file. C* C* C* MODIFIED FROM: (Version Dated 96274) C* C* MODIFIED BY: Roger W. Brode C* April 29, 1997 C* C* Modified to accept 7.5-minute DEM data in addition to 1-degree DEM C* data, and to add the SOurce pathway to allow for input of source C* locations. The OUtput pathway has also been added to allow for C* specification of receptor and source output data files. C* C* C* MODIFIED FROM: (Version Dated 96058) C* C* MODIFIED BY: Roger W. Brode C* September 30, 1996 C* C* Modified to correct an error in SUB. INT2D of RCALC.FOR. C* C* C* MODIFIED FROM: (Version Dated 95352) C* C* MODIFIED BY: Roger W. Brode C* February 27, 1996 C* C* Modified to correct a problem with multiple DEM files. C* C* C* PURPOSE: Controls Overall Flow and Processing of AERMAP C* C* PROGRAMMED BY: Jayant A. Hardikar C* Roger W. Brode C* James O. Paumier C* C* Pacific Environmental Services, Inc. C* P.O. Box 12077 C* Research Triangle Park, North Carolina 27709 C* C* DATE: December 18, 1995 C* C* C* INPUTS: C* C* OUTPUTS: C* C* C***********************************************************************