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,- monthand- daysInMonthas data arrays in- ds. The number of days in each month of- dsis computed either using the- startTimeand- endTimeif available or assuming- noleapcalendar and ignoring leap years.- yearand- monthare computed accounting correctly for the the calendar.- Parameters:
- ds ( - xarray.Datasetor- xarray.DataArrayobject) – A data set with a- Timecoordinate 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 - yearand- monthfrom- Timecoordinate
 
- Returns:
- ds (object of same type as - ds) – The data set with- year,- monthand- daysInMonthdata arrays added (if not already present)