podpac.coordinates.ArrayCoordinates1d¶
-
class
podpac.coordinates.
ArrayCoordinates1d
(coordinates, name=None, **kwargs)[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 numpydatetime64
. For convenience, podpac automatically converts datetime strings such as'2018-01-01'
todatetime64
. 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.
See also
Alternative Constructors
Create 1d coordinates from a coordinates definition.
from_xarray
(x, **kwargs)Create 1d Coordinates from named xarray coordinates.
Methods
__init__
(coordinates[, name])Create 1d coordinates from an array.
copy
()Make a deep copy of the 1d Coordinates array.
flatten
()Get a copy of the coordinates with a flattened array (wraps numpy.flatten).
get_area_bounds
(boundary)Get low and high coordinate area bounds.
issubset
(other)Report whether other coordinates contains these coordinates.
reshape
(newshape)Get a copy of the coordinates with a reshaped array (wraps numpy.reshape).
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])Remove duplicate coordinate values from each dimension.
Attributes
Low and high coordinate bounds.
A coercing numpy array trait.
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.
udims
Tuple of unstacked dimension names, for compatibility.
xcoords
xarray coords
xdims
Tuple of indexing dimensions used to create xarray DataArray.
- Members
-
__init__
(coordinates, name=None, **kwargs)[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’.
-
property
argbounds
¶
-
property
bounds
¶ Low and high coordinate bounds.
-
coordinates
¶ A coercing numpy array trait.
-
copy
()[source]¶ Make a deep copy of the 1d Coordinates array.
- Returns
Copy of the coordinates.
- Return type
-
property
dtype
¶ Coordinates dtype.
float
for numerical coordinates and numpydatetime64
for datetime coordinates.- Type
type
-
flatten
()[source]¶ Get a copy of the coordinates with a flattened array (wraps numpy.flatten).
- Returns
Flattened coordinates.
- Return 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" })
- Parameters
d (dict) – 1d coordinates array definition
- Returns
1d Coordinates
- Return type
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
- Returns
1d coordinates
- Return type
-
property
is_descending
¶
-
property
is_monotonic
¶
-
property
is_uniform
¶
-
property
ndim
¶
-
reshape
(newshape)[source]¶ Get a copy of the coordinates with a reshaped array (wraps numpy.reshape).
- Parameters
newshape (int, tuple) – The new shape.
- Returns
Reshaped coordinates.
- Return type
-
property
shape
¶
-
simplify
()[source]¶ Get the simplified/optimized representation of these coordinates.
- Returns
UniformCoordinates1d if the coordinates are uniform, otherwise ArrayCoordinates1d
- Return type
-
property
size
¶ Number of coordinates.
-
property
start
¶
-
property
step
¶
-
property
stop
¶
-
unique
(return_index=False)[source]¶ Remove duplicate coordinate values from each dimension.
- 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