# iris.coords¶

Definitions of coordinates.

In this module:

A CF auxiliary coordinate.

class`iris.coords.`

`AuxCoord`

(points,standard_name=None,long_name=None,var_name=None,units='1',bounds=None,attributes=None,coord_system=None)¶Bases:

`iris.coords.Coord`

Constructs a single coordinate.

Args:

- points:
- The values (or value in the case of a scalar coordinate) of the coordinate for each cell.
Kwargs:

- standard_name:
- CF standard name of coordinate

- long_name:
- Descriptive name of coordinate

- var_name:
- CF variable name of coordinate

- units
- The
`Unit`

of the coordinate’s values. Can be a string, which will be converted to a Unit object.

- bounds
- An array of values describing the bounds of each cell. Given n bounds for each cell, the shape of the bounds array should be points.shape + (n,). For example, a 1d coordinate with 100 points and two bounds per cell would have a bounds array of shape (100, 2)

- attributes
- A dictionary containing other cf and user-defined attributes.

- coord_system
- A
`CoordSystem`

representing the coordinate system of the coordinate, e.g. a`GeogCS`

for a longitude Coord.

`cell`

(index)¶Return the single

`Cell`

instance which results from slicing the points/bounds with the given index.Note

If iris.FUTURE.cell_datetime_objects is True, then this method will return Cell objects whose points and bounds attributes contain either datetime.datetime instances or netcdftime.datetime instances (depending on the calendar).

Deprecated since version 2.0.0: The option iris.FUTURE.cell_datetime_objects is deprecated and will be removed in a future release; it is now set to True by default. Please update your code to support using cells as datetime objects.

`cells`

()¶Returns an iterable of Cell instances for this Coord.

For example:

for cell in self.cells(): ...

`collapsed`

(dims_to_collapse=None)¶Returns a copy of this coordinate, which has been collapsed along the specified dimensions.

Replaces the points & bounds with a simple bounded region.

Note

You cannot partially collapse a multi-dimensional coordinate. See cube.collapsed for more information.

`contiguous_bounds`

()¶Returns the N+1 bound values for a contiguous bounded coordinate of length N.

Note

If the coordinate is does not have bounds, this method will return bounds positioned halfway between the coordinate’s points.

`convert_units`

(unit)¶Change the coordinate’s units, converting the values in its points and bounds arrays.

For example, if a coordinate’s

`units`

attribute is set to radians then:coord.convert_units('degrees')will change the coordinate’s

`units`

attribute to degrees and multiply each value in`points`

and`bounds`

by 180.0/.

`copy`

(points=None,bounds=None)¶Returns a copy of this coordinate.

Kwargs:

- points: A points array for the new coordinate.
- This may be a different shape to the points of the coordinate being copied.

- bounds: A bounds array for the new coordinate.
- Given n bounds for each cell, the shape of the bounds array should be points.shape + (n,). For example, a 1d coordinate with 100 points and two bounds per cell would have a bounds array of shape (100, 2).
Note

If the points argument is specified and bounds are not, the resulting coordinate will have no bounds.

`core_bounds`

()¶The points array at the core of this coord, which may be a NumPy array or a dask array.

`core_points`

()¶The points array at the core of this coord, which may be a NumPy array or a dask array.

classmethod`from_coord`

(coord)¶Create a new Coord of this type, from the given coordinate.

`guess_bounds`

(bound_position=0.5)¶Add contiguous bounds to a coordinate, calculated from its points.

Puts a cell boundary at the specified fraction between each point and the next, plus extrapolated lowermost and uppermost bound points, so that each point lies within a cell.

With regularly spaced points, the resulting bounds will also be regular, and all points lie at the same position within their cell. With irregular points, the first and last cells are given the same widths as the ones next to them.

Kwargs:

- bound_position:
- The desired position of the bounds relative to the position of the points.
Note

An error is raised if the coordinate already has bounds, is not one-dimensional, or is not monotonic.

Note

Unevenly spaced values, such from a wrapped longitude range, can produce unexpected results : In such cases you should assign suitable values directly to the bounds property, instead.

Note

If iris.FUTURE.clip_latitudes is True, then this method will clip the coordinate bounds to the range [-90, 90] when:

- it is a latitude or grid_latitude coordinate,
- the units are degrees,
- all the points are in the range [-90, 90].
Deprecated since version 2.0.0: The iris.FUTURE.clip_latitudes option is now deprecated and is set to True by default. Please remove code which relies on coordinate bounds being outside the range [-90, 90].

`has_bounds`

()¶Return a boolean indicating whether the coord has a bounds array.

`has_lazy_bounds`

()¶Return a boolean indicating whether the coord’s bounds array is a lazy dask array or not.

`has_lazy_points`

()¶Return a boolean indicating whether the coord’s points array is a lazy dask array or not.

`intersect`

(other,return_indices=False)¶Returns a new coordinate from the intersection of two coordinates.

Both coordinates must be compatible as defined by

`is_compatible()`

.Kwargs:

- return_indices:
- If True, changes the return behaviour to return the intersection indices for the “self” coordinate.

`is_compatible`

(other,ignore=None)¶Return whether the coordinate is compatible with another.

Compatibility is determined by comparing

`iris.coords.Coord.name()`

,`iris.coords.Coord.units`

,`iris.coords.Coord.coord_system`

and`iris.coords.Coord.attributes`

that are present in both objects.Args:

- other:
- An instance of
`iris.coords.Coord`

or`iris.coords.CoordDefn`

.

- ignore:
- A single attribute key or iterable of attribute keys to ignore when comparing the coordinates. Default is None. To ignore all attributes, set this to other.attributes.

- Returns:
- Boolean.

`is_contiguous`

(rtol=1e-05,atol=1e-08)¶Return True if, and only if, this Coord is bounded with contiguous bounds to within the specified relative and absolute tolerances.

Args:

- rtol:
- The relative tolerance parameter (default is 1e-05).

- atol:
- The absolute tolerance parameter (default is 1e-08).

- Returns:
- Boolean.

`is_monotonic`

()¶Return True if, and only if, this Coord is monotonic.

`lazy_bounds`

()¶Return a lazy array representing the coord bounds.

Accessing this method will never cause the bounds values to be loaded. Similarly, calling methods on, or indexing, the returned Array will not cause the coord to have loaded bounds.

If the data have already been loaded for the coord, the returned Array will be a new lazy array wrapper.

- Returns:
- A lazy array representing the coord bounds array or None if the coord does not have bounds.

`lazy_points`

()¶Return a lazy array representing the coord points.

Accessing this method will never cause the points values to be loaded. Similarly, calling methods on, or indexing, the returned Array will not cause the coord to have loaded points.

If the data have already been loaded for the coord, the returned Array will be a new lazy array wrapper.

- Returns:
- A lazy array, representing the coord points array.

`name`

(default='unknown')¶Returns a human-readable name.

First it tries

`standard_name`

, then ‘long_name’, then ‘var_name’ before falling back to the value of default (which itself defaults to ‘unknown’).

`nearest_neighbour_index`

(point)¶Returns the index of the cell nearest to the given point.

Only works for one-dimensional coordinates.

For example:

>>> cube = iris.load_cube(iris.sample_data_path('ostia_monthly.nc')) >>> cube.coord('latitude').nearest_neighbour_index(0) 9 >>> cube.coord('longitude').nearest_neighbour_index(10) 12Note

If the coordinate contains bounds, these will be used to determine the nearest neighbour instead of the point values.

Note

For circular coordinates, the ‘nearest’ point can wrap around to the other end of the values.

`rename`

(name)¶Changes the human-readable name.

If ‘name’ is a valid standard name it will assign it to

`standard_name`

, otherwise it will assign it to`long_name`

.

`xml_element`

(doc)¶Return a DOM element describing this Coord.

`attributes`

¶

`bounds`

¶The coordinate bounds values, as a NumPy array, or None if no bound values are defined.

Note

The shape of the bound array should be:

`points.shape + (n_bounds, )`

.

`bounds_dtype`

¶The NumPy dtype of the coord’s bounds. Will be None if the coord does not have bounds.

`dtype`

¶The NumPy dtype of the coord, as specified by its points.

`nbounds`

¶Return the number of bounds that this coordinate has (0 for no bounds).

`ndim`

¶Return the number of dimensions of the coordinate (not including the bounded dimension).

`points`

¶The coordinate points values as a NumPy array.

`shape`

¶The fundamental shape of the Coord, expressed as a tuple.

`standard_name`

¶The standard name for the Cube’s data.

`units`

¶The

`Unit`

instance of the object.

`var_name`

¶The CF variable name for the object.

An immutable representation of a single cell of a coordinate, including the sample point and/or boundary position.

Notes on cell comparison:

Cells are compared in two ways, depending on whether they are compared to another Cell, or to a number/string.

Cell-Cell comparison is defined to produce a strict ordering. If two cells are not exactly equal (i.e. including whether they both define bounds or not) then they will have a consistent relative order.

Cell-number and Cell-string comparison is defined to support Constraint matching. The number/string will equal the Cell if, and only if, it is within the Cell (including on the boundary). The relative comparisons (lt, le, ..) are defined to be consistent with this interpretation. So for a given value n and Cell cell, only one of the following can be true:

Similarly, n <= cell implies either n < cell or n == cell. And n >= cell implies either n > cell or n == cell.

class`iris.coords.`

`Cell`

(point=None,bound=None)¶Bases:

`iris.coords.Cell`

Construct a Cell from point or point-and-bound information.

`contains_point`

(point)¶For a bounded cell, returns whether the given point lies within the bounds.

Note

The test carried out is equivalent to min(bound) <= point <= max(bound).

`count`

(value) → integer -- return number of occurrences of value¶

`index`

(value[,start[,stop]]) → integer -- return first index of value.¶Raises ValueError if the value is not present.

`bound`

¶Alias for field number 1

`point`

¶Alias for field number 0

A CF Cell Measure, providing area or volume properties of a cell where these cannot be inferred from the Coordinates and Coordinate Reference System.

class`iris.coords.`

`CellMeasure`

(data,standard_name=None,long_name=None,var_name=None,units='1',attributes=None,measure=None)¶Bases:

`iris._cube_coord_common.CFVariableMixin`

Constructs a single cell measure.

Args:

- data:
- The values of the measure for each cell. Either a ‘real’ array (
`numpy.ndarray`

) or a ‘lazy’ array (`dask.array.Array`

).Kwargs:

- standard_name:
- CF standard name of coordinate

- long_name:
- Descriptive name of coordinate

- var_name:
- CF variable name of coordinate

- units
- The
`Unit`

of the coordinate’s values. Can be a string, which will be converted to a Unit object.

- attributes
- A dictionary containing other CF and user-defined attributes.

- measure
- A string describing the type of measure. ‘area’ and ‘volume’ are the only valid entries.

`copy`

(data=None)¶Returns a copy of this CellMeasure.

Kwargs:

- data: A data array for the new cell_measure.
- This may be a different shape to the data of the cell_measure being copied.

`name`

(default='unknown')¶Returns a human-readable name.

First it tries

`standard_name`

, then ‘long_name’, then ‘var_name’ before falling back to the value of default (which itself defaults to ‘unknown’).

`rename`

(name)¶Changes the human-readable name.

If ‘name’ is a valid standard name it will assign it to

`standard_name`

, otherwise it will assign it to`long_name`

.

`attributes`

¶Other attributes, including user specified attributes that have no meaning to Iris.

`data`

¶Property containing the data values as a numpy array

`long_name`

= None¶Descriptive name of the coordinate.

`measure`

¶String naming the measure type.

`ndim`

¶Returns the number of dimensions of the cell measure.

`shape`

¶Returns the shape of the Cell Measure, expressed as a tuple.

`standard_name`

¶CF standard name of the quantity that the coordinate represents.

`units`

¶Unit of the quantity that the coordinate represents.

`var_name`

¶The CF variable name for the coordinate.

Represents a sub-cell pre-processing operation.

class`iris.coords.`

`CellMethod`

(method,coords=None,intervals=None,comments=None)¶Bases:

`iris.util._OrderedHashable`

Args:

- method:
- The name of the operation.
Kwargs:

- coords:
- A single instance or sequence of
`Coord`

instances or coordinate names.

- intervals:
- A single string, or a sequence strings, describing the intervals within the cell method.

- comments:
- A single string, or a sequence strings, containing any additional comments.

`xml_element`

(doc)¶Return a dom element describing itself

`comments`

= None¶Additional comments.

`coord_names`

= None¶The tuple of coordinate names over which the operation was applied.

`intervals`

= None¶A description of the original intervals over which the operation was applied.

`method`

= None¶The name of the operation that was applied. e.g. “mean”, “max”, etc.

Abstract superclass for coordinates.

class`iris.coords.`

`Coord`

(points,standard_name=None,long_name=None,var_name=None,units='1',bounds=None,attributes=None,coord_system=None)¶Bases:

`iris._cube_coord_common.CFVariableMixin`

Constructs a single coordinate.

Args:

- points:
- The values (or value in the case of a scalar coordinate) of the coordinate for each cell.
Kwargs:

- standard_name:
- CF standard name of coordinate

- long_name:
- Descriptive name of coordinate

- var_name:
- CF variable name of coordinate

- units
- The
`Unit`

of the coordinate’s values. Can be a string, which will be converted to a Unit object.

- bounds
- An array of values describing the bounds of each cell. Given n bounds for each cell, the shape of the bounds array should be points.shape + (n,). For example, a 1d coordinate with 100 points and two bounds per cell would have a bounds array of shape (100, 2)

- attributes
- A dictionary containing other cf and user-defined attributes.

- coord_system
- A
`CoordSystem`

representing the coordinate system of the coordinate, e.g. a`GeogCS`

for a longitude Coord.

`cell`

(index)¶Return the single

`Cell`

instance which results from slicing the points/bounds with the given index.Note

If iris.FUTURE.cell_datetime_objects is True, then this method will return Cell objects whose points and bounds attributes contain either datetime.datetime instances or netcdftime.datetime instances (depending on the calendar).

Deprecated since version 2.0.0: The option iris.FUTURE.cell_datetime_objects is deprecated and will be removed in a future release; it is now set to True by default. Please update your code to support using cells as datetime objects.

`cells`

()¶Returns an iterable of Cell instances for this Coord.

For example:

for cell in self.cells(): ...

`collapsed`

(dims_to_collapse=None)¶Returns a copy of this coordinate, which has been collapsed along the specified dimensions.

Replaces the points & bounds with a simple bounded region.

Note

You cannot partially collapse a multi-dimensional coordinate. See cube.collapsed for more information.

`contiguous_bounds`

()¶Returns the N+1 bound values for a contiguous bounded coordinate of length N.

Note

If the coordinate is does not have bounds, this method will return bounds positioned halfway between the coordinate’s points.

`convert_units`

(unit)¶Change the coordinate’s units, converting the values in its points and bounds arrays.

For example, if a coordinate’s

`units`

attribute is set to radians then:coord.convert_units('degrees')will change the coordinate’s

`units`

attribute to degrees and multiply each value in`points`

and`bounds`

by 180.0/.

`copy`

(points=None,bounds=None)¶Returns a copy of this coordinate.

Kwargs:

- points: A points array for the new coordinate.
- This may be a different shape to the points of the coordinate being copied.

- bounds: A bounds array for the new coordinate.
- Given n bounds for each cell, the shape of the bounds array should be points.shape + (n,). For example, a 1d coordinate with 100 points and two bounds per cell would have a bounds array of shape (100, 2).
Note

If the points argument is specified and bounds are not, the resulting coordinate will have no bounds.

`core_bounds`

()¶The points array at the core of this coord, which may be a NumPy array or a dask array.

`core_points`

()¶The points array at the core of this coord, which may be a NumPy array or a dask array.

classmethod`from_coord`

(coord)¶Create a new Coord of this type, from the given coordinate.

`guess_bounds`

(bound_position=0.5)¶Add contiguous bounds to a coordinate, calculated from its points.

Puts a cell boundary at the specified fraction between each point and the next, plus extrapolated lowermost and uppermost bound points, so that each point lies within a cell.

With regularly spaced points, the resulting bounds will also be regular, and all points lie at the same position within their cell. With irregular points, the first and last cells are given the same widths as the ones next to them.

Kwargs:

- bound_position:
- The desired position of the bounds relative to the position of the points.
Note

An error is raised if the coordinate already has bounds, is not one-dimensional, or is not monotonic.

Note

Unevenly spaced values, such from a wrapped longitude range, can produce unexpected results : In such cases you should assign suitable values directly to the bounds property, instead.

Note

If iris.FUTURE.clip_latitudes is True, then this method will clip the coordinate bounds to the range [-90, 90] when:

- it is a latitude or grid_latitude coordinate,
- the units are degrees,
- all the points are in the range [-90, 90].
Deprecated since version 2.0.0: The iris.FUTURE.clip_latitudes option is now deprecated and is set to True by default. Please remove code which relies on coordinate bounds being outside the range [-90, 90].

`has_bounds`

()¶Return a boolean indicating whether the coord has a bounds array.

`has_lazy_bounds`

()¶Return a boolean indicating whether the coord’s bounds array is a lazy dask array or not.

`has_lazy_points`

()¶Return a boolean indicating whether the coord’s points array is a lazy dask array or not.

`intersect`

(other,return_indices=False)¶Returns a new coordinate from the intersection of two coordinates.

Both coordinates must be compatible as defined by

`is_compatible()`

.Kwargs:

- return_indices:
- If True, changes the return behaviour to return the intersection indices for the “self” coordinate.

`is_compatible`

(other,ignore=None)¶Return whether the coordinate is compatible with another.

Compatibility is determined by comparing

`iris.coords.Coord.name()`

,`iris.coords.Coord.units`

,`iris.coords.Coord.coord_system`

and`iris.coords.Coord.attributes`

that are present in both objects.Args:

- other:
- An instance of
`iris.coords.Coord`

or`iris.coords.CoordDefn`

.

- ignore:
- A single attribute key or iterable of attribute keys to ignore when comparing the coordinates. Default is None. To ignore all attributes, set this to other.attributes.

- Returns:
- Boolean.

`is_contiguous`

(rtol=1e-05,atol=1e-08)¶Return True if, and only if, this Coord is bounded with contiguous bounds to within the specified relative and absolute tolerances.

Args:

- rtol:
- The relative tolerance parameter (default is 1e-05).

- atol:
- The absolute tolerance parameter (default is 1e-08).

- Returns:
- Boolean.

`is_monotonic`

()¶Return True if, and only if, this Coord is monotonic.

`lazy_bounds`

()¶Return a lazy array representing the coord bounds.

Accessing this method will never cause the bounds values to be loaded. Similarly, calling methods on, or indexing, the returned Array will not cause the coord to have loaded bounds.

If the data have already been loaded for the coord, the returned Array will be a new lazy array wrapper.

- Returns:
- A lazy array representing the coord bounds array or None if the coord does not have bounds.

`lazy_points`

()¶Return a lazy array representing the coord points.

Accessing this method will never cause the points values to be loaded. Similarly, calling methods on, or indexing, the returned Array will not cause the coord to have loaded points.

- Returns:
- A lazy array, representing the coord points array.

`name`

(default='unknown')¶Returns a human-readable name.

First it tries

`standard_name`

, then ‘long_name’, then ‘var_name’ before falling back to the value of default (which itself defaults to ‘unknown’).

`nearest_neighbour_index`

(point)¶Returns the index of the cell nearest to the given point.

Only works for one-dimensional coordinates.

For example:

>>> cube = iris.load_cube(iris.sample_data_path('ostia_monthly.nc')) >>> cube.coord('latitude').nearest_neighbour_index(0) 9 >>> cube.coord('longitude').nearest_neighbour_index(10) 12Note

If the coordinate contains bounds, these will be used to determine the nearest neighbour instead of the point values.

Note

For circular coordinates, the ‘nearest’ point can wrap around to the other end of the values.

`rename`

(name)¶Changes the human-readable name.

If ‘name’ is a valid standard name it will assign it to

`standard_name`

, otherwise it will assign it to`long_name`

.

`xml_element`

(doc)¶Return a DOM element describing this Coord.

`attributes`

¶Other attributes, including user specified attributes that have no meaning to Iris.

`bounds`

¶The coordinate bounds values, as a NumPy array, or None if no bound values are defined.

Note

The shape of the bound array should be:

`points.shape + (n_bounds, )`

.

`bounds_dtype`

¶The NumPy dtype of the coord’s bounds. Will be None if the coord does not have bounds.

`coord_system`

= None¶Relevant coordinate system (if any).

`dtype`

¶The NumPy dtype of the coord, as specified by its points.

`long_name`

= None¶Descriptive name of the coordinate.

`nbounds`

¶Return the number of bounds that this coordinate has (0 for no bounds).

`ndim`

¶Return the number of dimensions of the coordinate (not including the bounded dimension).

`points`

¶The coordinate points values as a NumPy array.

`shape`

¶The fundamental shape of the Coord, expressed as a tuple.

`standard_name`

¶CF standard name of the quantity that the coordinate represents.

`units`

¶Unit of the quantity that the coordinate represents.

`var_name`

¶The CF variable name for the coordinate.

Criterion for identifying a specific type of `DimCoord`

or
`AuxCoord`

based on its metadata.

class`iris.coords.`

`CoordDefn`

(_cls,standard_name,long_name,var_name,units,attributes,coord_system)¶Bases:

`iris.coords.CoordDefn`

Create new instance of CoordDefn(standard_name, long_name, var_name, units, attributes, coord_system)

`count`

(value) → integer -- return number of occurrences of value¶

`index`

(value[,start[,stop]]) → integer -- return first index of value.¶Raises ValueError if the value is not present.

`name`

(default='unknown')¶Returns a human-readable name.

First it tries self.standard_name, then it tries the ‘long_name’ attribute, then the ‘var_name’ attribute, before falling back to the value of default (which itself defaults to ‘unknown’).

`attributes`

¶Alias for field number 4

`coord_system`

¶Alias for field number 5

`long_name`

¶Alias for field number 1

`standard_name`

¶Alias for field number 0

`units`

¶Alias for field number 3

`var_name`

¶Alias for field number 2

Defines a range of values for a coordinate.

class`iris.coords.`

`CoordExtent`

(name_or_coord,minimum,maximum,min_inclusive=True,max_inclusive=True)¶Bases:

`iris.coords._CoordExtent`

Create a CoordExtent for the specified coordinate and range of values.

Args:

- name_or_coord
- Either a coordinate name or a coordinate, as defined in
`iris.cube.Cube.coords()`

.

- minimum
- The minimum value of the range to select.

- maximum
- The maximum value of the range to select.
Kwargs:

- min_inclusive
- If True, coordinate values equal to minimum will be included in the selection. Default is True.

- max_inclusive
- If True, coordinate values equal to maximum will be included in the selection. Default is True.

`count`

(value) → integer -- return number of occurrences of value¶

`index`

(value[,start[,stop]]) → integer -- return first index of value.¶Raises ValueError if the value is not present.

`max_inclusive`

¶Alias for field number 4

`maximum`

¶Alias for field number 2

`min_inclusive`

¶Alias for field number 3

`minimum`

¶Alias for field number 1

`name_or_coord`

¶Alias for field number 0

A coordinate that is 1D, numeric, and strictly monotonic.

class`iris.coords.`

`DimCoord`

(points,standard_name=None,long_name=None,var_name=None,units='1',bounds=None,attributes=None,coord_system=None,circular=False)¶Bases:

`iris.coords.Coord`

Create a 1D, numeric, and strictly monotonic

`Coord`

with read-only points and bounds.

`cell`

(index)¶Return the single

`Cell`

instance which results from slicing the points/bounds with the given index.Note

If iris.FUTURE.cell_datetime_objects is True, then this method will return Cell objects whose points and bounds attributes contain either datetime.datetime instances or netcdftime.datetime instances (depending on the calendar).

Deprecated since version 2.0.0: The option iris.FUTURE.cell_datetime_objects is deprecated and will be removed in a future release; it is now set to True by default. Please update your code to support using cells as datetime objects.

`cells`

()¶Returns an iterable of Cell instances for this Coord.

For example:

for cell in self.cells(): ...

`collapsed`

(dims_to_collapse=None)¶Returns a copy of this coordinate, which has been collapsed along the specified dimensions.

Replaces the points & bounds with a simple bounded region.

Note

You cannot partially collapse a multi-dimensional coordinate. See cube.collapsed for more information.

`contiguous_bounds`

()¶Returns the N+1 bound values for a contiguous bounded coordinate of length N.

Note

If the coordinate is does not have bounds, this method will return bounds positioned halfway between the coordinate’s points.

`convert_units`

(unit)¶Change the coordinate’s units, converting the values in its points and bounds arrays.

For example, if a coordinate’s

`units`

attribute is set to radians then:coord.convert_units('degrees')will change the coordinate’s

`units`

attribute to degrees and multiply each value in`points`

and`bounds`

by 180.0/.

`copy`

(points=None,bounds=None)¶Returns a copy of this coordinate.

Kwargs:

- points: A points array for the new coordinate.
- This may be a different shape to the points of the coordinate being copied.

- bounds: A bounds array for the new coordinate.
- Given n bounds for each cell, the shape of the bounds array should be points.shape + (n,). For example, a 1d coordinate with 100 points and two bounds per cell would have a bounds array of shape (100, 2).
Note

If the points argument is specified and bounds are not, the resulting coordinate will have no bounds.

`core_bounds`

()¶The points array at the core of this coord, which may be a NumPy array or a dask array.

`core_points`

()¶The points array at the core of this coord, which may be a NumPy array or a dask array.

classmethod`from_coord`

(coord)¶Create a new Coord of this type, from the given coordinate.

classmethod`from_regular`

(zeroth,step,count,standard_name=None,long_name=None,var_name=None,units='1',attributes=None,coord_system=None,circular=False,with_bounds=False)¶Create a

`DimCoord`

with regularly spaced points, and optionally bounds.The majority of the arguments are defined as for

`Coord.__init__()`

, but those which differ are defined below.Args:

- zeroth:
- The value
priorto the first point value.

- step:
- The numeric difference between successive point values.

- count:
- The number of point values.
Kwargs:

- with_bounds:
- If True, the resulting DimCoord will possess bound values which are equally spaced around the points. Otherwise no bounds values will be defined. Defaults to False.

`guess_bounds`

(bound_position=0.5)¶Add contiguous bounds to a coordinate, calculated from its points.

Puts a cell boundary at the specified fraction between each point and the next, plus extrapolated lowermost and uppermost bound points, so that each point lies within a cell.

With regularly spaced points, the resulting bounds will also be regular, and all points lie at the same position within their cell. With irregular points, the first and last cells are given the same widths as the ones next to them.

Kwargs:

- bound_position:
- The desired position of the bounds relative to the position of the points.
Note

An error is raised if the coordinate already has bounds, is not one-dimensional, or is not monotonic.

Note

Unevenly spaced values, such from a wrapped longitude range, can produce unexpected results : In such cases you should assign suitable values directly to the bounds property, instead.

Note

If iris.FUTURE.clip_latitudes is True, then this method will clip the coordinate bounds to the range [-90, 90] when:

- it is a latitude or grid_latitude coordinate,
- the units are degrees,
- all the points are in the range [-90, 90].
Deprecated since version 2.0.0: The iris.FUTURE.clip_latitudes option is now deprecated and is set to True by default. Please remove code which relies on coordinate bounds being outside the range [-90, 90].

`has_bounds`

()¶Return a boolean indicating whether the coord has a bounds array.

`has_lazy_bounds`

()¶Return a boolean indicating whether the coord’s bounds array is a lazy dask array or not.

`has_lazy_points`

()¶Return a boolean indicating whether the coord’s points array is a lazy dask array or not.

`intersect`

(other,return_indices=False)¶Returns a new coordinate from the intersection of two coordinates.

Both coordinates must be compatible as defined by

`is_compatible()`

.Kwargs:

- return_indices:
- If True, changes the return behaviour to return the intersection indices for the “self” coordinate.

`is_compatible`

(other,ignore=None)¶Return whether the coordinate is compatible with another.

Compatibility is determined by comparing

`iris.coords.Coord.name()`

,`iris.coords.Coord.units`

,`iris.coords.Coord.coord_system`

and`iris.coords.Coord.attributes`

that are present in both objects.Args:

- other:
- An instance of
`iris.coords.Coord`

or`iris.coords.CoordDefn`

.

- ignore:
- A single attribute key or iterable of attribute keys to ignore when comparing the coordinates. Default is None. To ignore all attributes, set this to other.attributes.

- Returns:
- Boolean.

`is_contiguous`

(rtol=1e-05,atol=1e-08)¶Return True if, and only if, this Coord is bounded with contiguous bounds to within the specified relative and absolute tolerances.

Args:

- rtol:
- The relative tolerance parameter (default is 1e-05).

- atol:
- The absolute tolerance parameter (default is 1e-08).

- Returns:
- Boolean.

`is_monotonic`

()¶Return True if, and only if, this Coord is monotonic.

`lazy_bounds`

()¶Return a lazy array representing the coord bounds.

Accessing this method will never cause the bounds values to be loaded. Similarly, calling methods on, or indexing, the returned Array will not cause the coord to have loaded bounds.

- Returns:
- A lazy array representing the coord bounds array or None if the coord does not have bounds.

`lazy_points`

()¶Return a lazy array representing the coord points.

Accessing this method will never cause the points values to be loaded. Similarly, calling methods on, or indexing, the returned Array will not cause the coord to have loaded points.

- Returns:
- A lazy array, representing the coord points array.

`name`

(default='unknown')¶Returns a human-readable name.

`standard_name`

, then ‘long_name’, then ‘var_name’ before falling back to the value of default (which itself defaults to ‘unknown’).

`nearest_neighbour_index`

(point)¶Returns the index of the cell nearest to the given point.

Only works for one-dimensional coordinates.

For example:

>>> cube = iris.load_cube(iris.sample_data_path('ostia_monthly.nc')) >>> cube.coord('latitude').nearest_neighbour_index(0) 9 >>> cube.coord('longitude').nearest_neighbour_index(10) 12Note

If the coordinate contains bounds, these will be used to determine the nearest neighbour instead of the point values.

Note

For circular coordinates, the ‘nearest’ point can wrap around to the other end of the values.

`rename`

(name)¶Changes the human-readable name.

`standard_name`

, otherwise it will assign it to`long_name`

.

`xml_element`

(doc)¶Return DOM element describing this

`iris.coords.DimCoord`

.

`attributes`

¶

`bounds`

¶The coordinate bounds values, as a NumPy array, or None if no bound values are defined.

Note

The shape of the bound array should be:

`points.shape + (n_bounds, )`

.

`bounds_dtype`

¶The NumPy dtype of the coord’s bounds. Will be None if the coord does not have bounds.

`circular`

= None¶Whether the coordinate wraps by

`coord.units.modulus`

.

`dtype`

¶The NumPy dtype of the coord, as specified by its points.

`nbounds`

¶Return the number of bounds that this coordinate has (0 for no bounds).

`ndim`

¶Return the number of dimensions of the coordinate (not including the bounded dimension).

`points`

¶The coordinate points values as a NumPy array.

`shape`

¶The fundamental shape of the Coord, expressed as a tuple.

`standard_name`

¶The standard name for the Cube’s data.

`units`

¶The

`Unit`

instance of the object.

`var_name`

¶The CF variable name for the object.