iris.experimental.ugrid.load

Extensions to Iris’ NetCDF loading to allow the construction of Meshes from UGRID data in the file.

Eventual destination: iris.fileformats.netcdf (plan to split that module into load and save in future).

In this module:

iris.experimental.ugrid.load.PARSE_UGRID_ON_LOAD

Run-time switch for experimental UGRID-aware NetCDF loading. See ParseUGridOnLoad.

↑ top ↑

iris.experimental.ugrid.load.load_mesh(uris, var_name=None)[source]

Load a single Mesh object from one or more NetCDF files.

Raises an error if more/less than one Mesh is found.

Parameters
  • uris (str or iterable of str) –

    One or more filenames/URI’s. Filenames can include wildcards. Any URI’s

    must support OpenDAP.

  • var_name (str, optional) –

    Only return a Mesh if its

    var_name matches this value.

Return type

iris.experimental.ugrid.mesh.Mesh

↑ top ↑

iris.experimental.ugrid.load.load_meshes(uris, var_name=None)[source]

Load Mesh objects from one or more NetCDF files.

Parameters
  • uris (str or iterable of str) –

    One or more filenames/URI’s. Filenames can include wildcards. Any URI’s

    must support OpenDAP.

  • var_name (str, optional) –

    Only return Meshes that have

    var_names matching this value.

Returns

A dictionary mapping each mesh-containing file path/URL in the input

uris to a list of the Meshes returned from each.

Return type

dict

↑ top ↑

Thread-local data

class iris.experimental.ugrid.load.ParseUGridOnLoad[source]

A flag for dictating whether to use the experimental UGRID-aware version of Iris NetCDF loading. Object is thread-safe.

Use via the run-time switch PARSE_UGRID_ON_LOAD. Use context() to temporarily activate.

context()[source]

Temporarily activate experimental UGRID-aware NetCDF loading.

Use the standard Iris loading API while within the context manager. If the loaded file(s) include any UGRID content, this will be parsed and attached to the resultant cube(s) accordingly.

Use via the run-time switch PARSE_UGRID_ON_LOAD.

For example:

with PARSE_UGRID_ON_LOAD.context():
    my_cube_list = iris.load([my_file_path, my_file_path2],
                             constraint=my_constraint,
                             callback=my_callback)