xoa.grid

xoa.grid#

This module provides 1d to nD grid utilities to get information or perform operations on a grid.

For operations between different grids, please see xoa.regrid.

Functions

apply_along_dim(ds, dim, func[, coord_func, ...])

Apply an operator on data array or dataset dimensions

decode_cf_dz2depth(*args, **kwargs)

decode_dz2depth(ds[, errors])

Compute depth from layer thickness in a dataset

decode_dz2z(ds[, errors])

Compute z from layer thickness in a dataset

diff(da, dim)

Compute the difference between consecutive grid points

ds2grid_dict(obj[, mask, lon_name, ...])

Convert a data array or dataset to a horizontal grid dictionary

dz2depth(dz[, positive, zdim, ref, ...])

Integrate layer thicknesses to compute depths

dz2z(dz[, positive, zdim, top, bottom, centered])

Integrate layer thicknesses to compute z, which is positive up

get_centers(da, dim)

Interpolate the data array at mid grid points along the dim dimension(s)

get_dx_dy(obj[, radius])

Compute the horizontal grid resolution at the grid points

get_dz(obj[, errors])

Get or compute the layer thicknesses

get_dz_terms(ds[, errors])

Search a dataset for the layer thicknesses and what is needed to integrate them

get_edge_extents(obj[, edges, n_cells])

Get the geographic extent of the strips along the edges of a grid

get_edges(da, dim[, mode])

Interpolate and extrapolate a data array at grid edges along the dim dimension(s)

get_fingerprint(obj[, mask])

Get the fingerprint of a horizontal grid

get_lonlat_2d(obj)

Get 2D longitudes and latitudes with (y, x) dimensions

get_median_resolution(obj)

Compute the median horizontal grid resolution in degrees

get_resolution(obj[, radius])

Compute the horizontal grid resolution along x and y

gradient(da, dim[, coord])

Derivative along a dimension with respect to a coordinate, at the grid centers

map_along_dim(func, da, dim, *coords[, ...])

Apply a function along a dimension that is kept in place

pad(da, pad_width[, mode, coord_mode, ...])

Pad data and coordinates along dimensions

shift(da, shift_dirs[, mode])

Shift the grid by an half grid cell along specified dimensions and directions

to_rect(da[, tol, errors])

Convert the curvilinear coordinates of array/dataset to rectangular axis coordinates

vintegrate(da[, zmin, zmax, dz, zdim])

Integrate along the vertical, accounting for the layer thicknesses

vmean(da[, zmin, zmax, dz, zdim])

Average along the vertical, weighted by the layer thicknesses

z2dz(z[, zdim, top, bottom])

Compute layer thicknesses from the z or depth of the layers

Classes

dz2depth_ref_types(*values)

Integration ref types for dz2depth()

shift_directions(*values)

Shift directions for shift()