mpas_analysis.shared.climatology.add_years_months_days_in_month¶
- mpas_analysis.shared.climatology.add_years_months_days_in_month(ds, calendar=None)[source]¶
Add
year
,month
anddaysInMonth
as data arrays inds
. The number of days in each month ofds
is computed either using thestartTime
andendTime
if available or assumingnoleap
calendar and ignoring leap years.year
andmonth
are computed accounting correctly for the the calendar.- Parameters
ds (
xarray.Dataset
orxarray.DataArray
object) – A data set with aTime
coordinate expressed as days since 0001-01-01calendar ({'gregorian', 'noleap'}, optional) – The name of one of the calendars supported by MPAS cores, used to determine
year
andmonth
fromTime
coordinate
- Returns
ds (object of same type as
ds
) – The data set withyear
,month
anddaysInMonth
data arrays added (if not already present)