Calculus operations on iris.cube.Cube instances.
See also: NumPy.
In this module:
Given a cube calculate the difference between each value in the given coord’s direction.
either a Coord instance or the unique name of a coordinate in the cube. If a Coord instance is provided, it does not necessarily have to exist in the cube.
change_in_temperature_wrt_pressure = cube_delta(temperature_cube, 'pressure')
Missing data support not yet implemented.
Calculate the differential of a given cube with respect to the coord_to_differentiate.
Either a Coord instance or the unique name of a coordinate which exists in the cube. If a Coord instance is provided, it does not necessarily have to exist on the cube.
u_wind_acceleration = differentiate(u_wind_cube, 'forecast_time')
The algorithm used is equivalent to:
Where d is the differential, v is the data value, c is the coordinate value and i is the index in the differential direction. Hence, in a normal situation if a cube has a shape (x: n; y: m) differentiating with respect to x will result in a cube of shape (x: n-1; y: m) and differentiating with respect to y will result in (x: n; y: m-1). If the coordinate to differentiate is circular then the resultant shape will be the same as the input cube.
In the returned cube the coord_to_differentiate object is redefined such that the output coordinate values are set to the averages of the original coordinate values (i.e. the mid-points). Similarly, the output lower bounds values are set to the averages of the original lower bounds values and the output upper bounds values are set to the averages of the original upper bounds values. In more formal terms:
where c and b represent the input coordinate values and bounds, and C and B the output coordinate values and bounds.
Difference method used is the same as cube_delta()
and therefore has the same limitations.
Spherical differentiation does not occur in this routine.
Calculate the 2-dimensional or 3-dimensional spherical or cartesian curl of the given vector of cubes.
As well as the standard x and y coordinates, this function requires each cube to possess a vertical or z-like coordinate (representing some form of height or pressure). This can be a scalar or dimension coordinate.
The i cube of the vector to operate on
The j cube of the vector to operate on
The k cube of the vector to operate on
This argument is not used.
Deprecated since version 0.8: The coordinates to ignore are determined automatically.
Return (i_cmpt_curl_cube, j_cmpt_curl_cube, k_cmpt_curl_cube)
If the k-cube is not passed in then the 2-dimensional curl will be calculated, yielding the result: [None, None, k_cube]. If the k-cube is passed in, the 3-dimensional curl will be calculated, returning 3 component cubes.
All cubes passed in must have the same data units, and those units must be spatially-derived (e.g. ‘m/s’ or ‘km/h’).
The calculation of curl is dependent on the type of CoordSystem() in the cube. If the CoordSystem() is either GeogCS or RotatedGeogCS, the spherical curl will be calculated; otherwise the cartesian curl will be calculated:
When cartesian calculus is used, i_cube is the u component, j_cube is the v component and k_cube is the w component.
The Cartesian curl is defined as:
When spherical calculus is used, i_cube is the vector component (e.g. eastward), j_cube is the component (e.g. northward) and k_cube is the radial component.
The spherical curl is defined as:
where phi is longitude, theta is latitude.