You are viewing the latest unreleased documentation v3.2.dev0. You may prefer a stable version.

iris.analysis.trajectory

Defines a Trajectory class, and a routine to extract a sub-cube along a trajectory.

In this module:

iris.analysis.trajectory.interpolate(cube, sample_points, method=None)[source]

Extract a sub-cube at the given n-dimensional points.

Args:

  • cube

    The source Cube.

  • sample_points

    A sequence of coordinate (name) - values pairs.

Kwargs:

  • method

    Request “linear” interpolation (default) or “nearest” neighbour. Only nearest neighbour is available when specifying multi-dimensional coordinates.

For example:

sample_points = [('latitude', [45, 45, 45]),
('longitude', [-60, -50, -40])]
interpolated_cube = interpolate(cube, sample_points)

↑ top ↑

A series of given waypoints with pre-calculated sample points.

class iris.analysis.trajectory.Trajectory(waypoints, sample_count=10)[source]

Defines a trajectory using a sequence of waypoints.

For example:

waypoints = [{'latitude': 45, 'longitude': -60},
             {'latitude': 45, 'longitude': 0}]
Trajectory(waypoints)

Note

All the waypoint dictionaries must contain the same coordinate names.

Args:

  • waypoints

    A sequence of dictionaries, mapping coordinate names to values.

Kwargs:

  • sample_count

    The number of sample positions to use along the trajectory.

interpolate(cube, method=None)[source]

Calls interpolate() to interpolate cube on the defined trajectory.

Assumes that the coordinate names supplied in the waypoints dictionaries match to coordinate names in cube, and that points are supplied in the same coord_system as in cube, where appropriate (i.e. for horizontal coordinate points).

Args:

  • cube

    The source Cube to interpolate.

Kwargs:

  • method:

    The interpolation method to use; “linear” (default) or “nearest”. Only nearest is available when specifying multi-dimensional coordinates.

sampled_points

value}.

Type

The trajectory points, as dictionaries of {coord_name

↑ top ↑

Encapsulate the operation of iris.analysis.trajectory.interpolate() with given source and target grids.

This is the type used by the UnstructuredNearest regridding scheme.

class iris.analysis.trajectory.UnstructuredNearestNeigbourRegridder(src_cube, target_grid_cube)[source]

A nearest-neighbour regridder to perform regridding from the source grid to the target grid.

This can then be applied to any source data with the same structure as the original ‘src_cube’.

Args:

  • src_cube:

    The Cube defining the source grid. The X and Y coordinates can have any shape, but must be mapped over the same cube dimensions.

  • target_grid_cube:

    A Cube, whose X and Y coordinates specify a desired target grid. The X and Y coordinates must be one-dimensional dimension coordinates, mapped to different dimensions. All other cube components are ignored.

Returns

(object)

A callable object with the interface:

result_cube = regridder(data)

where data is a cube with the same grid as the original src_cube, that is to be regridded to the target_grid_cube.

Return type

regridder

Note

For latitude-longitude coordinates, the nearest-neighbour distances are computed on the sphere, otherwise flat Euclidean distances are used.

The source and target X and Y coordinates must all have the same coordinate system, which may also be None. If any X and Y coordinates are latitudes or longitudes, they all must be. Otherwise, the corresponding X and Y coordinates must have the same units in the source and grid cubes.