aqmbc.models package
Submodules
aqmbc.models.geoscf module
- aqmbc.models.geoscf.download_window(gdnam, dates, sleep=60, metvars=None, chmvars=None, xgcvars=None)[source]
- Parameters:
gdnam (str) – Grid name with definition in GRIDDESC at environ[‘GRIDDESC’], ./GRIDDESC or in the GRIDDESC distributed with aqmbc
dates (list) – Dates to process. Each will be saved separately on disk.
sleep (int) – GEOS-CF OpenDAP will crash if too many calls are made sequentially. Heuristically, a minute between calls prevents crashes.
metvars (list) – Optional list of metvars to subset. See GEOS-CF fluid documentation.
chemvars (list) – Optional list of chmvars to subset. See GEOS-CF fluid documentation.
xgcvars (list) – Optional list of xgcvars to subset. See GEOS-CF fluid documentation.
- Returns:
outpaths – List of paths that were created by download
- Return type:
list
aqmbc.models.raqms module
- aqmbc.models.raqms.download(dates, root=None)[source]
Convenience function for downloading. If root url change
- dateslist
Dates to download
- rootstr
Root path where RAQMS files are available for downloading. If None, defaults to https://bin.ssec.wisc.edu/pub/raqms/ESRL/RAQMS/ If the root path has changed, provide a new value here and raise an issue at https://github.com/barronh/aqmbc/issues
- Returns:
paths – List of paths that were downloaded
- Return type:
list
- class aqmbc.models.raqms.raqms(*args, **kwds)[source]
Bases:
PseudoNetCDFFile
- getTimes(datetype='datetime', bounds=False)[source]
Get an array of datetime objects
- Parameters:
datetype (string or numpy.dtype) – ‘datetime’ or datetime64 dtype
bounds (boolean) – get time boundaries
- Returns:
out – datetime objects or array of numpy’s datetype type
- Return type:
array
Notes
self must have a time or TFLAG variable
- 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:
ioapi_base
Notes
When extrapolate is false, the edge values are used for points beyond the inputs.
- ll2ij(lon, lat, bounds='warn', clean='clip')[source]
Converts lon/lat to 0-based indicies (0,M), (0,N)
- Parameters:
lon (scalar or iterable) – longitudes in decimal degrees
lat (scalar or iterable) – latitudes in decimal degrees
bounds (string) – ignore, error, warn if i,j are out of domain
clean (string) – none - return values regardless of bounds; mask - mask values out of bounds; clip - return min(max(0, v), nx - 1)
- Returns:
i, j
- Return type:
indices (0-based) for variables
aqmbc.models.tcr module
- aqmbc.models.tcr.download(dates, freq='mon', root=None)[source]
Convenience function for downloading. If root url change
- dateslist
Dates to download
- freqstr
mon or 6hr
- rootstr
Root path where TROPESS Composition Reanalysis (TCR) files are available for downloading. If None, defaults to https://tropess.gesdisc.eosdis.nasa.gov/data/ If the root path has changed, provide a new value here and raise an issue at https://github.com/barronh/aqmbc/issues
- Returns:
paths – List of paths that were downloaded
- Return type:
list
- class aqmbc.models.tcr.tcr(*args, **kwds)[source]
Bases:
PseudoNetCDFFile
- getTimes(datetype='datetime', bounds=False)[source]
Get an array of datetime objects
- Parameters:
datetype (string or numpy.dtype) – ‘datetime’ or datetime64 dtype
bounds (boolean) – get time boundaries
- Returns:
out – datetime objects or array of numpy’s datetype type
- Return type:
array
Notes
self must have a time or TFLAG variable
- 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:
ioapi_base
Notes
When extrapolate is false, the edge values are used for points beyond the inputs.
- ll2ij(lon, lat, bounds='warn', clean='clip')[source]
Converts lon/lat to 0-based indicies (0,M), (0,N)
- Parameters:
lon (scalar or iterable) – longitudes in decimal degrees
lat (scalar or iterable) – latitudes in decimal degrees
bounds (string) – ignore, error, warn if i,j are out of domain
clean (string) – none - return values regardless of bounds; mask - mask values out of bounds; clip - return min(max(0, v), nx - 1)
- Returns:
i, j
- Return type:
indices (0-based) for variables
aqmbc.models.util module
- aqmbc.models.util.sigma2coeff_lin(sigma, vglvls)[source]
Calculate weighting coefficients for each source (S) layer to each destination (D) layer using a simple piecewise linear interpolation.
- Parameters:
sigma (array-like) – Source model edges defined as sigma = (p - ptop) / (psrf / ptop)
vglvls (array-like) – CMAQ model edges defined as sigma = (p - ptop) / (psrf / ptop)
- Returns:
coeff – Weights shaped (S,D) of each source (S) layer to each destination (D) layer. The sum of coeff over the S (0) axes should be an array of shape D with all values set to 1.
- Return type:
array
Notes
Both sigma and vglvls are expected in descending order (1 to 0)
Both sigma and vglvls must be use the same ptop and psrf
aqmbc.models.waccm module
- aqmbc.models.waccm.download(dates, root=None, fires='finn')[source]
Convenience function for downloading. If root url change
- dateslist
Dates to download
- firesstr
finn or qfed
- rootstr
Root path where WACCM files are available for downloading. If None, defaults to https://www.acom.ucar.edu/waccm/DATA/ If the root path has changed, provide a new value here and raise an issue at https://github.com/barronh/aqmbc/issues
- Returns:
paths – List of paths that were downloaded
- Return type:
list
- class aqmbc.models.waccm.waccm(*args, **kwds)[source]
Bases:
PseudoNetCDFFile
- 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:
ioapi_base
Notes
When extrapolate is false, the edge values are used for points beyond the inputs.
- ll2ij(lon, lat, bounds='warn', clean='clip')[source]
Converts lon/lat to 0-based indicies (0,M), (0,N)
- Parameters:
lon (scalar or iterable) – longitudes in decimal degrees
lat (scalar or iterable) – latitudes in decimal degrees
bounds (string) – ignore, error, warn if i,j are out of domain
clean (string) – none - return values regardless of bounds; mask - mask values out of bounds; clip - return min(max(0, v), nx - 1)
- Returns:
i, j
- Return type:
indices (0-based) for variables