podpac.coordinates.UniformCoordinates1d¶
-
class
podpac.coordinates.
UniformCoordinates1d
(start, stop, step=None, size=None, name=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 numpydatetime64
, and the step is converted to numpytimedelta64
. For convenience, podpac automatically converts datetime strings such as'2018-01-01'
todatetime64
and timedelta strings such as'1,D'
totimedelta64
.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.
See also
Alternative Constructors
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.
flatten
()Return a copy of the uniform coordinates, for consistency.
from_tuple
(items, **kwargs)get_area_bounds
(boundary)Get low and high coordinate area bounds.
issubset
(other)Report whether other coordinates contains these coordinates.
reshape
(newshape)select
(bounds[, return_index, outer])Get the coordinate values that are within the given bounds.
simplify
()Get the simplified/optimized representation of these coordinates.
trait_defaults
(*names, **metadata)Return a trait’s default value or a dictionary of them
trait_has_value
(name)Returns True if the specified trait has a value.
trait_values
(**metadata)A
dict
of trait names and their values.unique
([return_index])Return the coordinates (uniform coordinates are already unique).
Attributes
Low and high coordinate bounds.
Coordinate values.
definition
Serializable 1d coordinates definition.
deltatype
dims
Coordinates dtype.
full_definition
Serializable 1d coordinates definition, containing all properties.
name
properties
Dictionary of the coordinate properties.
Number of coordinates.
Start coordinate.
Signed, non-zero step between coordinates.
Stop coordinate.
udims
Tuple of unstacked dimension names, for compatibility.
xcoords
xarray coords
xdims
Tuple of indexing dimensions used to create xarray DataArray.
- Members
-
__init__
(start, stop, step=None, size=None, name=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’.
-
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
-
property
dtype
¶ Coordinates dtype.
float
for numerical coordinates and numpydatetime64
for datetime coordinates.- Type
type
-
flatten
()[source]¶ Return a copy of the uniform coordinates, for consistency.
- Returns
Flattened coordinates.
- Return 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" })
- Parameters
d (dict) – uniform 1d coordinates definition
- Returns
uniformly-spaced 1d Coordinates
- Return type
See also
definition()
-
property
is_descending
¶
-
property
is_monotonic
¶
-
property
is_uniform
¶
-
issubset
(other)[source]¶ Report whether other coordinates contains these coordinates.
- Parameters
other (Coordinates, Coordinates1d) – Other coordinates to check
- Returns
issubset – True if these coordinates are a subset of the other coordinates.
- Return type
bool
Notes
This overrides the Coordinates1d.issubset method with optimizations for uniform coordinates.
-
property
ndim
¶
-
property
shape
¶
-
simplify
()[source]¶ Get the simplified/optimized representation of these coordinates.
- Returns
simplified – These coordinates (the coordinates are already simplified).
- Return type
-
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
-
unique
(return_index=False)[source]¶ Return the coordinates (uniform coordinates are already unique).
- Parameters
return_index (bool, optional) – If True, return index for the unique coordinates in addition to the coordinates. Default False.
- Returns
unique (
ArrayCoordinates1d
) – New ArrayCoordinates1d object with unique, sorted coordinate values.unique_index (list of indices) – index