API reference

This page provides a summary of cerbere API. For more details and examples, refer to the relevant chapters in the main part of the documentation.

cerbere provides to accessors for xarray DataArray and Dataset classes. In both cases, they are called cerbere.

DataArray accessor

Creating a cerbere DataArray

DataArrayAccessor(xarray_obj)

Describes a scientific data array.

Attributes

DataArrayAccessor.cfarray

Returns a CF normalized version of the dataset.

DataArrayAccessor.long_name

The variable description (long_name CF attribute)

DataArrayAccessor.standard_name

The variable standard name (standard_name CF attribute)

DataArrayAccessor.ancillary_variables

identifies a variable that contains closely associated data, e.g., the measurement uncertainties of instrument data.

DataArrayAccessor.units

The variable data units (units CF attribute)

DataArrayAccessor.coverage_content_type

ACDD 1.3 attribute; An ISO 19115-1 code to indicate the source of the data (image, thematicClassification, physicalMeasurement, auxiliaryInformation, qualityInformation, referenceInformation, modelResult, or coordinate).

DataArrayAccessor.science_dtype

The scientific dtype of the data (ignores xarray internal conversion)

DataArrayAccessor.mask

Return the mask of the data (like in numpy MaskedArray)

DataArrayAccessor.fill_value

The value for missing data in the field

DataArrayAccessor.scale_factor

The encoding scaling factor for the data (scale_factor CF attribute)

DataArrayAccessor.add_offset

The encoding offset factor for the data (add_offset CF attribute)

DataArrayAccessor.precision

The least significant digit for the values of the field.

DataArrayAccessor.valid_min

The minimum valid value in the field data

DataArrayAccessor.valid_max

The maximum valid value in the data (valid_max CF attribute)

Methods

DataArrayAccessor.isel([indexers, padding, ...])

type padding:

bool

DataArrayAccessor.loc

Attribute for location based indexing like pandas.

DataArrayAccessor.to_masked_array()

Returns:

DataArrayAccessor.clip(geometry[, masked, ...])

Return the data of a field within a geographical area.

Dataset cerbere accessor

The base class for Dataset objects, than can be imported from cerbere.dataset.dataset module. All other classes in cerbere.dataset package are derived from this class.

Creating a dataset

DatasetAccessor(xarray_obj)

Attributes

DatasetAccessor.basename

Return the basename of the file storing the dataset

DatasetAccessor.url

DatasetAccessor.filesize

The dataset file size, in octets

DatasetAccessor.file_creation_date

The date the dataset file was generated

DatasetAccessor.bbox

The bounding box, e.g.

DatasetAccessor.wkt_bbox

The bounding box in WKT format.

DatasetAccessor.collection_id

return the identifier of the product collection

DatasetAccessor.naming_authority

DatasetAccessor.product_version

Return the product version

DatasetAccessor.time_coverage_start

Returns the first measurement time in the data.

DatasetAccessor.time_coverage_end

Returns the last measurement time in the data.

Dataset contents

DatasetAccessor.save(path[, profile, ...])

type path:

Union[str, Path]

Dataset subsetting

DatasetAccessor.isel([indexers, padding, ...])

type indexers:

Optional[Any]

DatasetAccessor.clip(geometry[, masked, ...])

Return the dataset subsets within a geographical area.

DatasetAccessor.get_location_by_value(field, ...)

Return the indices and geolocation of a given value.

DatasetAccessor.closest_spatial_location(...)

Get closest dataset lat/lon location to given coordinates.

Feature

A Feature object inherits all the attributes and methods of a Dataset object. It provides in addition the following methods and attributes.

Creating a feature

The generic method to create or open from a file a feature is cerbere.open_as_feature(). It allows to instantiate any of the following features.

cpoint.Point(*args, **kwargs)

To represent data at scattered locations and times with no implied relationship among of coordinate positions, both data and coordinates must share the same (sample) instance dimension.

cprofile.Profile(dataset[, force_reorder])

Feature class for the profile observation patterns.

ctrajectory.Trajectory(dataset[, force_reorder])

Feature class for the trajectory observation patterns.

ctimeseries.TimeSeries(dataset[, force_reorder])

Data may be taken over periods of time at a set of discrete point, spatial locations called stations (see also discussion in 9.1). The set of elements at a particular station is referred to as a timeSeries feature and a data variable may contain a collection of such features. The instance dimension in the case of timeSeries specifies the number of time series in the collection and is also referred to as the station dimension. The instance variables, which have just this dimension, including latitude and longitude for example, are also referred to as station variables and are considered to contain information describing the stations. The station variables may contain missing values, allowing one to reserve space for additional stations that may be added at a later time, as discussed insection 9.6. In addition, * It is strongly recommended that there should be a station variable ( which may be of any type) with the attribute cf_role=”timeseries_id”, whose values uniquely identify the stations. * It is recommended that there should be station variables with standard_name attributes " platform_name ", " surface_altitude " and “ platform_id ” when applicable.

ctimeseriesprofile.TimeSeriesProfile(*args, ...)

When profiles are taken repeatedly at a station, one gets a time series of profiles (see also section H.2 for discussion of stations and time series).

ctrajectoryprofile.TrajectoryProfile(*args, ...)

Feature class for the CF / Unidata CDM observation pattern corresponding to Profiles along a single trajectory.

cswath.Swath(dataset, **kwargs)

Feature class for representing a swath, a two-dimensional irregular grid along the satellite ground track.

cgrid.Grid(dataset[, projection])

Model class for the grid feature, ie a two-dimensional array on fixed projection, resolution and boundaries.

cgridtimeseries.GridTimeSeries(dataset[, ...])

Class implementing a time series of grids

Additional collection feature class, as defined by CF convention:

cimdcollection.IMDCollection(dataset[, ...])

Feature class for an incomplete multidimensional collection of features, as defined by Climate and Forecast convention: https://cfconventions.org/cf-conventions/cf-conventions.html #_incomplete_multidimensional_array_representation

comdcollection.OMDCollection(dataset[, ...])

Feature class for an orthogonal multidimensional collection of features.

Attributes

Feature.feature_type

Return the type of the feature

Feature contents

Feature.extract(*args[, bbox, footprint])

Extract a subset as a new Feature object.

Feature.append(feature[, prefix, ...])

Append the fields from another feature