CFA Datastore in Xarray
- class cfapyx.datastore.CFADataStore(manager, group=None, mode=None, lock=CombinedLock([<SerializableLock: d7a0957c-677b-4951-a075-728022f14e46>, <SerializableLock: 7c139720-bd83-4323-93b0-4a87e29426de>]), autoclose=False)[source]
DataStore container for the CFA-netCDF loaded file. Contains all unpacking routines directly related to the specific variables and attributes. The
NetCDF4DatastoreXarray class from which this class inherits, has an__init__method which cannot easily be overriden, so properties are used instead for specific variables that may be un-set at time of use.- wrapper
alias of
FragmentArrayWrapper
- property cfa_options
Property of the datastore that relates private option variables to the standard
cfa_optionsparameter.
- perform_decoding(array_shape, agg_data)[source]
Public method
perform_decodinginvolves extracting the aggregated information parameters and assembling the required information for actual decoding.
- get_variables()[source]
Fetch the netCDF4.Dataset variables and perform some CFA decoding if necessary.
dsis now aGroupedDatasetWrapperobject fromCFAPyX.groupwhich has flattened the group structure and allows fetching of variables and attributes from the whole group tree from which a specific group may inherit.- Returns:
A
FrozenDictXarray object of the names of all variables, and methods to fetch those variables, depending on if those variables are standard NetCDF4 or CFA Aggregated variables.
- get_attrs()[source]
Produce the FrozenDict of attributes from the
NetCDF4.DatasetorCFAGroupWrapperin the case of using a group or nested group tree.
- open_variable(name: str, var)[source]
Open a CFA-netCDF variable as either a standard NetCDF4 Datastore variable or as a CFA aggregated variable which requires additional decoding.
- Parameters:
name – (str) A named NetCDF4 variable.
var – (obj) The NetCDF4.Variable object or a tuple with the contents
(NetCDF4.Variable, cfa)wherecfais a bool that determines if the variable is a CFA or standard variable.
- Returns:
The variable object opened as either a standard store variable or CFA aggregated variable.
- open_cfa_variable(name: str, var)[source]
Open a CFA Aggregated variable with the correct parameters to create an Xarray
Variableinstance.- Parameters:
name – (str) A named NetCDF4 variable.
var – (obj) The NetCDF4.Variable object or a tuple with the contents
(NetCDF4.Variable, cfa)wherecfais a bool that determines if the variable is a CFA or standard variable.
- Returns:
An xarray
Variableinstance constructed from the attributes provided here, and data provided by aFragmentArrayWrapperwhich is indexed by Xarray’sLazilyIndexedArrayclass.