icclim._core.model.cf_calendar#

Contain the CfCalendar class and the CfCalendarRegistry class.

These classes are used to represent and manage the CF calendars used in the climate indices calculation.

Module Contents#

class icclim._core.model.cf_calendar.CfCalendar[source]#

Represents a CF calendar.

Parameters:
  • aliases (list[str]) – All the possible aliases or poorly typed calendar names targeting the same calendar.

  • is_leap (Callable) – It expects a DataArray argument of years such as da.time.dt.year. Returns a mask of the input telling if the value is part of a leap year or not.

aliases[source]#

All the possible aliases or poorly typed calendar names targeting the same calendar.

Type:

list[str]

is_leap[source]#

It expects a DataArray argument of years such as da.time.dt.year. Returns a mask of the input telling if the value is part of a leap year or not.

Type:

Callable

property name: str[source]#

Returns the name of the calendar.

Returns:

The name of the calendar.

Return type:

str

class icclim._core.model.cf_calendar.CfCalendarRegistry[source]#

Calendars known in CF plus some additional custom aliases for convenience.

Parameters:
  • aliases (list[str]) – All the possible aliases or poorly typed calendar names targeting the same calendar.

  • is_leap (Callable) – It expects a DataArray argument of years such as da.time.dt.year. Returns a mask of the input telling if the value is part of a leap year or not.

_item_class[source]#

The class of the items in the registry.

Type:

type

static get_item_aliases(item: CfCalendar) list[str][source]#

Get the aliases of a CfCalendar item.

Parameters:

item (CfCalendar) – The CfCalendar item.

Returns:

The aliases of the CfCalendar item.

Return type:

list[str]

icclim._core.model.cf_calendar._proleptic_gregorian_leap(years: xarray.DataArray) xarray.DataArray[source]#

Calculate if the years are part of a leap year in the proleptic Gregorian calendar.

Parameters:

years (DataArray) – The years to check.

Returns:

A boolean array indicating if the years are part of a leap year.

Return type:

DataArray

icclim._core.model.cf_calendar._julian_leap(years: xarray.DataArray) xarray.DataArray[source]#

Calculate if the years are part of a leap year in the Julian calendar.

Parameters:

years (DataArray) – The years to check.

Returns:

A boolean array indicating if the years are part of a leap year.

Return type:

DataArray

icclim._core.model.cf_calendar._standard_leap(years: xarray.DataArray) xarray.DataArray[source]#

Calculate if the years are part of a leap year in the standard Gregorian calendar.

Parameters:

years (DataArray) – The years to check.

Returns:

A boolean array indicating if the years are part of a leap year.

Return type:

DataArray