PseudoNetCDF.core package
Module contents
- PseudoNetCDF.core.PseudoIOAPIVariable(parent, name, typecode, dimensions, **kwds)[source]
Creates a variable using the dimensions as defined in the parent object
- Parameters:
parent (PseudoNetCDFFile) – an object with a dimensions variable
name (string) – name for variable
typecode (string or numpy.dtype) – numpy style typecode
dimensions (tuple of strings) – dimension names to be used from parent
**kwds (dictionary) – units: default = none long_name: default = name var_desc: default = name
- class PseudoNetCDF.core.PseudoNetCDFDimension(group, name, size)[source]
Bases:
object
Dimension object responds like that of netcdf4-python
- class PseudoNetCDF.core.PseudoNetCDFFile(*args, **kwds)[source]
Bases:
pnc
,object
PseudoNetCDFFile provides an interface and standard set of methods that a file should present to act like a netCDF file using the Scientific.IO.NetCDF.NetCDFFile interface.
- apply(verbose=0, **dimfuncs)
Similar to numpy.apply_along_axis, but for damed dimensions and processes dimensions as well as variables
- Parameters:
dimfuncs (dictionary) – key value pairs where the key is a dimensions and the value is a 1D function (func1d) or a dictionary. If the value is a dictionary it must include func1d as a function and any keyword arguments as additional options
verbose (integer) – 0 silent, 1 show variable, 2 show dimensions and variables
- Returns:
outf – instance with variables and dimensions after processing
- Return type:
- applyAlongDimensions(verbose=0, **dimfuncs)[source]
Similar to numpy.apply_along_axis, but for damed dimensions and processes dimensions as well as variables
- Parameters:
dimfuncs (dictionary) – key value pairs where the key is a dimensions and the value is a 1D function (func1d) or a dictionary. If the value is a dictionary it must include func1d as a function and any keyword arguments as additional options
verbose (integer) – 0 silent, 1 show variable, 2 show dimensions and variables
- Returns:
outf – instance with variables and dimensions after processing
- Return type:
- 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]
Copy var into self as vark
- Parameters:
var (PseudoNetCDFVariable) – netCDF4.Variable-like object (must have ncattrs and setncatts)
key (string) – key for variable in self (can be omitted if var has name, standard_name, or long_name)
dtype (string or numpy.dtype) – change the data type to dtype
dimensions (iterable of strings) – change the dimensions to dimensions
fill_value (integer or flaot) – change the fill_value to this values
withdata (boolean) – default True, copies data
- Returns:
myvar – copy of var in this file
- Return type:
PseuodNetCDFVairable
- createDimension(name, length)[source]
Create a dimension
- Parameters:
name (string) – name for dimension
length (integer) – maximum length of dimension
- Returns:
dim – new dimension
- Return type:
PseudoNetCDFDimensions
- createVariable(name, type, dimensions, fill_value=None, **properties)[source]
Create a variable
- Parameters:
name (string) – name for new variable
type (string or numpy dtype) – code (e.g., ‘f’, ‘i’, ‘d’)
dimensions (tuple of strigns) – dimension keys that can be found in objects’ dimensions dictionary
- Returns:
var
- Return type:
new variable
- date2num(time, timekey='time')[source]
- 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(expr, inplace=False, copyall=False)[source]
Evaluate expr and return a PseudoNetCDFFile object with resutl
- Parameters:
expr (string) – expression to evaluate
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:
- flush()
Does nothing. Implemented for continuity with Scientific.IO.NetCDF
- classmethod from_arrays(dims=None, attrs=None, nameattr='standard_name', fileattrs=None, **inarrkw)[source]
Create a new ioapi file from arrays.
- Parameters:
dims (iterable) – Explicit dimensions. If not provided, they will be created as phony_dim_{i} where i for i in range(ndim). For example, an array of shape (2, 3) would have dimensions (phony_dim_0, phony_dim_1)
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) – Key for name as an attribute
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
- classmethod from_ncf(infile)[source]
- Parameters:
infile (PseudoNetCDF-like file)
- Returns:
outf
- Return type:
PseudoNetcdf-like file
- classmethod from_ncvs(*invars, **invarkw)[source]
- 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
- getMap(maptype='basemap_auto', **kwds)[source]
Description
- Parameters:
maptype (string) –
choices ‘basemap’, ‘basemap_auto’, ‘cartopy’ (not yet) basemap : attempts to open a basemap with only supplied kwds basemap_auto : automatically adds llcrnrlon,llcrnrlat,u
rcrnrlon,urcrnrlat based on longitude_bounds
**kwds (keywords) – for basemap or cartopy
- Returns:
map
- Return type:
basemap or cartopy axis
- 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
- get_dest()[source]
- Returns:
path – path where a new file is created on some action
- Return type:
str
Notes
If None, a file is created in memory. Else, a netcdf file is created on disk.
- get_varopt()[source]
Get options
- Parameters:
None
- Returns:
options
- Return type:
dictionary of options
- getncatts()[source]
Return all ncattrs keys and values as a dictionary
- Returns:
attdict – key/value pairs of properties
- Return type:
dictionary
- getproj(withgrid=False, projformat='pyproj')[source]
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)[source]
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)[source]
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:
Notes
Adding a non unity dimension will cause the data to be repeated along the new axis.
If order of addition matters, use multiple calls. newdimsuse will be a non-ordered dictionary
- interpDimension(dimkey, newdimvals, coordkey=None, **interpkwds)[source]
- 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:
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.
- ll2ij(lon, lat, bounds='ignore', clean='none')[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
- ll2xy(lon, lat)[source]
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(where=None, less=None, less_equal=None, greater=None, greater_equal=None, values=None, equal=None, invalid=False, mask=None, dims=None, fill_value=-999, coords=False, verbose=0)[source]
Apply mask to all variables of same shape or just where dimensions match.
- Parameters:
where (array-like) – boolean array to use as a mask see numpy.ma.masked_where
greater (scalar) – mask when values are greater than this value see numpy.ma.masked_greater
less (scalar) – mask when values are less than this value see numpy.ma.masked_less
greater_equal (scalar) – mask when values are greater than or equal to this value see numpy.ma.masked_greater
less_equal (scalar) – mask when values are less than or equal to this value see numpy.ma.masked_less
values (scalar) – mask when values are equal to this value within standard floating point see numpy.ma.masked_values
equal (scalar) – mask when values are exactly this value (i.e., integers) see numpy.ma.masked_equal
invalid (boolean) – mask when values are invalid, see numpy.ma.masked_invalid
mask (array-like) – alias for where
dims (iterable of strings) – only apply “mask” or “where” to variables with these dimensions no effet on other masks
fill_value (scalar) – value to use as the fill_value for new arrays
coords (boolean) – if True, apply masks to coordinate variables. Default, False
verbose (int) – level of verbosity for function, mostly for debugging
- Returns:
outf – instance with masked variables
- Return type:
See also
numpy.ma
all masks are passing throught to numpy.ma.masked_…
Notes
mask options are not mutually exclusive. the order is where, greater, greater_equal, less, less_equal, values, equal, invalid
- 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) – any dimension name pair delimited by a hyphen (e.g., longitude-latitude, latitude-pressure, longitude-pressure, vertical-profile, time-longitude, time-latitude, time-pressure) defaults to the last two dimensions.
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
- Returns:
ax – Axes that was drawn on
- Return type:
matplotlib.axes.Axes
- removeSingleton(dimkey=None)[source]
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:
- renameDimension(oldkey, newkey, inplace=False)[source]
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:
- renameDimensions(inplace=False, **newkeys)[source]
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:
- renameVariable(oldkey, newkey, inplace=False, copyall=True)[source]
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:
- renameVariables(inplace=False, copyall=True, **newkeys)[source]
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:
- reorderDimensions(oldorder, neworder, inplace=False)[source]
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:
- save(*args, **kwds)[source]
Provides access to pncwrite for self
- Parameters:
pncwrite (see Help)
- Return type:
see Help pncwrite
- setCoords(keys, missing='ignore')[source]
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
- Return type:
None
Notes
Coordinate variables are excluded from math
- set_dest(path, **options)[source]
Sets the path where a new file is created on some action
- Parameters:
path (str) – path for new file
**options (keywords for constructor) – options for new file creation
- Return type:
None
- set_varopt(**options)[source]
Set options to be used when creating any Variable
- Parameters:
**options (options for createVariable) – optional keywords to be supplied when creating new variables in destination file
- Return type:
None
- setncatts(attdict)[source]
Set ncattrs from attdict keys and values
- Parameters:
attdict (dictionary) – key/value pairs of properties
- Return type:
None
- slice(newdims=('POINTS',), verbose=0, **dimslices)
Return a netcdflike object with dimensions sliced
- Parameters:
newdims (iterable of strings) – names for new dimensions. When more than one iterable applies to a variable slice, fancy indexing removes both dimensions and creates a new one of the iterable lengths
**dimslices (dictionary) – key value pairs where the key is a dimension and the value is a valid slice object (slices, ints or iterables) if iterables are provided, all iterables must be the same size and shape. If the arrays are not 1D, newdims must have ndim names
- Returns:
outf – instance with variables and dimensions sliced
- Return type:
- sliceDimensions(newdims=('POINTS',), verbose=0, **dimslices)[source]
Return a netcdflike object with dimensions sliced
- Parameters:
newdims (iterable of strings) – names for new dimensions. When more than one iterable applies to a variable slice, fancy indexing removes both dimensions and creates a new one of the iterable lengths
**dimslices (dictionary) – key value pairs where the key is a dimension and the value is a valid slice object (slices, ints or iterables) if iterables are provided, all iterables must be the same size and shape. If the arrays are not 1D, newdims must have ndim names
- Returns:
outf – instance with variables and dimensions sliced
- Return type:
- stack(other, stackdim)[source]
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:
- 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:
- subsetVariables(varkeys, inplace=False, exclude=False, keepcoords=True)[source]
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:
- sync()
Does nothing. Implemented for continuity with Scientific.IO.NetCDF
- time2idx(time, dim='time', timekey=None, **kwds)[source]
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)[source]
- 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
- val2idx(dim, val, method='nearest', bounds='warn', left=None, right=None, clean='mask')[source]
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)[source]
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.core.PseudoNetCDFMaskedVariable(parent, name, typecode='f', dimensions=(), **kwds)[source]
Bases:
PseudoNetCDFVariable
,MaskedArray
Creates a variable using the dimensions as defined in the parent object
- parent: PseudoNetCDFFile
an object with a dimensions variable
- name: string
name for variable
- typecode: string or numpy.dtype
numpy style typecode
- dimensions: tuple of strings
dimension names to be used from parent
- **kwds: dictionary
keywords to be added as properties to the variable. The keyword ‘values’ is a special case that will be used as the starting values of the array
- class PseudoNetCDF.core.PseudoNetCDFVariable(parent, name, typecode, dimensions, **kwds)[source]
Bases:
ndarray
PseudoNetCDFVariable presents the Scientific.IO.NetCDF.NetCDFVariable interface, but unlike that type, provides a contructor for variables that could be used without adding it to the parent file
Creates a variable using the dimensions as defined in the parent object
- Parameters:
parent (PseudoNetCDFFile) – an object with a dimensions variable
name (string) – name for variable
typecode (string or numpy.dtype) – numpy style typecode
dimensions (tuple of strings) – dimension names to be used from parent
**kwds (keywords) – Dictionary of keywords to be added as properties to the variable. The keyword ‘values’ is a special case that will be used as the starting values of the array
- ncattrs()[source]
- Returns:
ncattrs – attributes that have been user defined
- Return type:
tuple of strings
- class PseudoNetCDF.core.PseudoNetCDFVariables(func, keys)[source]
Bases:
OrderedDefaultDict
PseudoNetCDFVariables provides a special implementation of the default dictionary that provides efficient access to variables of a PseudoNetCDFFile. PseudoNetCDFFiles may have large variables that should only be loaded if accessed. PseudoNetCDFVariables allows a user to specify a function that can create variables on demand.
- func: function
must take a key and provides a PseudoNetCDFVariable
- keys: iterable of strings
keys that the dictionary should act as if it has
- PseudoNetCDF.core.extract_from_file(f, lonlatfs, unique=False, gridded=None, method='nn', passthrough=True)[source]
- PseudoNetCDF.core.extract_lonlat(f, lonlat, unique=False, gridded=None, method='nn', passthrough=True)[source]
- PseudoNetCDF.core.interpvars(f, weights, dimension, loginterp=[])[source]
f - PseudoNetCDFFile weights - weights for new dimensions from old dimension dim(new, old) dimension - which dimensions will be reduced loginterp - iterable of keys to interp on log scale
- PseudoNetCDF.core.manglenames(f, translator={' ': '_', '$': 'S', '(': '', ')': '', '+': '_add_', '-': '_'})[source]
- PseudoNetCDF.core.mask_vals(f, maskdef, metakeys=['time', 'layer', 'level', 'latitude', 'longitude', 'time_bounds', 'latitude_bounds', 'longitude_bounds', 'ROW', 'COL', 'LAY', 'TFLAG', 'ETFLAG'])[source]
- class PseudoNetCDF.core.netcdf(*args, **kwds)[source]
Bases:
PseudoNetCDFFile
,Dataset
- 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]
Create a variable
- Parameters:
name (string) – name for new variable
type (string or numpy dtype) – code (e.g., ‘f’, ‘i’, ‘d’)
dimensions (tuple of strigns) – dimension keys that can be found in objects’ dimensions dictionary
- Returns:
var
- Return type:
new variable
- classmethod from_ncf(infile)[source]
- Parameters:
infile (PseudoNetCDF-like file)
- Returns:
outf
- Return type:
PseudoNetcdf-like file
- get_dest()[source]
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_varopt()[source]
Get options
- Parameters:
None
- Returns:
options
- Return type:
dictionary of optiosn
- getncattr(k)[source]
`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).
- 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.
- ncattrs()[source]
`ncattrs(self)`
return netCDF global attribute names for this Dataset or Group in a list.
- setCoords(keys, missing='ignore')[source]
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
- Return type:
None
Notes
Coordinate variables are excluded from math
- set_dest(path, **options)[source]
Sets the path where a new file is created on some action
- Parameters:
path (path for new file)
options (options for new file creation)
- Return type:
None
- PseudoNetCDF.core.pncbfunc(func, ifile1, ifile2, coordkeys=None, verbose=0)[source]
Perform binary function (func) on all variables in ifile1 and ifile2. The returned file (rfile) contains the result
rfile = ifile1 <op> ifile2
op can be any valid operator (e.g., +, -, /, , *, &, ||)
- PseudoNetCDF.core.pncbo(op, ifile1, ifile2, coordkeys=None, verbose=0)[source]
Perform binary operation (op) on all variables in ifile1 and ifile2. The returned file (rfile) contains the result
rfile = ifile1 <op> ifile2
op can be any valid operator (e.g., +, -, /, , *, &, ||)
- PseudoNetCDF.core.pncexpr(expr, ifile, verbose=0)[source]
Evaluate an arbitrary expression in the context of ifile.variables and add the result to the file with appropriate units.
- PseudoNetCDF.core.pncfunc(func, ifile1, coordkeys=None, verbose=0)[source]
Perform function (func) on all variables in ifile1. The returned file (rfile) contains the result
rfile = ifile1 <op>
func can be a function or string
- PseudoNetCDF.core.reduce_dim(f, reducedef, fuzzydim=True, metakeys=['time', 'layer', 'level', 'latitude', 'longitude', 'time_bounds', 'latitude_bounds', 'longitude_bounds', 'ROW', 'COL', 'LAY', 'TFLAG', 'ETFLAG'])[source]
variable dimensions can be reduced using
reduce_dim(file ‘dim,function,weight’)
e.g., reduce_dim(layer,mean,weight).
Weighting is not fully functional.