podpac.coordinates.ArrayCoordinates1d

class podpac.coordinates.ArrayCoordinates1d(coordinates, name=None, ctype=None, segment_lengths=None)[source]

Bases: podpac.core.coordinates.coordinates1d.Coordinates1d

1-dimensional array of coordinates.

ArrayCoordinates1d is a basic array of 1d coordinates created from an array of coordinate values. Numerical coordinates values are converted to float, and time coordinate values are converted to numpy datetime64. For convenience, podpac automatically converts datetime strings such as '2018-01-01' to datetime64. The coordinate values must all be of the same type.

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

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

  • ctype (str) – Coordinates type: ‘point’, ‘left’, ‘right’, or ‘midpoint’.

  • segment_lengths (array, float, timedelta) – When ctype is a segment type, the segment lengths for the coordinates.

Alternative Constructors

from_definition(d)

Create 1d coordinates from a coordinates definition.

from_xarray(x, **kwargs)

Create 1d Coordinates from named xarray coordinates.

Methods

__init__(coordinates[, name, ctype, …])

Create 1d coordinates from an array.

copy()

Make a deep copy of the 1d Coordinates array.

select(bounds[, return_indices, outer])

Get the coordinate values that are within the given bounds.

Attributes

area_bounds

Low and high coordinate area bounds.

argbounds

bounds

Low and high coordinate bounds.

coordinates

User-defined coordinate values

coords

xarray coordinates (container of coordinate arrays)

ctype

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.

segment_lengths

A trait which allows any value.

shape

size

Number of coordinates.

udims

Members

__init__(coordinates, name=None, ctype=None, segment_lengths=None)[source]

Create 1d coordinates from an array.

Parameters
  • coordinates (array-like) – coordinate values.

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

  • ctype (str, optional) – Coordinates type: ‘point’, ‘left’, ‘right’, or ‘midpoint’.

  • segment_lengths (array, optional) – When ctype is a segment type, the segment lengths for the coordinates. The segment_lengths are required for nonmonotonic coordinates. The segment can be inferred from coordinate values for monotonic coordinates.

property argbounds
property bounds

Low and high coordinate bounds.

coordinates

User-defined coordinate values

Type

array

copy()[source]

Make a deep copy of the 1d Coordinates array.

Returns

Copy of the coordinates.

Return type

ArrayCoordinates1d

property dtype

Coordinates dtype.

float for numerical coordinates and numpy datetime64 for datetime coordinates.

Type

type

classmethod from_definition(d)[source]

Create 1d coordinates from a coordinates definition.

The definition must contain the coordinate values:

c = ArrayCoordinates1d.from_definition({
    "values": [0, 1, 2, 3]
})

The definition may also contain any of the 1d Coordinates properties:

c = ArrayCoordinates1d.from_definition({
    "values": [0, 1, 2, 3],
    "name": "lat",
    "ctype": "points"
})
Parameters

d (dict) – 1d coordinates array definition

Returns

1d Coordinates

Return type

ArrayCoordinates1d

See also

definition()

classmethod from_xarray(x, **kwargs)[source]

Create 1d Coordinates from named xarray coordinates.

Parameters
  • x (xarray.DataArray) – Nade DataArray of the coordinate values

  • ctype (str, optional) – Coordinates type: ‘point’, ‘left’, ‘right’, or ‘midpoint’.

  • segment_lengths ((low, high), optional) – When ctype is a segment type, the segment lengths for the coordinates. The segment_lengths are required for nonmonotonic coordinates. The segment can be inferred from coordinate values for monotonic coordinates.

Returns

1d coordinates

Return type

ArrayCoordinates1d

property is_descending
property is_monotonic
property is_uniform
property size

Number of coordinates.