PseudoNetCDF.cmaqfiles package
Submodules
PseudoNetCDF.cmaqfiles.boxmodel module
PseudoNetCDF.cmaqfiles.pa module
PseudoNetCDF.cmaqfiles.profile module
- class PseudoNetCDF.cmaqfiles.profile.bcon_profile(*args, **kwds)[source]
Bases:
ioapi_base
- class PseudoNetCDF.cmaqfiles.profile.icon_profile(*args, **kwds)[source]
Bases:
ioapi_base
Module contents
cmaqfile
– CMAQ File Interfaces
- class PseudoNetCDF.cmaqfiles.bcon_profile(*args, **kwds)[source]
Bases:
ioapi_base
- class PseudoNetCDF.cmaqfiles.cmaqomidat(*args, **kwds)[source]
Bases:
PseudoNetCDFFile
- Parameters:
path (str) – path to CMAQ-ready OMI file. This is the output of create_omi preprocessor. See notes for general form.
Notes
File has the genearl form
nlat 17 nlon 17 yeardate latitude 180Z 157.5W … 1990.203 80 426 415 … … 1990.203 -80 260 253 …
- class PseudoNetCDF.cmaqfiles.griddesc(*args, **kwds)[source]
Bases:
ioapi_base
griddesc is designed to read IOAPI griddesc files and create a file with basic CF metadata. An example format of GRIDDESC is show below with two grids on one projection.
‘ ‘ ‘LCC’
2 33.000 45.000 -97.000 -97.000 40.000
‘ ‘ ‘SE52BENCH’ ‘LCC’ 792000.000 -1080000.000 12000.000 12000.000 100 80 1 ‘36US3’ ‘LCC’ -2952000.000 -2772000.000 36000.000 36000.000 172 148 1 ‘ ‘
- Parameters:
path (str or file-like) – If path is has a read method, it will be used directly. If path is a path to a file on disk, it will be read. If none of these, treat the path as text content. If path is None, load a griddesc using properties provided.
GDNAM (str) – Name the grid to be used. If not provided, the first will be used
VGLVLS (tuple) – Iterable of layer edge (k+1) values for the vertical grid.
VGTOP (float) – Top of vertical grid.
VGTYP (int) – Determines the units of VGLVLS and VGTOP. (7: WRF sigma-p, 6: meters asl, for more details see IOAPI documentation)
SDATE (int) – Starting julian date (YYYYJJJ) or -635
STIME (int) – Starting time as HHMMSS
TSTEP (int) – IOAPI time step in HHMMSS
FTYPE (int) – 1 for gridded; 2 for boundary
var_kwds (tuple, list, or dict) – See setdefvars; Defaults to {‘DUMMY’: {‘units’: ‘unknown’}}
nsteps (int) – Number of time steps to use. Should be coupled with SDATE, STIME, and TSTEP. nsteps > 1 is not compatible with time independent (TSTEP=0) or SDATE=-635
withcf (bool) – If true, then CF compatible variables that describe dimensions and time are added.
prop_kw (mappable) – Can provide additional IOAPI (or other) properties for the file.
- adddims(withcf=True)[source]
Add spatial dimensions
- Parameters:
withcf (bool) – If true, add Climate and Forecasting convention variables
- Return type:
None
- addtime(nsteps=1)[source]
Adds TFLAG variable
- Parameters:
nsteps (int) – Number of time steps to add
- Return type:
None
- class PseudoNetCDF.cmaqfiles.icon_profile(*args, **kwds)[source]
Bases:
ioapi_base
- class PseudoNetCDF.cmaqfiles.ioapi(*args, **kwds)[source]
Bases:
ioapi_base
,netcdf
- createDimension(*args, **kwds)[source]
Create a dimension
- Parameters:
name (string) – name for dimension
length (integer) – maximum length of dimension
- Returns:
dim – new dimension
- Return type:
PseudoNetCDFDimensions
- createVariable(*args, **kwds)[source]
Wrapper on PseudoNetCDF.createVariable that updates VAR-LIST, NVARS, VAR, and TFLAG. Also adds long_name, var_desc, and units if not already in properties. long_name and var_desc default to name, while units defaults to unknown. These properties will also be adjusted to expected lengths (16, 80, 16).
See also
see
- class PseudoNetCDF.cmaqfiles.ioapi_base(*args, **kwds)[source]
Bases:
PseudoNetCDFFile
- apply(*args, **kwds)
Wrapper PseudoNetCDFFile.applyAlongDimensions that corrects ROW, COL, LAY and TIME meta-data according to the ioapi format
- Parameters:
PseudoNetCDFFile.applyAlongDimensions (see)
- applyAlongDimensions(*args, **kwds)[source]
Wrapper PseudoNetCDFFile.applyAlongDimensions that corrects ROW, COL, LAY and TIME meta-data according to the ioapi format
- Parameters:
PseudoNetCDFFile.applyAlongDimensions (see)
- audit_meta(fail='warn')[source]
Audit the IOAPI metadata. Checks existence of properties, dimensions internal consistency of properties and dimensions, and character lengths
- Parameters:
fail (bool) – If fail, ‘warn’ or ‘error’ or ‘ignore’
- Returns:
audit stats and audit checklist dictionaries
- Return type:
passing, audit, var_audit
- copy(props=True, dimensions=True, variables=True, data=True)[source]
Function for making copies of the same type
- Parameters:
props (boolean) – include properties (default: True)
dimensions (boolean) – include dimensions (default: True)
variables (boolean) – include variable structures (default: True)
data (boolean) – include variable data (default: True)
- Returns:
outf
- Return type:
PseudoNetCDFFile instance
- copyVariable(var, key=None, dtype=None, dimensions=None, fill_value=None, withdata=True)[source]
Wrapper on PseudoNetCDF.copyVariable that updates VAR-LIST, NVARS, VAR, and TFLAG
See also
see
- createVariable(name, type='f', dimensions=None, fill_value=None, **properties)[source]
Wrapper on PseudoNetCDF.createVariable that updates VAR-LIST, NVARS, VAR, and TFLAG. Also adds long_name, var_desc, and units if not already in properties. long_name and var_desc default to name, while units defaults to unknown. These properties will also be adjusted to expected lengths (16, 80, 16).
See also
see
- eval(*args, **kwds)[source]
Wrapper PseudoNetCDFFile.eval that corrects VAR-LIST and TFLAG meta-data according to the ioapi format
- Parameters:
PseudoNetCDFFile.eval (see)
- classmethod from_arrays(dims=None, attrs=None, nameattr='long_name', fileattrs=None, **inarrkw)[source]
Create a new ioapi file from arrays.
- Parameters:
dims (iterable) – Explicit dimensions. If not provided, they will be diagnosed: TFLAG: (‘TSTEP’, ‘VAR’, ‘DATE-TIME’) Other 4D: (‘TSTEP’, ‘LAY’, ‘ROW’, ‘COL’) Other 3D: (‘TSTEP’, ‘LAY’, ‘PERIM’) Other 2D: (‘ROW’, ‘COL’)
attrs (mappable) – Attributes for all variables (e.g., units). long_name and var_desc will be set based on key if not provided.
nameattr (str)
fileattrs (mappable) – Attributes for the file to be created.
inarrkw (mappable) – Keys are the names of variables to be created and the value should be an array of values.
- Returns:
outf
- Return type:
PseudoNetcdf-like file
- getMap(maptype='basemap_auto', **kwds)[source]
Wrapper PseudoNetCDFFile.getMap that uses NCOLS, XCELL NROWS, and YCELL to calculate map bounds if basemap_auto
- Parameters:
PseudoNetCDFFile.getMap (see)
- getVarlist(update=True, prune=True, retval='list')[source]
- Returns:
update (boolean) – update files attributes to be consistent
prune (bool) – If True, remove variables that are missing or have names longer than 16 characters
retval (str) – Return formatted string ‘str’ or list otherwise
Notes
If VAR-LIST does not exist, it is added assuming all variables with dimensions (‘TSTEP’, ‘LAY’, …) are variables
- interpSigma(vglvls, vgtop=None, interptype='linear', extrapolate=False, fill_value='extrapolate', verbose=0)[source]
- Parameters:
vglvls (iterable) – the new vglvls (edges)
vgtop (scalar) – Converting to new vgtop
interptype (string) – ‘linear’ uses a linear interpolation ‘conserve’ uses a mass conserving interpolation
extrapolate (boolean) – allow extrapolation beyond bounds with linear, default False
fill_value (boolean) – set fill value (e.g, nan) to prevent extrapolation or edge continuation
- Returns:
outf – PseudoNetCDFFile with all variables interpolated
- Return type:
Notes
When extrapolate is false, the edge values are used for points beyond the inputs.
- classmethod isMine(path, *args, **kwds)[source]
True if this file or object can be identified for use by this class. Useful to override for classes that can be initialized from disk.
- mask(*args, **kwds)[source]
Wrapper on PseudoNetCDFFile.subsetVariables that updates VAR-LIST, NVARS, VAR, and TFLAG
See also
see
- plot(varkey, plottype=None, ax_kw=None, plot_kw=None, cbar_kw=None, map_kw=None, dimreduction='mean')[source]
- Parameters:
varkey (string) – the variable to plot
plottype (string) – longitude-latitude, latitude-pressure, longitude-pressure, vertical-profile, time-longitude, time-latitude, time-pressure, default, last two dimensions in reverse order
ax_kw (dictionary) – keywords for the axes to be created
plot_kw (dictionary) – keywords for the plot (plot, scatter, or pcolormesh) to be created
cbar_kw (dictionary or bool or None) – keywords for the colorbar; if True or None, use defaults. If False, do not create a colorbar
map_kw (dictionary or bool or None) – keywords for the getMap routine, which is only used with map capable dimensions (ie, plottype=’longitude-latitude’) If True or None, use default configuration dict(countries=True, coastlines=True, states=False, counties=False). If False, do not draw a map.
dimreduction (string or function) – dimensions not being used in the plot are removed using applyAlongDimensions(dimkey=dimreduction) where each dimenions.
- setncatts(attdict)[source]
Wrapper on PseudoNetCDF.setncatts that updates WDATE, and WTIME
See also
see
- slice(*args, **kwds)
Wrapper PseudoNetCDFFile.sliceDimensions that corrects ROW, COL, LAY and TIME meta-data according to the ioapi format
- Parameters:
PseudoNetCDFFile.sliceDimensions (see)
- sliceDimensions(*args, **kwds)[source]
Wrapper PseudoNetCDFFile.sliceDimensions that corrects ROW, COL, LAY and TIME meta-data according to the ioapi format
- Parameters:
PseudoNetCDFFile.sliceDimensions (see)
- subset(varkeys, inplace=False, exclude=False, keepcoords=True)
Wrapper on PseudoNetCDFFile.subsetVariables that updates VAR-LIST, NVARS, VAR, and TFLAG
See also
see
- subsetVariables(varkeys, inplace=False, exclude=False, keepcoords=True)[source]
Wrapper on PseudoNetCDFFile.subsetVariables that updates VAR-LIST, NVARS, VAR, and TFLAG
See also
see
- class PseudoNetCDF.cmaqfiles.jtable(*args, **kwds)[source]
Bases:
PseudoNetCDFFile