mpas_analysis.shared.climatology.add_years_months_days_in_month(ds, calendar=None)[source]

Add year, month and daysInMonth as data arrays in ds. The number of days in each month of ds is computed either using the startTime and endTime if available or assuming noleap calendar and ignoring leap years. year and month are computed accounting correctly for the the calendar.

  • ds (xarray.Dataset or xarray.DataArray object) – A data set with a Time coordinate expressed as days since 0001-01-01

  • calendar ({'gregorian', 'noleap'}, optional) – The name of one of the calendars supported by MPAS cores, used to determine year and month from Time coordinate


ds (object of same type as ds) – The data set with year, month and daysInMonth data arrays added (if not already present)