semantique.processor.arrays.Array

semantique.processor.arrays.Array#

class semantique.processor.arrays.Array(xarray_obj)[source]#

Internal representation of a multi-dimensional array.

This data structure is modelled as an accessor of xarray.DataArray. Using accessors instead of the common class inheritance is recommended by the developers of xarray, see here. In practice, this means that each method of this class can be called as method of xarray.DataArray objects by using the .sq prefix:

xarray_obj.sq.method
Parameters:

xarray_obj (xarray.DataArray) – The content of the array.

__init__(xarray_obj)[source]#

Methods

__init__(xarray_obj)

align_with(other)

Align the array to the shape of another array.

apply_custom(verb[, track_types])

Apply a user-defined verb to the array.

assign(y[, at, track_types])

Apply the assign verb to the array.

delineate([track_types])

Apply the delineate verb to the array.

drop_non_dimension_coords([keep])

Drop non-dimension coordinates from the array.

evaluate(operator[, y, track_types])

Apply the evaluate verb to the array.

extract(dimension[, component])

Apply the extract verb to the array.

fill(dimension, method[, extrapolate, ...])

Apply the fill verb to the array.

filter(filterer[, track_types])

Apply the filter verb to the array.

groupby(grouper[, labels_as_names])

Apply the groupby verb to the array.

name(value, **kwargs)

Apply the name verb to the array.

reduce(reducer[, dimension, track_types])

Apply the reduce verb to the array.

regularize()

Regularize the spatial dimension of the array.

rename_dims(mapping)

Rename one or more dimensions in the array.

reproject(crs, **kwargs)

Reproject the spatial coordinates of the array into a different CRS.

shift(dimension, steps, **kwargs)

Apply the shift verb to the array.

smooth(reducer, dimension, size[, limit, ...])

Apply the smooth verb to the array.

stack_all_dims()

Stack all dimensions into a single multi-indexed dimension.

stack_spatial_dims()

Stack spatial X and Y dimensions into a single spatial dimension.

to_csv(file)

Write the content of the array to a CSV file on disk.

to_dataframe()

Convert the array to a pandas DataFrame.

to_geodataframe([output_crs])

Convert the array to a geopandas GeoDataFrame.

to_geotiff(file[, cloud_optimized, ...])

Write the content of the array to a GeoTIFF file on disk.

trim([dimension])

Apply the trim verb to the array.

tz_convert(tz, **kwargs)

Convert the temporal coordinates of the array into a different timezone.

unstack_all_dims()

Unstack the single multi-indexed dimension back into separate dimensions.

unstack_spatial_dims()

Unstack the spatial dimension into separate X and Y dimensions.

write_crs(crs[, inplace])

Store the CRS of the array as non-dimension coordinate.

write_spatial_resolution([resolution, ...])

Store the spatial resolution of the array as dimension attributes.

write_tz(tz[, inplace])

Store the timezone of the array as non-dimension coordinate.

Attributes

crs

Coordinate reference system in which the spatial coordinates of the array are expressed.

grid_points

Spatial grid points of the array.

is_empty

Is the array empty.

spatial_resolution

Spatial resolution [x,y] of the array in units of the CRS.

tz

Time zone in which the temporal coordinates of the array are expressed.

value_labels

Character labels of data values.

value_type

The value type of the array.