mpas_analysis.shared.generalized_reader.generalized_reader.open_multifile_dataset

mpas_analysis.shared.generalized_reader.generalized_reader.open_multifile_dataset(fileNames, calendar, config, simulationStartTime=None, timeVariableName='Time', variableList=None, selValues=None, iselValues=None, variableMap=None, startDate=None, endDate=None, chunking=None)[source]

Opens and returns an xarray data set given file name(s) and the MPAS calendar name.

Parameters
fileNameslist of strings

A lsit of file paths to read

calendar{'gregorian', 'gregorian_noleap'}, optional

The name of one of the calendars supported by MPAS cores

configinstance of MpasAnalysisConfigParser

Contains configuration options

simulationStartTimestring, optional

The start date of the simulation, used to convert from time variables expressed as days since the start of the simulation to days since the reference date. simulationStartTime takes one of the following forms:

0001-01-01
0001-01-01 00:00:00

simulationStartTime is only required if the MPAS time variable (identified by timeVariableName) is a number of days since the start of the simulation.

timeVariableNamestring, optional

The name of the time variable (typically 'Time' if using a variableMap or 'xtime' if not using a variableMap)

variableListlist of strings, optional

If present, a list of variables to be included in the data set

selValuesdict, optional

A dictionary of coordinate names (keys) and values or arrays of values used to slice the variales in the data set. See xarray.DataSet.sel() for details on how this dictonary is used. An example:

selectCorrdValues = {'cellLon': 180.0}
iselValuesdict, optional

A dictionary of coordinate names (keys) and indices, slices or arrays of indices used to slice the variales in the data set. See xarray.DataSet.isel() for details on how this dictonary is used. An example:

iselValues = {'nVertLevels': slice(0, 3),
              'nCells': cellIDs}
variableMapdict, optional

A dictionary with keys that are variable names used by MPAS-Analysis and values that are lists of possible names for the same variable in the MPAS dycore that produced the data set (which may differ between versions).

startDate, endDatestring or datetime.datetime, optional

If present, the first and last dates to be used in the data set. The time variable is sliced to only include dates within this range.

chunkingNone, int, True, dict, optional

If integer is present, applies maximum chunk size from config file value maxChunkSize, otherwise if None do not perform chunking. If True, use automated chunking using default config value maxChunkSize. If chunking is a dict use dictionary values for chunking.

Returns
dsxarray.Dataset
Raises
TypeError

If the time variable has an unsupported type (not a date string, a floating-pont number of days since the start of the simulation or a numpy.datatime64 object).

ValueError

If the time variable is not found in the data set or if the time variable is a number of days since the start of the simulation but simulationStartTime is None.