mpas_analysis.shared.mpas_xarray.mpas_xarray.open_multifile_dataset

mpas_analysis.shared.mpas_xarray.mpas_xarray.open_multifile_dataset(fileNames, calendar, simulationStartTime=None, timeVariableName='xtime', variableList=None, selValues=None, iselValues=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

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 'xtime' or 'Time').

variableListlist of strings, optional

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

selectCorrdValuesdict, 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}
Returns
dsxarray.Dataset
Raises
TypeError

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

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.