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:
  • fileName (str) – File path to read

  • calendar ({'gregorian', 'noleap'}, optional) – The name of one of the calendars supported by MPAS cores

  • timeVariableNames (str or list of 2 str, optional) – The name of the time variable (typically 'xtime' or ['xtime_startMonthly', 'xtime_endMonthly']), or None if time does not need to be parsed (and is already in the Time variable)

  • variableList (list of strings, optional) – If present, a list of variables to be included in the data set

  • startDate (string 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.

  • endDate (string 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)

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