Skip to main content

PyPI version Docs badge License

GliderFlight for Slocum ocean gliders

Synopsis

Gliderflight is a python module to calibrate a model that predicts the glider flight through water. The model results can be used to estimate the speed through water, a parameter which is required to compute turbulent dissipation rates from temperature microstructure or shear probe data, collected with a turbulence profiler mounted on top of an ocean glider.

Changelog

Version 1.2.1

  • Adds a bug fix contributed by isgiddy (Thanks!)
  • Modernizes package layout to be compatible with uv
  • Adds CI and PYPI publishing workflows

Version 1.2.0

  • Added paralel computing of solution for dynamic model
  • Added logging module for reporting of diagnostic messages
  • The named typle model_result now contains depth
  • Several small bug fixes

Version 1.0.1

  • Small bug fixes

Version 1.0.0

  • Initial release

Background

The dissipation rate of turbulent kinetic energy is a parameter that plays a key role in many physical and biogeo chemical processes in oceans and coastal seas. However, direct oceanic measurements of turbulence are relatively scarce, as most observations stem from free-falling profilers, operated from seagoing vessels.

An emerging alternative to ship-based profiling is the use of ocean gliders with mounted turbulence profilers. A required parameter in the processing of microstructure shear and temperature measurements is the speed of flow past the sensors. This speed can be measured directly with additional sensor, such as an electromagnetic current meter or mounted acoustic Doppler current profiler, but often gliders are not equipped with additional velocity sensors. Alternatively, a glider flight model can be used to estimate the speed through water. Such a model is described in the paper A dynamic flight model for Slocum gliders and implications for turbulence microstructure measurements 1. This Python model implements the steady-state and dynamic glider flight models, described therein.

Documentation

Documentation of this software package can be found at https://gliderflight.readthedocs.io/en/latest/

Steady-state model

The steady-state model implemented, considers a horizontal and vertical force balance. Vertical forces are a balance between buoyancy, gravity and the vertical components of the lift and drag forces. The horizontal force balance consists of the horizontal components of the lift and drag forces only. These two equations can be solved for the angle of attack and the speed through water, determining the flight at any instance of time.

Input to the model comes from parameters measured by the glider, such as the measured pitch angle (m_pitch), buoyancy change (m_ballast_pumped or m_de_oil_vol) and the in-situ density. Furthermore, the model requires the specification of a number of coefficients:

  • mg: mass of the glider (kg)
  • Vg: volume of the glider (m³)
  • Cd0: parasite drag coefficient
  • epsilon: compressibility of the hull (1/Pa)
  • ah: lift angle coefficient due to the hull (1/rad)
  • Cd1: induced drag coefficient (1/rad²)

Using the depth-rate from the pressure sensor as only model constraint, the mass (or glider volume) and the parasite drag coefficient can be determined. To determine the lift angle coefficient requires an additional constraint that contains a horizontal velocity component. Details of this procedure are given in 1.

Dynamic model

In addition to a steady-state model, this code also implements a dynamic model, that is, including the inertial terms. Since this model needs to be integrated, for which the Runge-Kutta method is used, it is more computational expensive. The dynamic model produces more accurate results when forcing conditions change rapidly, such as when crossing a sharp pycnocline or during the transition from dive to climb. Apart from the mathematical model underlying, the interfaces to both models are the same.

Model calibration and data masking

To calibrate a model, either steady-state or dynamic, we may wish not to include all the data in the evaluation of the cost-function. To that end, data can be masked. The Calibrate class provides boolean operators to do this:

  • OR()
  • AND()
  • NAND()

By default a mask set to False for all data. To mask data for which a condition evaluates to True, the OR() method should be used. For example,

gm = SteadyStateCalibrate(rho0=1024)
gm.set_input_data(datadict)

condition = depth < 10
gm.OR(condition)

which would exclude all data points for which the depth is less than 10 m from the evaluation of the cost-function.

A truth table:

mask condition OR AND NAND
0 0 0 0 1
1 0 1 0 1
1 1 1 1 0
0 1 1 0 1

Example

An example to calibrate a model:

# create a dictionary with the data

data = dict(time=t, pressure=P, pitch=pitch, buoyancy_change=deltaV)

gm = SteadyStateCalibrate()
# we have to define mass and volume at the minimum
gm.define(mg=70, Vg=70)

gm.set_input_data(data)

# mask all data below 10 m
gm.OR(pressure*10 < 10)
# mask all data exceeding 60 m
gm.OR(pressure*10 > 60)

result = gm.calibrate("mg", "Cd0")

print("Calibrated parameters:")
for k, v in result.items():
    print("{}: {}".format(k, v))

# Instead of printing the parameters from the results, we could also
# get them from the corresponding attributes: print("Cd0:", gm.Cd0).

print("Cd0:", gm.Cd0)

# We also don't need to run the model again either. The model output
# is also accessible from attributes:
#
# gm.t # time
# gm.U # incident velocity
# gm.alpha # angle of attack
# gm.ug    # horizontal speed
# gm.wg    # vertical speed
# gm.w     # vertical water velocity

# if we want to run a model with a given set of parameters

fm = DynamicGliderModel(dt=1, rho0=1024, k1=0.02, k2=0.92)
# copy the settings from the steady state model
fm.copy_settings(gm)

solution = fm.solve(data)

# solution is now a named tuple, according to the definition:
# Modelresult = namedtuple("Modelresult", "t u w U alpha pitch ww")

How to cite

When you publish results that were obtained with this software, please use the following citation:

Merckelbach, L., A. Berger, G. Krahmann, M. Dengler, and J. Carpenter, 2019: A dynamic flight model for Slocum gliders and implications for turbulence microstructure measurements. J. Atmos. Oceanic Technol., 36(2), 281-296, doi:10.1175/JTECH-D-18-0168.1.

Copyright information

Copyright (c) 2018, 2019 Helmholtz Zentrum Geesthacht, Germany Lucas Merckelbach, lucas.merckelbach@hereon.de

Software is licensed under the MIT licence.

References

  1. Merckelbach, L., A. Berger, G. Krahmann, M. Dengler, and J. Carpenter, 2019: A dynamic flight model for Slocum gliders and implications for turbulence microstructure measurements. J. Atmos. Oceanic Technol. 36(2), 281-296, doi:10.1175/JTECH-D-18-0168.1 2

Release files for gliderflight 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gliderflight 1.2.1
File Size Uploaded
gliderflight-1.2.1.tar.gz 365.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gliderflight 1.2.1
File Interpreter ABI Platform
gliderflight-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 387.6 kB

Release files / gliderflight-1.2.1.tar.gz

Download URL gliderflight-1.2.1.tar.gz
Size 365.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1b697b1bca43f73c6fb33723b8a94ad08e8ca8c1245aadc47826ee7fbd0d862f
BLAKE2b-256 checksum
How to use checksums
aaab3910f77b8e55ec8f0b091f510cba98d3dce1bd73c677ef4f3fce5832f306
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.30 {"installer":{"name":"uv","version":"0.11.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gliderflight-1.2.1-py3-none-any.whl

Download URL gliderflight-1.2.1-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b60b2f049c3a61d7fa88dad80b128fa3842c2514e52da5c10492b10268f7591a
BLAKE2b-256 checksum
How to use checksums
b158ee5990b88237142c197ac8e9a90ecc46b07162909c12616aac757d3b0100
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.30 {"installer":{"name":"uv","version":"0.11.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

1.2.0

1 release file

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page