gerg_plotting.data_classes.data#

Module Contents#

class gerg_plotting.data_classes.data.Data#

Represents a spatial dataset with various oceanographic or atmospheric variables.

Attributes#

latIterable | Variable | None

Latitude values or Variable object containing latitude data

lonIterable | Variable | None

Longitude values or Variable object containing longitude data

depthIterable | Variable | None

Depth values or Variable object containing depth data

timeIterable | Variable | None

Time values or Variable object containing temporal data

boundsBounds, optional

Geographic and depth bounds for the dataset

custom_variablesdict

Dictionary to store additional custom variables

temperatureIterable, Variable, or None, optional

Temperature data, in °C, with optional colormap and range specifications.

salinityIterable, Variable, or None, optional

Salinity data with optional colormap and range specifications.

densityIterable, Variable, or None, optional

Density data, in kg/m³, with optional colormap and range specifications.

uIterable, Variable, or None, optional

Zonal velocity (u-component) in m/s, with optional colormap and range specifications.

vIterable, Variable, or None, optional

Meridional velocity (v-component) in m/s, with optional colormap and range specifications.

wIterable, Variable, or None, optional

Vertical velocity (w-component) in m/s, with optional colormap and range specifications.

speedIterable, Variable, or None, optional

Speed data, derived or directly assigned, in m/s, with optional colormap and range specifications.

chlorIterable, Variable, or None, optional

Chlorophyll data, in μg/L, with optional colormap and range specifications.

cdomIterable, Variable, or None, optional

CDOM data, in ppb, with optional colormap and range specifications.

turbidityIterable, Variable, or None, optional

Turbidity data, dimensionless, with optional colormap and range specifications.

boundsBounds

Spatial bounds of the data.

add_custom_variable(variable: gerg_plotting.data_classes.variable.Variable, exist_ok: bool = False) None#

Add a custom Variable object accessible via both dot and dict syntax.

Parameters#

variableVariable

The Variable object to add

exist_okbool, optional

If True, replace existing variable if it exists, by default False

Raises#

TypeError

If provided object is not a Variable instance

AttributeError

If variable name already exists and exist_ok is False

property bounds: gerg_plotting.data_classes.bounds.Bounds#

Get or set the bounds of the data.

bounds_padding#
buoyancy_frequency: Iterable | gerg_plotting.data_classes.variable.Variable | None#
calcluate_PSD(sampling_freq, segment_length, theta_rad=None) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray] | tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]#

Calculate the power spectral density (PSD) using Welch’s method.

Parameters#

sampling_freqfloat

Sampling frequency of the data in Hz.

segment_lengthint

Length of each segment for Welch’s method.

theta_radfloat, optional

Angle of rotation in radians. Rotates the u and v components if specified.

Returns#

tuple

A tuple containing the frequency array and PSD values for the velocity components. If the vertical component (w) is available, it is also included in the tuple.

calculate_speed(include_w: bool = False) None#

Calculate the speed from velocity components.

Parameters#

include_wbool, optional

If True, includes the vertical velocity (w-component) in the speed calculation. Defaults to False.

cdom: Iterable | gerg_plotting.data_classes.variable.Variable | None#
chlor: Iterable | gerg_plotting.data_classes.variable.Variable | None#
copy()#

Creates a deep copy of the instrument object.

custom_variables: dict#
date2num() list#

Converts time values to numerical values.

density: Iterable | gerg_plotting.data_classes.variable.Variable | None#
depth: Iterable | gerg_plotting.data_classes.variable.Variable | None#
detect_bounds(bounds_padding=0) gerg_plotting.data_classes.bounds.Bounds#

Detect the geographic bounds of the data, applying padding if specified.

An intentional effect of this function:

will only calculate the bounds when self.bounds is None, so that it does not overwrite the user’s custom bounds, this will also ensure that the bounds is not repeatedly calculated unless desired, can recalculate self.bounds using a new bounds_padding value if self.bounds is set to None

The depth bounds are not affected by the bounds padding, therfore the max and min values of the depth data are used

Parameters#

bounds_paddingfloat, optional

Padding to add to the detected bounds, by default 0

Returns#

Bounds

Object containing the detected geographic and depth bounds

get_vars(have_values: bool | None = None) list#

Gets a list of all available variables.

lat: Iterable | gerg_plotting.data_classes.variable.Variable | None#
lon: Iterable | gerg_plotting.data_classes.variable.Variable | None#
oxygen: Iterable | gerg_plotting.data_classes.variable.Variable | None#
remove_custom_variable(variable_name) None#

Remove a custom variable from the instrument.

Parameters#

variable_namestr

Name of the variable to remove

salinity: Iterable | gerg_plotting.data_classes.variable.Variable | None#
speed: Iterable | gerg_plotting.data_classes.variable.Variable | None#
temperature: Iterable | gerg_plotting.data_classes.variable.Variable | None#
time: Iterable | gerg_plotting.data_classes.variable.Variable | None#
turbidity: Iterable | gerg_plotting.data_classes.variable.Variable | None#
u: Iterable | gerg_plotting.data_classes.variable.Variable | None#
v: Iterable | gerg_plotting.data_classes.variable.Variable | None#
w: Iterable | gerg_plotting.data_classes.variable.Variable | None#