xoa.coords

xoa.coords#

Utilities for working with coordinates and dimensions.

This module provides functions to identify, retrieve and manipulate coordinates (longitude, latitude, depth, time, etc.) and dimensions from xarray data arrays and datasets, based on the xoa.meta metadata specifications.

Functions

change_index(da, dim, values)

Change the values of a dataset or data array index

drop_dim_coords(da, dim)

Drop all coordinates that depend on a given dimension

ensure_ns_datetime(da)

Convert datetime coordinates to nanosecond precision

geo_stack(obj[, stack_dim, rename, drop, ...])

Stack the dimensions of longitude and latitude coordinates

get_altitude(da[, errors])

Get the altitude coordinate

get_binding_data_vars(ds, coord[, as_names])

Get the data_vars that have a given coordinate

get_cf_coords(*args, **kwargs)

get_cf_dims(*args, **kwargs)

get_coords_compat_with_dims(da[, ...])

Return the coordinates that are compatible with dims

get_depth(da[, errors])

Get or compute the depth coordinate

get_dim_types(da[, unknown, asdict])

Get dimension types

get_fdim(da[, errors])

Get the dimension of F type

get_lat(da[, errors])

Get the latitude coordinate

get_level(da[, errors])

Get the level coordinate

get_lon(da[, errors])

Get the longitude coordinate

get_meta_coords(da, coord_names[, errors])

Get several coordinates at once

get_meta_dims(da, meta_args[, ...])

Get the data array dimensions names from their type

get_order(da)

Get the dimension order as a string like "tzy-x"

get_positive_attr(da[, zdim])

Get the positive attribute of a dataset or data array

get_tdim(da[, errors])

Get the dimension of T type

get_time(da[, errors])

Get the time coordinate

get_vertical(da[, errors])

Get either depth or altitude

get_xdim(da[, errors])

Get the dimension of X type

get_ydim(da[, errors])

Get the dimension of Y type

get_zdim(da[, errors])

Get the dimension of Z type

is_altitude(da[, loc])

Tell if a data array is identified as altitudes

is_depth(da[, loc])

Tell if a data array is identified as depths

is_lat(da[, loc])

Tell if a data array is identified as latitudes

is_level(da[, loc])

Tell if a data array is identified as levels

is_lon(da[, loc])

Tell if a data array is identified as longitudes

is_time(da)

Tell if a data array is identified as time

reorder(da, order)

Transpose an array to match a given order

transpose(da, dims[, mode])

Transpose an array

Classes

positive_attr(*values)

Allowed value for the positive attribute argument

transpose_modes(*values)

Supported transpose() modes