Logo Iris 1.12

Previous topic

iris.config

Next topic

iris.coord_systems

This Page

iris.coord_categorisation

Cube functions for coordinate categorisation.

All the functions provided here add a new coordinate to a cube.
  • The function add_categorised_coord() performs a generic coordinate categorisation.
  • The other functions all implement specific common cases (e.g. add_day_of_month()). Currently, these are all calendar functions, so they only apply to “Time coordinates”.

In this module:

iris.coord_categorisation.add_categorised_coord(cube, name, from_coord, category_function, units='1')

Add a new coordinate to a cube, by categorising an existing one.

Make a new iris.coords.AuxCoord from mapped values, and add it to the cube.

Args:

  • cube (iris.cube.Cube):

    the cube containing ‘from_coord’. The new coord will be added into it.

  • name (string):

    name of the created coordinate

  • from_coord (iris.coords.Coord or string):

    coordinate in ‘cube’, or the name of one

  • category_function (callable):

    function(coordinate, value), returning a category value for a coordinate point-value

Kwargs:

  • units:

    units of the category value, typically ‘no_unit’ or ‘1’.

↑ top ↑

iris.coord_categorisation.add_day_of_month(cube, coord, name='day_of_month')

Add a categorical day-of-month coordinate, values 1..31.

↑ top ↑

iris.coord_categorisation.add_day_of_year(cube, coord, name='day_of_year')

Add a categorical day-of-year coordinate, values 1..365 (1..366 in leap years).

↑ top ↑

iris.coord_categorisation.add_hour(cube, coord, name='hour')

Add a categorical hour coordinate, values 0..23.

↑ top ↑

iris.coord_categorisation.add_month(cube, coord, name='month')

Add a categorical month coordinate, values ‘Jan’..’Dec’.

↑ top ↑

iris.coord_categorisation.add_month_fullname(cube, coord, name='month_fullname')

Add a categorical month coordinate, values ‘January’..’December’.

↑ top ↑

iris.coord_categorisation.add_month_number(cube, coord, name='month_number')

Add a categorical month coordinate, values 1..12.

↑ top ↑

iris.coord_categorisation.add_season(cube, coord, name='season', seasons=('djf', 'mam', 'jja', 'son'))

Add a categorical season-of-year coordinate, with user specified seasons.

Args:

  • cube (iris.cube.Cube):

    The cube containing ‘coord’. The new coord will be added into it.

  • coord (iris.coords.Coord or string):

    Coordinate in ‘cube’, or its name, representing time.

Kwargs:

  • name (string):

    Name of the created coordinate. Defaults to “season”.

  • seasons (list of strings):

    List of seasons defined by month abbreviations. Each month must appear once and only once. Defaults to standard meteorological seasons (‘djf’, ‘mam’, ‘jja’, ‘son’).

↑ top ↑

iris.coord_categorisation.add_season_membership(cube, coord, season, name='season_membership')

Add a categorical season membership coordinate for a user specified season.

The coordinate has the value True for every time that is within the given season, and the value False otherwise.

Args:

  • cube (iris.cube.Cube):

    The cube containing ‘coord’. The new coord will be added into it.

  • coord (iris.coords.Coord or string):

    Coordinate in ‘cube’, or its name, representing time.

  • season (string):

    Season defined by month abbreviations.

Kwargs:

  • name (string):

    Name of the created coordinate. Defaults to “season_membership”.

↑ top ↑

iris.coord_categorisation.add_season_number(cube, coord, name='season_number', seasons=('djf', 'mam', 'jja', 'son'))

Add a categorical season-of-year coordinate, values 0..N-1 where N is the number of user specified seasons.

Args:

  • cube (iris.cube.Cube):

    The cube containing ‘coord’. The new coord will be added into it.

  • coord (iris.coords.Coord or string):

    Coordinate in ‘cube’, or its name, representing time.

Kwargs:

  • name (string):

    Name of the created coordinate. Defaults to “season_number”.

  • seasons (list of strings):

    List of seasons defined by month abbreviations. Each month must appear once and only once. Defaults to standard meteorological seasons (‘djf’, ‘mam’, ‘jja’, ‘son’).

↑ top ↑

iris.coord_categorisation.add_season_year(cube, coord, name='season_year', seasons=('djf', 'mam', 'jja', 'son'))

Add a categorical year-of-season coordinate, with user specified seasons.

Args:

  • cube (iris.cube.Cube):

    The cube containing ‘coord’. The new coord will be added into it.

  • coord (iris.coords.Coord or string):

    Coordinate in ‘cube’, or its name, representing time.

Kwargs:

  • name (string):

    Name of the created coordinate. Defaults to “season_year”.

  • seasons (list of strings):

    List of seasons defined by month abbreviations. Each month must appear once and only once. Defaults to standard meteorological seasons (‘djf’, ‘mam’, ‘jja’, ‘son’).

↑ top ↑

iris.coord_categorisation.add_weekday(cube, coord, name='weekday')

Add a categorical weekday coordinate, values ‘Mon’..’Sun’.

↑ top ↑

iris.coord_categorisation.add_weekday_fullname(cube, coord, name='weekday_fullname')

Add a categorical weekday coordinate, values ‘Monday’..’Sunday’.

↑ top ↑

iris.coord_categorisation.add_weekday_number(cube, coord, name='weekday_number')

Add a categorical weekday coordinate, values 0..6 [0=Monday].

↑ top ↑

iris.coord_categorisation.add_year(cube, coord, name='year')

Add a categorical calendar-year coordinate.