CMAQ

CMAQ uses a reader that inherits many methods from PseudoNetCDFFile, but relies on the ioapi_base class to update meta-data

class PseudoNetCDF.cmaqfiles.ioapi(*args, **kwds)[source]
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)

Wrapper PseudoNetCDFFile.applyAlongDimensions that corrects ROW, COL, LAY and TIME meta-data according to the ioapi format

Parameters

PseudoNetCDFFile.applyAlongDimensions (see) –

close()

Does nothing. Implemented for continuity with Scientific.IO.NetCDF

copy(props=True, dimensions=True, variables=True, data=True)

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)

Wrapper on PseudoNetCDF.copyVariable that updates VAR-LIST, NVARS, VAR, and TFLAG

See also

see()

createCompoundType()

`createCompoundType(self, datatype, datatype_name)`

Creates a new compound data type named datatype_name from the numpy dtype object datatype.

*Note*: If the new compound data type contains other compound data types (i.e. it is a ‘nested’ compound type, where not all of the elements are homogeneous numeric data types), then the ‘inner’ compound types must be created first.

The return value is the netCDF4.CompoundType class instance describing the new datatype.

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

createEnumType()

`createEnumType(self, datatype, datatype_name, enum_dict)`

Creates a new Enum data type named datatype_name from a numpy integer dtype object datatype, and a python dictionary defining the enum fields and values.

The return value is the netCDF4.EnumType class instance describing the new datatype.

createGroup()

`createGroup(self, groupname)`

Creates a new netCDF4.Group with the given groupname.

If groupname is specified as a path, using forward slashes as in unix to separate components, then intermediate groups will be created as necessary (analogous to mkdir -p in unix). For example, createGroup(‘/GroupA/GroupB/GroupC’) will create GroupA, GroupA/GroupB, and GroupA/GroupB/GroupC, if they don’t already exist. If the specified path describes a group that already exists, no error is raised.

The return value is a netCDF4.Group class instance.

createVLType()

`createVLType(self, datatype, datatype_name)`

Creates a new VLEN data type named datatype_name from a numpy dtype object datatype.

The return value is the netCDF4.VLType class instance describing the new datatype.

createVariable(*args, **kwds)[source]

Wrapper on PseudoNetCDF.createVariable that updates VAR-LIST, NVARS, VAR, and TFLAG

See also

see()

date2num(time, timekey='time')
Parameters
  • time (array-like) – array of datetime.datetime objects

  • timekey (str) – time variable key which requires units and should have calendar. If calendar is missing, standard is the default. default ‘time’

Returns

num – time in relative time as defined by units of time variable (i.e., timekey) which defaults to ‘time’

Return type

array-like

eval(*args, **kwds)

Wrapper PseudoNetCDFFile.eval that corrects VAR-LIST and TFLAG meta-data according to the ioapi format

Parameters

PseudoNetCDFFile.eval (see) –

filepath()

`filepath(self,encoding=None)`

Get the file system path (or the opendap URL) which was used to open/create the Dataset. Requires netcdf >= 4.1.2. The path is decoded into a string using sys.getfilesystemencoding() by default, this can be changed using the encoding kwarg.

flush()

Does nothing. Implemented for continuity with Scientific.IO.NetCDF

classmethod from_ncf(infile)[source]
Parameters

infile (PseudoNetCDF-like file) –

Returns

outf

Return type

PseudoNetcdf-like file

classmethod from_ncvs(*invars, **invarkw)
Parameters
  • invars (list) – NetCDF-like variable must have standard_name, long_name or name

  • invarkw (kwds) – NetCDF-like variables

Returns

outf

Return type

PseudoNetcdf-like file

getCoords()

Return a list of coordkeys

getMap(maptype='basemap_auto', **kwds)

Wrapper PseudoNetCDFFile.getMap that uses NCOLS, XCELL NROWS, and YCELL to calculate map bounds if basemap_auto

Parameters

PseudoNetCDFFile.getMap (see) –

getTimes(datetype='datetime', bounds=False)

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

getVarlist(update=True)
Returns

update – update files attributes to be consistent

Return type

boolean

Notes

If VAR-LIST does not exist, it is added assuming all variables with dimensions (‘TSTEP’, ‘LAY’, …) are variables

get_dest()

Returns the path where a new file is created on some action

If None, a file is created in memory. Else, a netcdf file is created on disk.

get_variables_by_attributes()

`get_variables_by_attribute(self, **kwargs)`

Returns a list of variables that match specific conditions.

Can pass in key=value parameters and variables are returned that contain all of the matches. For example,

:::python >>> # Get variables with x-axis attribute. >>> vs = nc.get_variables_by_attributes(axis=’X’) >>> # Get variables with matching “standard_name” attribute >>> vs = nc.get_variables_by_attributes(standard_name=’northward_sea_water_velocity’)

Can pass in key=callable parameter and variables are returned if the callable returns True. The callable should accept a single parameter, the attribute value. None is given as the attribute value when the attribute does not exist on the variable. For example,

:::python >>> # Get Axis variables >>> vs = nc.get_variables_by_attributes(axis=lambda v: v in [‘X’, ‘Y’, ‘Z’, ‘T’]) >>> # Get variables that don’t have an “axis” attribute >>> vs = nc.get_variables_by_attributes(axis=lambda v: v is None) >>> # Get variables that have a “grid_mapping” attribute >>> vs = nc.get_variables_by_attributes(grid_mapping=lambda v: v is not None)

get_varopt()

Get options

Parameters

None

Returns

options

Return type

dictionary of optiosn

getncattr()

`getncattr(self,name)`

retrieve a netCDF dataset or group attribute. Use if you need to get a netCDF attribute with the same name as one of the reserved python attributes.

option kwarg encoding can be used to specify the character encoding of a string attribute (default is utf-8).

getncatts()

Return all ncattrs keys and values as a dictionary

Returns

attdict – key/value pairs of properties

Return type

dictionary

getproj(withgrid=False, projformat='pyproj')

Description

Parameters
  • withgrid (boolean) – use grid units instead of meters

  • projformat (string) – ‘pyproj’ (default), ‘proj4’ or ‘wkt’ allows function to return a pyproj projection object or a string in the format of proj4 or WKT

Returns

proj – (wkt, proj4) or pyprojProj (pyproj)

Return type

string pyproj.Proj

ij2ll(i, j)

Converts i, j to lon, lat (no false easting/northing) using cell centers assuming 0-based i/j

Parameters
  • i (scalar/iterable) – indicies (0-based) for the west-east dimension

  • j (scalar/iterable) – indicies (0-based) for the south-north dimension

Returns

lon, lat – longitudes and latitudes in decimal degrees

Return type

scalars or iterables

insertDimension(newonly=True, multionly=False, before=None, after=None, inplace=False, **newdims)

Insert dimensions with keys and lengths from newdims

Parameters
  • **newdims (dictionary) – where key is the new dimension and value is the length

  • newonly (boolean) – Only add dimension to variables that do not already have it, default True

  • multionly (boolean) – Only add dimension if there are already more than one (good for ignoring coordinate dimensions)

  • before (string) – if variable has this dimension, insert the new dimension before it. Otherwise, add to the beginning. (before takes precedence)

  • after (string) – if variable has this dimension, insert the new dimension after it. Otherwise, add to the beginning.

  • inplace (boolean) – create the new variable in this netcdf file (default False)

Returns

outf – instance will new dimension in dimensions and variables

Return type

PseudoNetCDFFile

Notes

  1. Adding a non unity dimension will cause the data to be repeated along the new axis.

  2. If order of addition matters, use multiple calls. newdimsuse will be a non-ordered dictionary

interpDimension(dimkey, newdimvals, coordkey=None, **interpkwds)
Parameters
  • dimkey (string) – the new dimension for interpolation

  • newdimvals (iterable) – the new values to interpolate to

  • coordkey (string) – the variable to use as the old coordinate values

  • interptype (string) –

    ‘linear’ or ‘conserve’. linear uses a linear interpolation

    conserve uses a mass conserving interpolation

  • extrapolate (boolean) – allow extrapolation beyond bounds with linear, default False

  • fill_value (numeric value) – set fill value (e.g, nan) to prevent extrapolation or edge continuation

Returns

outf – instance with all variables interpolated

Return type

PseudoNetCDFFile

Notes

When extrapolate is false, the edge values are used for points beyond the inputs.

interpSigma(vglvls, vgtop=None, interptype='linear', extrapolate=False, fill_value='extrapolate', verbose=0)
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.

classmethod isMine(*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.

isopen()

`close(self)`

is the Dataset open or closed?

ll2ij(lon, lat, bounds='ignore', clean='none')

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

ll2xy(lon, lat)

Converts lon/lat to x distances (no false easting/northing)

Parameters
  • lon (scalar or iterable) – longitudes in decimal degrees

  • lat (scalar or iterable) – latitudes in decimal degrees

Returns

x, y – coordinates in map projection (meters or radians)

Return type

tuple of arrays

mask(*args, **kwds)

Wrapper on PseudoNetCDFFile.subsetVariables that updates VAR-LIST, NVARS, VAR, and TFLAG

See also

see()

ncattrs()

`ncattrs(self)`

return netCDF global attribute names for this netCDF4.Dataset or netCDF4.Group in a list.

plot(varkey, plottype='longitude-latitude', ax_kw=None, plot_kw=None, cbar_kw=None, map_kw=None, dimreduction='mean')
Parameters
  • varkey (string) – the variable to plot

  • plottype (string) – longitude-latitude, latitude-pressure, longitude-pressure, vertical-profile, time-longitude, time-latitude, time-pressure, default, longitude-latitude

  • 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) – keywords for the colorbar

  • map_kw (dictionary) – keywords for the getMap routine, which is only used with plottype=’longitude-latitude’

  • dimreduction (string or function) – dimensions not being used in the plot are removed using applyAlongDimensions(dimkey=dimreduction) where each dimenions

removeSingleton(dimkey=None)

Return a netcdflike object with dimensions sliced

Parameters

dimkey (string) – key of dimension to be evaluated for removal; if None, evaluate all. only singleton dimensions will be removed.

Returns

outf – instance with dimensions removed

Return type

PseudoNetCDFFile

renameAttribute()

`renameAttribute(self, oldname, newname)`

rename a netCDF4.Dataset or netCDF4.Group attribute named oldname to newname.

renameDimension(oldkey, newkey, inplace=False)

Rename dimension (oldkey) in dimensions and in all variables

Parameters
  • oldkey (string) – dimension to be renamed

  • newkey (string) – new dame for dimension

  • inplace (boolean) – create the new variable in this netcdf file (default False)

Returns

outf – instance with renamed variable (this file if inplace = True)

Return type

PseudoNetCDFFile

renameDimensions(inplace=False, **newkeys)

Rename dimension (oldkey) in dimensions and in all variables

Parameters
  • **newkeys (dictionary) – where key is the oldkey and value is the newkey

  • inplace (boolean) – create the new variable in this netcdf file (default False)

Returns

outf – instance with renamed variable (this file if inplace = True)

Return type

PseudoNetCDFFile

renameGroup()

`renameGroup(self, oldname, newname)`

rename a netCDF4.Group named oldname to newname (requires netcdf >= 4.3.1).

renameVariable(oldkey, newkey, inplace=False, copyall=True)

Rename variable (oldkey)

Parameters
  • oldkey (string) – variable to be renamed

  • newkey (string) – new dame for variable

  • inplace (boolean) – create the new variable in this netcdf file (default False)

  • copyall (boolean) – if not inplace, should all variables be copied to new file

Returns

outf – instance with renamed variable (this file if inplace = True)

Return type

PseudoNetCDFFile

renameVariables(inplace=False, copyall=True, **newkeys)

Rename variables for each oldkey: newkey dictionary item

Parameters
  • **newkeys (dictionary) – where key is the oldkey and value is the newkey

  • inplace (boolean) – create the new variable in this netcdf file (default False)

  • copyall (boolean) – if not inplace, should all variables be copied to new file

Returns

outf – instance with renamed variable (this file if inplace = True)

Return type

PseudoNetCDFFile

reorderDimensions(oldorder, neworder, inplace=False)

Evaluate expr and return a PseudoNetCDFFile object with resutl

Parameters
  • oldorder (iterable of strings) – dimension names in existing order

  • neworder (iterable of strings) – dimension names in new order

Returns

outf – instance with dimensions reordered in variables

Return type

PseudoNetCDFFile

save(*args, **kwds)

Provides access to pncwrite for self

Parameters

Help pncwrite (see) –

Returns

Return type

see Help pncwrite

setCoords(keys, missing='ignore')

Set a variable as a coordinate variable

Parameters
  • keys (iterable of strings) – keys for coord variables

  • missing (string) – action if missing ‘ignore’, ‘skip’ or ‘error’ ignore - add in case used later skip - do not add error - raise an error

Returns

Return type

None

Notes

Coordinate variables are excluded from math

set_always_mask()

`set_always_mask(self, True_or_False)`

Call netCDF4.Variable.set_always_mask for all variables contained in this netCDF4.Dataset or netCDF4.Group, as well as for all variables in all its subgroups.

`True_or_False`: Boolean determining if automatic conversion of masked arrays with no missing values to regular numpy arrays shall be applied for all variables. Default True. Set to False to restore the default behaviour in versions prior to 1.4.1 (numpy array returned unless missing values are present, otherwise masked array returned).

*Note*: Calling this function only affects existing variables. Variables created after calling this function will follow the default behaviour.

set_auto_chartostring()

`set_auto_chartostring(self, True_or_False)`

Call netCDF4.Variable.set_auto_chartostring for all variables contained in this netCDF4.Dataset or netCDF4.Group, as well as for all variables in all its subgroups.

`True_or_False`: Boolean determining if automatic conversion of all character arrays <–> string arrays should be performed for character variables (variables of type NC_CHAR or S1) with the _Encoding attribute set.

*Note*: Calling this function only affects existing variables. Variables created after calling this function will follow the default behaviour.

set_auto_mask()

`set_auto_mask(self, True_or_False)`

Call netCDF4.Variable.set_auto_mask for all variables contained in this netCDF4.Dataset or netCDF4.Group, as well as for all variables in all its subgroups.

`True_or_False`: Boolean determining if automatic conversion to masked arrays shall be applied for all variables.

*Note*: Calling this function only affects existing variables. Variables created after calling this function will follow the default behaviour.

set_auto_maskandscale()

`set_auto_maskandscale(self, True_or_False)`

Call netCDF4.Variable.set_auto_maskandscale for all variables contained in this netCDF4.Dataset or netCDF4.Group, as well as for all variables in all its subgroups.

`True_or_False`: Boolean determining if automatic conversion to masked arrays and variable scaling shall be applied for all variables.

*Note*: Calling this function only affects existing variables. Variables created after calling this function will follow the default behaviour.

set_auto_scale()

`set_auto_scale(self, True_or_False)`

Call netCDF4.Variable.set_auto_scale for all variables contained in this netCDF4.Dataset or netCDF4.Group, as well as for all variables in all its subgroups.

`True_or_False`: Boolean determining if automatic variable scaling shall be applied for all variables.

*Note*: Calling this function only affects existing variables. Variables created after calling this function will follow the default behaviour.

set_dest(path, **options)

Sets the path where a new file is created on some action

Parameters
  • path (path for new file) –

  • options (options for new file creation) –

Returns

Return type

None

set_fill_off()

`set_fill_off(self)`

Sets the fill mode for a netCDF4.Dataset open for writing to off.

This will prevent the data from being pre-filled with fill values, which may result in some performance improvements. However, you must then make sure the data is actually written before being read.

set_fill_on()

`set_fill_on(self)`

Sets the fill mode for a netCDF4.Dataset open for writing to on.

This causes data to be pre-filled with fill values. The fill values can be controlled by the variable’s _Fill_Value attribute, but is usually sufficient to the use the netCDF default _Fill_Value (defined separately for each variable type). The default behavior of the netCDF library corresponds to set_fill_on. Data which are equal to the _Fill_Value indicate that the variable was created, but never written to.

set_ncstring_attrs()

`set_ncstring_attrs(self, True_or_False)`

Call netCDF4.Variable.set_ncstring_attrs for all variables contained in this netCDF4.Dataset or netCDF4.Group, as well as for all its subgroups and their variables.

`True_or_False`: Boolean determining if all string attributes are created as variable-length NC_STRINGs, (if True), or if ascii text attributes are stored as NC_CHARs (if False; default)

*Note*: Calling this function only affects newly created attributes of existing (sub-) groups and their variables.

set_varopt(**options)

Set options to be used when creating any Variable

Parameters

options (options for new Variable creation) –

Returns

Return type

None

setncattr(k, v)

`setncattr(self,name,value)`

set a netCDF dataset or group attribute using name,value pair. Use if you need to set a netCDF attribute with the with the same name as one of the reserved python attributes.

setncattr_string()

`setncattr_string(self,name,value)`

set a netCDF dataset or group string attribute using name,value pair. Use if you need to ensure that a netCDF attribute is created with type NC_STRING if the file format is NETCDF4.

setncatts(attdict)

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)

Wrapper PseudoNetCDFFile.sliceDimensions that corrects ROW, COL, LAY and TIME meta-data according to the ioapi format

Parameters

PseudoNetCDFFile.sliceDimensions (see) –

stack(other, stackdim)

Concatenates all variables on stackdim

Parameters
  • other (instance or list of PseudoNetCDFFiles) – files to add to this file along stackdim

  • stackdim (str) – dimension name

Returns

outf – instance with stacked variables and dimension equal to new length

Return type

PseudoNetCDFFile

subset(varkeys, inplace=False, exclude=False, keepcoords=True)

Return a PseudoNetCDFFile with only varkeys

Parameters
  • varkeys (iterable of strings) – keys to keep

  • inplace (boolean) – if true (default false), then remove other variable from this file

  • exclude (boolean) – if True (default False), then remove just these variables

  • keepcoords (boolean) – if True (default True), keep coordinate variables

Returns

outf – instance with variables

Return type

PseudoNetCDFFile

subsetVariables(varkeys, inplace=False, exclude=False, keepcoords=True)

Wrapper on PseudoNetCDFFile.subsetVariables that updates VAR-LIST, NVARS, VAR, and TFLAG

See also

see()

sync()

Does nothing. Implemented for continuity with Scientific.IO.NetCDF

time2idx(time, dim='time', timekey=None, **kwds)

Convert datetime objects to dimension indices

Parameters
  • time (array-like) – array of datetime.datetime objects

  • dim (str) – dimension name for val2idx

  • timekey (str) – time variable key. None defaults to dim

  • kwds (mappable) – see val2idx

Returns

idx – time index (0-based)

Return type

array-like

time2t(time, ttype='nearest', index=True)
Parameters
  • time (array of datetime.datetime objects) –

  • interp ('nearest', 'bounds', 'bounds_close') –

  • index (return index) –

Returns

t

Return type

fractional time or if index, integers for indexing

updatemeta(attdict={}, sortmeta=False)
Parameters
  • attdict (dictionary) – key value pairs to update meta data

  • sortmeta (boolean) – sort meta data after update

Returns

Return type

None

Notes

Meta data not provided or present will be inferred or made up. (See _ioapi_defaults)

val2idx(dim, val, method='nearest', bounds='warn', left=None, right=None, clean='mask')

Convert coordinate values to indices

Parameters
  • dim (str) – name of dimensions, which must have a coordinate variable

  • val (array-like) – value in coordinate space

  • method (str) –

    nearest, bounds, exact - each calculates the index differently
    • nearest : uses interp with coord values and rounds

    • bounds : uses interp between bounding values and truncates

    • exactreturns indices for exact coord values with other

      indices masked (clean keyword has no effect)

  • bounds (str) – ignore, error, warn if i,j are out of domain

  • left (scalar) – see np.interp

  • right (scalar) – see np.interp

  • clean ({'none', 'mask'}) –

    none - return values regardless of bounds; mask - mask invalid values (use with left/right=np.nan);

    has no affect with method exact

Returns

i – indices (0-based) for variables

Return type

array-like

xy2ll(x, y)

Converts x, y to lon, lat (no false easting/northing)

Parameters
  • x (scalar or iterable) – projected west-east coordinates

  • y (scalar or iterable) – projected south-north coordinates

Returns

lon, lat – longitudes and latitudes in decimal degrees

Return type

scalars or iterables

class PseudoNetCDF.cmaqfiles.ioapi_base(*args, **kwds)[source]
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) –

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, dimensions, fill_value=None, **properties)[source]

Wrapper on PseudoNetCDF.createVariable that updates VAR-LIST, NVARS, VAR, and TFLAG

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) –

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)[source]
Returns

update – update files attributes to be consistent

Return type

boolean

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

ioapi_base

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='longitude-latitude', 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, longitude-latitude

  • 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) – keywords for the colorbar

  • map_kw (dictionary) – keywords for the getMap routine, which is only used with plottype=’longitude-latitude’

  • 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) –

subsetVariables(varkeys, inplace=False, exclude=False, keepcoords=True)[source]

Wrapper on PseudoNetCDFFile.subsetVariables that updates VAR-LIST, NVARS, VAR, and TFLAG

See also

see()

updatemeta(attdict={}, sortmeta=False)[source]
Parameters
  • attdict (dictionary) – key value pairs to update meta data

  • sortmeta (boolean) – sort meta data after update

Returns

Return type

None

Notes

Meta data not provided or present will be inferred or made up. (See _ioapi_defaults)