satpy.cf.coords module
Set CF-compliant spatial and temporal coordinates.
- class satpy.cf.coords._TimeBoundsCalculator(ds, time_dim)[source]
Bases:
objectInitialize time bounds calculator.
- _get_bounds_multiple_timesteps()[source]
Get time bounds for a dataset with multiple timesteps.
Computes bounds based on time coordinates and for the last timestep uses the “end_time” attribute. Example for 3 timesteps:
bounds = [ (t[0], t[1]), (t[1], t[2]), (t[2], max_end_time_from_attrs) ]
- satpy.cf.coords._add_declared_coordinates(data_arrays, dataarray_name)[source]
Add declared coordinates to the dataarray if they exist.
- satpy.cf.coords._add_xy_geographic_coords_attrs(data_arr, x='x', y='y')[source]
Add relevant attributes to x, y coordinates of a geographic CRS.
- Return type:
- satpy.cf.coords._add_xy_projected_coords_attrs(data_arr, x='x', y='y')[source]
Add relevant attributes to x, y coordinates of a projected CRS.
- Return type:
- satpy.cf.coords._get_coordinates_list(data_arr)[source]
Return a list with the coordinates names specified in the ‘coordinates’ attribute.
- satpy.cf.coords._is_lon_or_lat_dataarray(data_arr)[source]
Check if the DataArray represents the latitude or longitude coordinate.
- Return type:
- satpy.cf.coords._is_projected(data_arr)[source]
Guess whether data are projected or not.
- Return type:
- satpy.cf.coords._rename_coords(data_arrays, coord_name)[source]
Rename coordinates in the datasets.
- satpy.cf.coords._try_add_coordinate(data_arrays, dataarray_name, coord)[source]
Try to add a coordinate to the dataarray, warn if not possible.
- satpy.cf.coords._warn_if_pretty_but_not_unique(pretty, coord_name)[source]
Warn if coordinates cannot be pretty-formatted due to non-uniqueness.
- satpy.cf.coords.add_coordinates_attrs_coords(data_arrays)[source]
Add to DataArrays the coordinates specified in the ‘coordinates’ attribute.
It deal with the ‘coordinates’ attributes indicating lat/lon coords The ‘coordinates’ attribute is dropped from each DataArray
If the coordinates attribute of a data array links to other dataarrays in the scene, for example coordinates=’lon lat’, add them as coordinates to the data array and drop that attribute.
In the final call to xr.Dataset.to_netcdf() all coordinate relations will be resolved and the coordinates attributes be set automatically.
- satpy.cf.coords.add_time_bounds_dimension(ds, time='time')[source]
Add time bound dimension to xr.Dataset.
- Return type:
- satpy.cf.coords.add_xy_coords_attrs(data_arr)[source]
Add relevant attributes to x, y coordinates.
- Return type:
- satpy.cf.coords.check_unique_projection_coords(data_arrays)[source]
Check that all datasets share the same projection coordinates x/y.
- Return type:
- satpy.cf.coords.ensure_unique_nondimensional_coords(data_arrays, pretty=False)[source]
Make non-dimensional coordinates unique among all datasets.
Non-dimensional coordinates, such as scanline timestamps, may occur in multiple datasets with the same name and dimension but different values.
In order to avoid conflicts, prepend the dataset name to the coordinate name. If a non-dimensional coordinate is unique among all datasets and
pretty=True, its name will not be modified.Since all datasets must have the same projection coordinates, this is not applied to latitude and longitude.