podpac.coordinates.UniformCoordinates1d

class podpac.coordinates.UniformCoordinates1d(start, stop, step=None, size=None, name=None, ctype=None, segment_lengths=None)[source]

Bases: podpac.core.coordinates.coordinates1d.Coordinates1d

1-dimensional array of uniformly-spaced coordinates defined by a start, stop, and step.

UniformCoordinates1d efficiently stores a uniformly-spaced coordinate array; the full coordinates array is only calculated when needed. For numerical coordinates, the start, stop, and step are converted to float. For time coordinates, the start and stop are converted to numpy datetime64, and the step is converted to numpy timedelta64. For convenience, podpac automatically converts datetime strings such as '2018-01-01' to datetime64 and timedelta strings such as '1,D' to timedelta64.

UniformCoordinates1d can also be created by specifying the size instead of the step.

Parameters
  • start (float or datetime64) – Start coordinate.

  • stop (float or datetime64) – Stop coordinate.

  • step (float or timedelta64) – Signed, non-zero step between coordinates.

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

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

  • ctype (str) – Coordinates type, one of’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 uniformly-spaced 1d Coordinates from a coordinates definition.

Methods

__init__(start, stop[, step, size, name, …])

Create uniformly-spaced 1d coordinates from a start, stop, and step or size.

copy()

Make a deep copy of the uniform 1d Coordinates.

from_tuple(items, **kwargs)

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

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.

start

Start coordinate.

step

Signed, non-zero step between coordinates.

stop

Stop coordinate.

udims

Members

__init__(start, stop, step=None, size=None, name=None, ctype=None, segment_lengths=None)[source]

Create uniformly-spaced 1d coordinates from a start, stop, and step or size.

Parameters
  • start (float or datetime64) – Start coordinate.

  • stop (float or datetime64) – Stop coordinate.

  • step (float or timedelta64) – Signed, nonzero step between coordinates (either step or size required).

  • size (int) – Number of coordinates (either step or size required).

  • 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, float, timedelta, optional) – When ctype is a segment type, the segment lengths for the coordinates. By defaul, the segment_lengths are equal the step.

property argbounds
property bounds

Low and high coordinate bounds.

property coordinates

Coordinate values.

Type

array, read-only

copy()[source]

Make a deep copy of the uniform 1d Coordinates.

Returns

Copy of the coordinates.

Return type

UniformCoordinates1d

property dtype

Coordinates dtype.

float for numerical coordinates and numpy datetime64 for datetime coordinates.

Type

type

classmethod from_definition(d)[source]

Create uniformly-spaced 1d Coordinates from a coordinates definition.

The definition must contain the coordinate start, stop, and step or size:

c = UniformCoordinates1d.from_definition({
    "start": 1,
    "stop": 10,
    "step": 0.5
})

c = UniformCoordinates1d.from_definition({
    "start": 1,
    "stop": 10,
    "size": 21
})

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

c = UniformCoordinates1d.from_definition({
    "start": 1,
    "stop": 10,
    "step": 0.5,
    "name": "lat",
    "ctype": "points"
})
Parameters

d (dict) – uniform 1d coordinates definition

Returns

uniformly-spaced 1d Coordinates

Return type

UniformCoordinates1d

See also

definition()

classmethod from_tuple(items, **kwargs)[source]
property is_descending
property is_monotonic
property is_uniform
property size

Number of coordinates.

start

Start coordinate.

Type

float, datetime64

step

Signed, non-zero step between coordinates.

Type

float, timedelta64

stop

Stop coordinate.

Type

float, datetime64