mpas_analysis.shared.io.open_mpas_dataset¶
-
mpas_analysis.shared.io.
open_mpas_dataset
(fileName, calendar, timeVariableNames=['xtime_startMonthly', 'xtime_endMonthly'], variableList=None, startDate=None, endDate=None)[source]¶ Opens and returns an xarray data set given file name(s) and the MPAS calendar name.
- Parameters
- fileNamestr
File path to read
- calendar{
'gregorian'
,'gregorian_noleap'
}, optional The name of one of the calendars supported by MPAS cores
- timeVariableNamesstr or list of 2 str, optional
The name of the time variable (typically
'xtime'
or['xtime_startMonthly', 'xtime_endMonthly']
), orNone
if time does not need to be parsed (and is already in theTime
variable)- variableListlist of strings, optional
If present, a list of variables to be included in the data set
- 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.
- Returns
- ds
xarray.Dataset
- ds
- Raises
- TypeError
If the time variable has an unsupported type (not a date string).
- ValueError
If the time variable is not found in the data set