Skip to content

Utilities

Coordinate Utilities

A collection of utilities to manipulate and check coordinate systems dictionaries.

utils.coords.handshake_dimSimple check to see if coordinate system has a dimension in a particular index
utils.coords.handshake_coordsSimple check to see if the required dimensions have the same coordinate system
utils.coords.handshake_sizeSimple check to see if a coordinate system of a given dimension is a required size
utils.coords.map_coordsA basic interpolation util to map between coordinate systems with common dimensions.
utils.coords.split_coordsA utility function to split a dimension from a (x,coords) pair and convert it into a list of tensors, a CoordSystem, and the dimension that extract from coords.

Grid Interpolation

utils.interp.LatLonInterpolationBilinear interpolation between arbitrary grids.

Observation Utilities

utils.obs.ObsGridMappingMaps point observations to and from a 2-D model grid.

Time Utilities

utils.time.timearray_to_datetimeSimple converter from numpy datetime64 array into a list of datetimes.
utils.time.to_time_arrayA general converter for various time iterables into a numpy datetime64 array

Checkpoint Classes

utils.checkpoint.CheckpointCatalog of restart checkpoints for a named inference run.
utils.checkpoint.CheckpointSessionActive checkpoint row or new checkpoint session.
utils.checkpoint.CheckpointStateBound checkpoint state proxy returned by `bind_checkpoint_state`.
utils.checkpoint.NullCheckpointNo-op checkpoint used when checkpointing is disabled.

Checkpoint Helpers

utils.checkpoint.bind_checkpoint_stateBind a dataclass instance to checkpoint state metadata.

Data Utilities

data.datasource_to_fileUtility function that can be used for building a local data store needed for an inference request.
data.fetch_dataUtility function to fetch data arrays from particular sources and load data on the target device.
data.prep_data_arrayPrepares a data array from a data source for inference workflows by converting the data array to a torch tensor and the coordinate system to an OrderedDict.

Model Utilities

auto.PackageA generic file system abstraction with local caching, uses Fsspec WholeFileCacheFileSystem to manage files.
batch.batch_funcBatch utility decorator which can be added to prognostic and diagnostic models to help enable support for automatic batching of data.