dctools.data.coordinates.CoordinateSystem
- class dctools.data.coordinates.CoordinateSystem(coord_type, coord_level, coordinates, crs)
Class representing the coordinate system of a dataset.
- Parameters:
coord_type (str)
coord_level (str)
coordinates (Dict[str, str])
crs (str)
- __init__(coord_type, coord_level, coordinates, crs)
- Parameters:
coord_type (str)
coord_level (str)
coordinates (Dict[str, str])
crs (str)
Methods
__init__(coord_type, coord_level, ...)detect_data_level(data, names_dict)Infers the observation data level (L1, L2, L3, L4) from structure and content.
detect_oceanographic_variables(variables)Detect oceanographic variables in an xarray Dataset based on standard_name and aliases.
Detect and return the coordinate system from a dataset.
Check if the coordinate system is geographic.
Check if this coordinate system is for an ungridded observation dataset.
is_polar()Check if the coordinate system is polar.
toJSON()Convert the object to a JSON string.
to_dict()Convert the CoordinateSystem instance to a dictionary.
- static detect_data_level(data, names_dict)
Infers the observation data level (L1, L2, L3, L4) from structure and content.
- Parameters:
data (object) – Input data (DataFrame, GeoDataFrame, or xarray.Dataset)
names_dict (dict)
- Returns:
One of: “L1”, “L2”, “L3”, “L4”, or “unknown”
- Return type:
str
- static detect_oceanographic_variables(variables)
Detect oceanographic variables in an xarray Dataset based on standard_name and aliases.
- Parameters:
variables (dict) – _description_
- Returns:
mapping variable type -> actual name in the dataset.
- Return type:
dict
- Raises:
ValueError – _description_
- static get_coordinate_system(ds)
Detect and return the coordinate system from a dataset.
- Parameters:
ds (xarray.Dataset | xarray.DataArray)
- Return type:
- is_geographic()
Check if the coordinate system is geographic.
- Return type:
bool
- is_observation_dataset()
Check if this coordinate system is for an ungridded observation dataset.
- Return type:
bool
- is_polar()
Check if the coordinate system is polar.
- Return type:
bool
- toJSON()
Convert the object to a JSON string.
- to_dict()
Convert the CoordinateSystem instance to a dictionary.
- Return type:
dict