Skip to content

mousebrains/RecoverBy

Repository files navigation

Estimate when a Slocum glider will need to be recovered by

The main method uses the estimated percentage of battery remaining to predict when the percentage left will be a given value.

The input is a time series NetCDF with at least two columns:

  • time a CF compliant time of the observation
  • m_lithium_battery_relative_charge as defined by Slocum masterdata file

A compatible input NetCDF file is generated from my Slocum_DataHarvester in the sensors files.

A linear regression is done to:

m_lithium_battery_relative_charge = a + b (time - min(time))/86400

so the slope is in days.

Installation

pip install .

This also installs a recover-by console command.

For development (includes ruff, mypy, pytest, pre-commit):

pip install ".[dev]"
pre-commit install
pre-commit install --hook-type pre-push

Usage

Basic usage:

recover-by sensor_data.nc

With plotting enabled:

recover-by --plot sensor_data.nc

Save plot to a file (useful on headless/remote servers):

recover-by --output recovery.png sensor_data.nc

Machine-readable JSON output:

recover-by --json sensor_data.nc

Using only the last N days of data:

recover-by --ndays 7 sensor_data.nc

Specifying a custom threshold:

recover-by --threshold 10 sensor_data.nc

Using a custom confidence level (default is 0.95):

recover-by --confidence 0.99 sensor_data.nc

Using a specific time range:

recover-by --start "2025-01-01" --stop "2025-01-15" sensor_data.nc

For verbose output:

recover-by --verbose sensor_data.nc

The script can also be run directly:

./SlocumBatteryPercentageDuration.py sensor_data.nc

About

When will a buoyancy glider need to be recovered by?

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages