# iris.experimental.stratify¶

Routines for putting data on new strata (aka. isosurfaces), often in the Z direction.

In this module:

iris.experimental.stratify.relevel(cube, src_levels, tgt_levels, axis=None, interpolator=None)

Interpolate the cube onto the specified target levels, given the source levels of the cube.

For example, suppose we have two datasets P(i,j,k) and H(i,j,k) and we want P(i,j,H). We call relevel() with cube=P, src_levels=H and tgt_levels being an array of the values of H we would like.

This routine is especially useful for computing isosurfaces of phenomenon that are generally monotonic in the direction of interpolation, such as height/pressure or salinity/depth.

cube : Cube
The phenomenon data to be re-levelled.
src_levels : Cube, Coord or string
Describes the source levels of the cube that will be interpolated over. The src_levels must be in the same system as the tgt_levels. The dimensions of src_levels must be broadcastable to the dimensions of the cube. Note that, the coordinate name containing the source levels in the cube may be provided.
tgt_levels : array-like
Describes the target levels of the cube to be interpolated to. The tgt_levels must be in the same system as the src_levels. The dimensions of the tgt_levels must be broadcastable to the dimensions of the cube, except in the nominated axis of interpolation.
axis : int, Coord or string
The axis of interpolation. Defaults to the first dimension of the cube, which is typically the z-dimension. Note that, the coordinate name specifying the z-dimension of the cube may be provided.
interpolator : callable or None

The interpolator to use when computing the interpolation. The function will be passed the following positional arguments:

(tgt-data, src-data, cube-data, axis-of-interpolation)


If the interpolator is None, stratify.interpolate() will be used with linear interpolation and NaN extrapolation.

An example of constructing an alternative interpolation scheme:

from functools import partial
interpolator = partial(stratify.interpolate,
interpolation=stratify.INTERPOLATE_NEAREST,
extrapolation=stratify.EXTRAPOLATE_LINEAR)
{"ft_lang_label":"__label__en","ft_lang_prob":0.7052546,"math_prob":0.8782483,"size":2164,"snap":"2019-13-2019-22","text_gpt3_token_len":480,"char_repetition_ratio":0.1875,"word_repetition_ratio":0.07717042,"special_character_ratio":0.20286506,"punctuation_ratio":0.16080402,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9839074,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-03-20T09:13:38Z\",\"WARC-Record-ID\":\"<urn:uuid:c65728ae-0bb7-4362-95c0-bc89658aec7f>\",\"Content-Length\":\"13963\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:fbdb1197-0bad-40e0-b125-c5fcbb740922>\",\"WARC-Concurrent-To\":\"<urn:uuid:9d513430-2e50-4ecf-a10b-f2644c83af01>\",\"WARC-IP-Address\":\"185.199.110.153\",\"WARC-Target-URI\":\"https://scitools.org.uk/iris/docs/latest/iris/iris/experimental/stratify.html\",\"WARC-Payload-Digest\":\"sha1:MMX3CRDNIU4YOIJG7UGKUTXTYA5BKHRW\",\"WARC-Block-Digest\":\"sha1:UP6EUSEV7BUKS35IPAYN5CNGDSHXRGYZ\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-13/CC-MAIN-2019-13_segments_1552912202324.5_warc_CC-MAIN-20190320085116-20190320111116-00535.warc.gz\"}"}