ants.fileformats package#

The ants package provides access to the fileformats commonly used in ancillary generation. These include those supported by iris and additional formats such as grid namelists and raster files.

ants.fileformats.load(*args, **kwargs)[source]#

Deprecated since version 2.1: Use ants.io.load.load() instead.

ants.fileformats.load_cube(*args, **kwargs)[source]#

Deprecated since version 2.1: Use ants.io.load.load_cube() instead.

ants.fileformats.load_cubes(*args, **kwargs)[source]#

Deprecated since version 2.1: Use ants.io.load.load_cubes() instead.

ants.fileformats.load_grid(filenames, *args, **kwargs)[source]#

Deprecated since version 2.1: Use ants.io.load.load_grid() instead.

ants.fileformats.load_landsea_mask(filename, land_threshold=None)[source]#

Deprecated since version 2.1: Use ants.io.load.load_landsea_mask() instead.

ants.fileformats.load_raw(*args, **kwargs)[source]#

Deprecated since version 2.1: Use ants.io.load.load_raw() instead.

Subpackages#

Submodules#

ants.fileformats.json module#

class ants.fileformats.json.JSONLoader(keys=None, dtypes=None, case_sensitive=False)[source]#

Bases: object

JSON loader

__init__(keys=None, dtypes=None, case_sensitive=False)[source]#

JSON loader that handles validity checks, case handling.

Parameters:
  • keys (str, optional) – The key name(s) to read from the JSON. When not provided, all keys are returned from the file.

  • dtypes (str, optional) – These dtypes correspond to the return numpy dtype of the values extracted from the json. See numpy.dtype. If not provided, values extracted from the json are returned as-is.

  • case_sensitive (bool, optional) – Determine whether the keys provided should be a case sensitive match with that in the file or not.

load(filename)[source]#

Load the provided JSON and return a dictionary.

Parameters:

filename (str) – Filepath for the JSON file.

Returns:

Dictionary representing the requested keys from the JSON.

Return type:

dict

ants.fileformats.json.load(filename, **kwargs)[source]#

JSON loader

Parameters:

**kwargs – See JSONLoader

Returns:

Dictionary representing the requested keys from the JSON.

Return type:

dict

ants.fileformats.raster module#

Module for importing raster data to Iris cubes using the GDAL library.

See GDAL - Geospatial Data Abstraction Library for more information.

ants.fileformats.raster.load_cubes(filenames, callback=None)[source]#

Imports raster images using gdal and constructs a cube.

Parameters:
Returns:

cube – A 2D regularly gridded cube. The resulting cube has regular, contiguous bounds.

Return type:

iris.cube.Cube

Note

Unsigned integers are loaded as signed integers.