glider_ingest.gridder
Module containing the Gridder class.
Module Contents
- class glider_ingest.gridder.Gridder[source]
Class to create and calculate a gridded dataset from a mission dataset.
This class provides methods for processing oceanographic data, creating time and pressure grids, interpolating data onto those grids, and adding metadata attributes to the gridded dataset.
Depends on the dataset having attributes
- ds_mission
The input mission dataset to process.
- Type:
xr.Dataset
- interval_h
Time interval (in hours) for gridding.
- Type:
int | float
- interval_p
Pressure interval (in decibars) for gridding.
- Type:
int | float
- Internal Attributes (initialized later):
ds (xr.Dataset): A copy of the mission dataset with NaN pressures removed. variable_names (list): List of variable names in the dataset. time, pres (np.ndarray): Arrays of time and pressure values. lat, lon (np.ndarray): Mean latitude and longitude of the dataset. grid_pres, grid_time (np.ndarray): Pressure and time grids for interpolation. data_arrays (dict): Dictionary of initialized gridded variables.
- add_attrs()[source]
Adds descriptive metadata attributes to the gridded dataset variables.
This method assigns long names, units, valid ranges, and other metadata to the gridded dataset variables for better interpretation and standardization.
- check_len(values, expected_length)[source]
Ensures that the length of the input array is greater than the expected length.
- Parameters:
values (list | np.ndarray) – Input array to check.
expected_length (int) – Minimum required length.
- Raises:
ValueError – If the length of values is less than or equal to expected_length.
- create_gridded_dataset() xarray.Dataset[source]
Process and interpolate time-sliced data to create a gridded dataset.
- This method orchestrates the complete gridding process by:
Interpolating variables onto a fixed pressure grid
Computing derived oceanographic quantities
Creating the final dataset with standardized dimensions
Adding metadata attributes
Note
Requires the gsw library for oceanographic calculations and assumes that self.data_arrays and self.int_time are properly initialized.
- initalize_grid()[source]
Creates a time-pressure grid for interpolation.
This method calculates evenly spaced time intervals based on the interval_h attribute and pressure intervals based on the interval_p attribute. The resulting grids are stored as internal attributes for further processing.
- data_arrays: dict
- ds: xarray.Dataset
- ds_gridded: xarray.Dataset
- ds_mission: xarray.Dataset
- grid_pres: numpy.ndarray
- grid_time: numpy.ndarray
- int_pres: numpy.ndarray
- int_time: numpy.ndarray
- interval_h: int | float
- interval_p: int | float
- lat: numpy.ndarray
- property logger
Get the logger instance for this gridder.
- lon: numpy.ndarray
- pres: numpy.ndarray
- time: numpy.ndarray
- variable_names: list
- xx: int
- yy: int