podpac.coordinates.Coordinates1d

class podpac.coordinates.Coordinates1d(*args, **kwargs)[source]

Bases: podpac.core.coordinates.base_coordinates.BaseCoordinates

Base class for 1-dimensional coordinates.

Coordinates1d objects contain values and metadata for a single dimension of coordinates. podpac.Coordinates and StackedCoordinates use Coordinate1d objects.

Parameters
  • name (str) – Dimension name, one of ‘lat’, ‘lon’, ‘time’, or ‘alt’.

  • coordinates (array, read-only) – Full array of coordinate values.

Alternative Constructors

from_definition(d)

Get Coordinates from a coordinates definition.

Methods

__init__(*args, **kwargs)

copy()

Make a deep copy of the 1d Coordinates.

get_area_bounds(boundary)

Get low and high coordinate area bounds.

select(bounds[, return_indices, outer])

Get the coordinate values that are within the given bounds.

simplify()

Get the simplified/optimized representation of these coordinates.

Attributes

bounds

Low and high coordinate bounds.

coordinates

Coordinate values.

coords

xarray coordinates (container of coordinate arrays)

definition

Serializable 1d coordinates definition.

deltatype

dims

dtype

Coordinates dtype.

full_definition

Serializable 1d coordinates definition, containing all properties.

idims

is_descending

is_monotonic

is_uniform

name

properties

Dictionary of the coordinate properties.

shape

size

Number of coordinates.

start

step

stop

udims

Members

__init__(*args, **kwargs)
property bounds

Low and high coordinate bounds.

property coords

xarray coordinates (container of coordinate arrays)

Type

dict-like

copy()[source]

Make a deep copy of the 1d Coordinates.

Returns

Copy of the coordinates.

Return type

Coordinates1d

property definition

Serializable 1d coordinates definition.

Type

dict

property deltatype
property dims
property dtype

Coordinates dtype.

float for numerical coordinates and numpy datetime64 for datetime coordinates.

Type

type

property full_definition

Serializable 1d coordinates definition, containing all properties. For internal use.

Type

dict

get_area_bounds(boundary)[source]

Get low and high coordinate area bounds.

Parameters

boundary (float, timedelta, array, None) –

Boundary offsets in this dimension.

  • For a centered uniform boundary (same for every coordinate), use a single positive float or timedelta

    offset. This represents the “total segment length” / 2.

  • For a uniform boundary (segment or polygon same for every coordinate), use an array of float or

    timedelta offsets

  • For a fully specified boundary, use an array of boundary arrays (2-D array, N_coords x boundary spec),

    one per coordinate. The boundary_spec can be a single number, two numbers, or an array of numbers.

  • For point coordinates, use None.

Returns

  • low (float, np.datetime64) – low area bound

  • high (float, np.datetime64) – high area bound

property idims
property is_descending
property is_monotonic
property is_uniform
name
property properties

Dictionary of the coordinate properties.

Type

dict

select(bounds, return_indices=False, outer=False)[source]

Get the coordinate values that are within the given bounds.

The default selection returns coordinates that are within the bounds:

In [1]: c = ArrayCoordinates1d([0, 1, 2, 3], name='lat')

In [2]: c.select([1.5, 2.5]).coordinates
Out[2]: array([2.])

The outer selection returns the minimal set of coordinates that contain the bounds:

In [3]: c.select([1.5, 2.5], outer=True).coordinates
Out[3]: array([1., 2., 3.])

The outer selection also returns a boundary coordinate if a bound is outside this coordinates bounds but inside its area bounds:

In [4]: c.select([3.25, 3.35], outer=True).coordinates
Out[4]: array([3.0], dtype=float64)

In [5]: c.select([10.0, 11.0], outer=True).coordinates
Out[5]: array([], dtype=float64)
Parameters
  • bounds ((low, high) or dict) – Selection bounds. If a dictionary of dim -> (low, high) bounds is supplied, the bounds matching these coordinates will be selected if available, otherwise the full coordinates will be returned.

  • outer (bool, optional) – If True, do an outer selection. Default False.

  • return_indices (bool, optional) – If True, return slice or indices for the selection in addition to coordinates. Default False.

Returns

  • selection (Coordinates1d) – Coordinates1d object with coordinates within the bounds.

  • I (slice or list) – index or slice for the selected coordinates (only if return_indices=True)

property shape
simplify()[source]

Get the simplified/optimized representation of these coordinates.

Returns

simplified – simplified version of the coordinates

Return type

Coordinates1d

property start
property step
property stop
property udims