Functions in the icedraft module


(Content automatically geneated from the source code)

KOBBE.ICEDRAFT

Functions for calculating sea ice draft

kobbe.icedraft.calculate_draft(ds: Dataset, corr_sound_speed_CTD: bool = True, qual_thr: int = 8000, LE_AST_max_sep: float = 0.5, minimum_draft: float = -0.5) Dataset

Calculate ice draft.

This function calculates the sea ice draft by performing the following steps: 1. Gets surface position (estimated depth of the scattering surface below

the water surface) from LE- and AST-derived distances.

  1. Rejects LE measurements where LE diverges from AST by more than LE_AST_max_sep.

  2. Calculates the sea ice draft for each sample (from only samples classified as “sea ice covered”), and ensemble median values.

Parameters:
  • ds (dict) – Dictionary containing the data.

  • corr_sound_speed_CTD (bool, optional) – Flag to correct sound speed based on CTD. Defaults to True.

  • qual_thr (int, optional) – Quality threshold for the data. Defaults to 8000.

  • LE_AST_max_sep (float, optional) – Maximum allowed separation between LE and AST. Defaults to 0.5.

  • minimum_draft (float, optional) – Minimum draft value to consider valid. Defaults to -0.5.

Returns:

Updated dictionary with sea ice draft and median values.

Return type:

dict

kobbe.icedraft.calculate_surface_position(ds: Dataset, corr_sound_speed_CTD: bool = True, qual_thr: int = 8000, le_ast: str = 'AST') Dataset

Calculate the distance between the surface measured by the altimeter and the (mean) ocean surface.

This function calculates the surface position by adjusting altimeter distance for tilt, sound speed, and open water corrections. It also applies a quality threshold.

Parameters:
  • ds (xr.Dataset) – Xarray Dataset containing the Signature data including depth, altimeter distances, and quality attributes.

  • corr_sound_speed_CTD (bool, optional) – Flag to correct sound speed based on CTD (if available). Defaults to True.

  • qual_thr (int, optional) – Quality threshold for the data. Defaults to 8000.

  • le_ast (str, optional) – Indicates the source of the altimeter data, either “LE” or “AST”. Defaults to “AST”.

Returns:

Updated dataset with calculated surface depth.

Return type:

xr.Dataset

kobbe.icedraft.compare_open_water_correction(ds: Dataset, show_plots: bool = True) None

Compare the sea ice draft before and after applying open water corrections.

This function prints and optionally plots the comparisons between the open water surface depth estimates, applied corrections, and resulting sea ice draft values before and after corrections.

Parameters:
  • ds (xr.Dataset) – The xarray dataset containing the sea ice draft and open water surface depth estimates.

  • show_plots (bool, optional) – Whether to display the plots. Defaults to True.

Returns:

Prints some metrics of interest, and produces plots if show_plots is True.

Return type:

None

kobbe.icedraft.get_open_water_correction(ds: Dataset, fixed_offset: bool = True, ss_factor: bool = True, thr_reject_from_net_median: float = 0.15, min_frac_daily: float = 0.025, run_window_days: int = 1) Dataset

Compute open water corrections for sea ice draft measurements.

This function calculates and applies open water corrections, a fixed offset alpha and a time-dependent sound speed factor beta. It updates the dataset with these corrections and estimates; icedraft.calculate_draft can be run afterwards to obtain a corrected ice draft estimate.

Parameters:
  • ds (xr.Dataset) – The xarray dataset containing the sea ice draft and other relevant data.

  • fixed_offset (bool, optional) – Whether to compute and apply a fixed offset correction. Defaults to True.

  • ss_factor (bool, optional) – Whether to compute and apply a sound speed factor correction. Defaults to True.

  • thr_reject_from_net_median (float, optional) – Threshold for rejecting values that deviate from the median. Defaults to 0.15 meters.

  • min_frac_daily (float, optional) – Minimum fraction of ensembles required to retain daily estimates. Defaults to 0.025.

  • run_window_days (int, optional) – Window length for smoothing with running mean. Defaults to 1 day.

Returns:

The updated dataset with added correction factors and open water estimates.

Return type:

xr.Dataset

kobbe.icedraft.get_open_water_surface_depth(ds: Dataset, method: str = 'LE') DataArray

Get the surface depth during open water periods only.

This function retrieves the surface depth for open water periods, where ice is not present, and returns a DataArray with ice entries masked.

Parameters:
  • ds (xr.Dataset) – Xarray Dataset containing the surface depth and ice presence information.

  • method (str, optional) – Method to determine which surface depth to use, either “LE” or “AST”. Defaults to “LE”.

Returns:

DataArray with surface depth values during open water

periods, with ice entries masked.

Return type:

xr.DataArray

kobbe.icedraft.get_open_water_surface_depth_LP(open_water_surface_depth: DataArray, thr_reject_from_net_median: float = 0.15, min_frac_daily: float = 0.025, run_window_days: int = 1) Tuple[ndarray, ndarray]

Compute an estimate of the long-time averaged surface depth in open water (open water surface depth, OWSD).

In an ideal case, OWSD should be equal to zero.

Steps: 1. Reject instances where OWSD deviates from the OWSD deployment median by

more than thr_reject_from_net_median (meters, default = 0.15).

  1. Compute ensemble median values of the OWSD resulting from (1).

  2. Compute daily medians of the ensemble means in (2). Reject days where less than min_frac_daily (default = 0.025) of the ensembles contain open-water samples.

  3. Linearly interpolate between missing daily values to get a continuous daily time series.

  4. Smoothe this daily time series with a running mean of window length run_window_days (default=1).

Parameters:
  • open_water_surface_depth (xr.DataArray) – DataArray containing the surface depth during open water periods.

  • thr_reject_from_net_median (float, optional) – Threshold for rejecting values that deviate from the median. Defaults to 0.15 meters.

  • min_frac_daily (float, optional) – Minimum fraction of ensembles that need to contain open-water samples to retain daily estimates. Defaults to 0.025.

  • run_window_days (int, optional) – Window length for smoothing with running mean. Defaults to 1 day (no smoothing of daily values).

Returns:

Smoothed daily OWSD and the daily time array with midpoints of the daily estimates.

Return type:

Tuple[np.ndarray, np.ndarray]