Wiki
Clone wikitypon / sandbox
README
The UAM_IV file module defines a class like derived type that implements the UAM_IV file format as defined in Ramboll Environ's CAMx. Provides an object like data structure for all types and method like subroutines for IO. It was inspired by Dr. Barron Henderson's pseudonetcdf python CAMx compatibly layer and serves as a modern Fortran IO support module.
This module was developed by Pablo Garcia at the Center for Atmospheric Particle Studies in Carnegie Mellon University.
Usage
#!fortran USE class_UAM_IV TYPE(UAM_IV) :: fl
Data structure
The UAM_IV derived type can be used to create variables of the UAM_IV
type. It can contain the data from any UAM_IV file type supported by CAMx in the following variables, here shown by groups. The variable names follow the convention from the published CAMx manuals where possible. More detail on their function and use is described there.
File descriptors
Main Header
in_file
: Input file path. Supports up to 256 charactersunit
: Input file fortran unit. Can be automatically assigned or user set.fname
: File type in the CAMx style character arrayftype
: File typenote
: File description note in CAMx style character arraynseg
: Unused / No documentation from CAMxnspec
: Number of speciesidate
,jdate
: Start and end datesbegtim
,endtim
: Start and end timesiutm
: Time zonenx
,ny
,nz
: EW, NS, and up-down grid dimensionsnzlo
,nzup
: Unused / No documentation from CAMxhts
,htl
,htu
: Unused / No documentation from CAMxi1
,j1
,nx1
,ny1
: Unused / No documentation from CAMxorgx
,orgy
: Unused / No documentation from CAMxutmx
,utmy
: Grid origin of the SW corner of the domain in projection coordinates,xorg
andyorg
in the CAMx manualdx
,dy
: Cell dimensions in projected coordinates
The UAM_IV format, as implemented by CAMx, does not contain the number of data frames in the file header. This module assumes 24 data frames per file, adjust according to your application.
update_times
: Number of data frames in the file. Default value = 24
Species
spname
: Species name array in CAMx style character arrayc_spname
: Species name array, sizenspec
Time-variant frame headers
ibgdat
,iendat
: Start and end date of the data frame, sizeupdate_times
nbgtim
,ientim
: Start and end time of the data frame, sizeupdate_times
Data types
AVERAGE and AIRQUALITY
conc
: 3D concentration array- Size:
nx
,ny
,nz
,update_times
,nspec
- Dimensions: EW cell (column), NW cell (row), layer, hour, species
- Size:
EMISSIONS
conc
: 2D area emissions array- Size:
nx
,ny
,update_times
,nspec
- Dimensions: EW cell (column), NW cell (row), hour, species
- Size:
PTSOURCE
Stack parameters
* nstk
: Number of stacks
* xstk
, ystk
: Stack location in projection coordinates, size nstk
* hstk
, dstk
: Stack height and diameter, size nstk
* tstk
, vstk
: Stack temperature and velocity, size nstk
Stack emissions
* icell
, jcell
: Unused / No documentation from CAMx
* kcell
: Unused except as flag for OSAT
* flow
: Stack flow rate (m3/hr, size update_times
, nstk
* plmht
: Effective plume height override (m), size update_times
, nstk
* ptemis
: Species emission rate (mol/time period for gases, g/time period for particles), size size update_times
, nstk
, nspec
BOUNDARY
The BOUNDARY
type uses the UAM_BC_PAR
derived type, its properties are described here as a subset of the bc
array.
bc
: Boundary condition derived type array, size 4iedge
: Edge number (1 = West, 2 = East, 3 = South, 4 = North)ncell
: Number of cellsiloc
: Index of first cell modeled (edges 1,3), or last cell modeled (edges 2,4): if=0, this row/column is omitted from the simulation.icell
in the CAMx manualbc_conc
: Boundary concentration array (ppm for gases, μg/m3 for particles)- Size:
ncell
,nz
,update_times
,nspec
- Dimensions: Cell, layer, hour, species
- Size:
Methods
File IO
Subroutine: read_uamfile
Takes a UAM_IV
type object and populates its properties with information from a compatible UAM_IV CAMx file. The file type will be determined automatically and fail gracefully if not recognized.
#!fortran CALL read_uamfile(fl) CALL read_uamfile(fl, in_file, unit)
Required
fl
: AUAM_IV
type object like variable
Optional
in_file
: Path to the input file. If not provided the method will use the value of thein_file
property of thefl
object.unit
: Fortran unit for IO. If not provided the method will assign a Fortran unit to theunit
property of thefl
object automatically.
Subroutine: write_uamfile
Takes a UAM_IV
type object and writes its properties with to UAM_IV CAMx file. The file type will be determined by the ftype
parameter of the input object and fail gracefully if not recognized.
#!fortran CALL write_uamfile(fl) CALL write_uamfile(fl, in_file, unit)
Required
fl
: AUAM_IV
type object like variable
Optional
in_file
: Path to the input file. If not provided the method will use the value of thein_file
property of thefl
object.unit
: Fortran unit for IO. If not provided the method will assign a Fortran unit to theunit
property of thefl
object automatically.
Utilities
Subroutine clone_header
Copies the main header information from an source UAM_IV
object like variable into an destination variable of the same type.
#!Fortran CALL clone_header(fl_inp, fl_out)
Required
fl_inp
: SourceUAM_IV
object like variablefl_out
: DestinationUAM_IV
object like variable
Subroutine inquire_header
Reads the main header of a UAM_IV CAMx file without reading the data frames, produces no terminal output.
#!fortran CALL inquire_header(fl) CALL inquire_header(fl, in_file, unit)
Required
fl
: AUAM_IV
type object like variable
Optional
in_file
: Path to the input file. If not provided the method will use the value of thein_file
property of thefl
object.unit
: Fortran unit for IO. If not provided the method will assign a Fortran unit to theunit
property of thefl
object automatically.
Updated