Skip to main content

VTide: A python package for variational Bayesian tidal harmonic analysis

Project description

A Python implementation of the variational Bayesian harmonic analysis proposed in https://doi.org/10.22541/essoar.172072179.92243659/v1.

Installation

pip install vtide

Usage

Standard Analysis

Suppose we have a pandas dataframe containing sea-level measurements with a date-time index containing the time of each measurement. A complete RTide analysis can be run in just three lines of code:

df = pd.DataFrame({'observations': observations}, index = times)

model = VTide(df, lat, lon)
yp, sd = model.Solve()

A model has now been trained, and the constituents estimated from the provided data. Solve() will return two arrays, yp and sd which correspond to the tidal predictions and the associated standard deviations respectively. Solve has several additional functionalities, the most useful is the `prune' feature which will perform probabilistic outlier removal based on a user defined threshold. The fit results can be visualized using:

model.Visualize_Residuals()

If pruning it used, the bottom KDE plot will show the distribution of residuals without the outliers. This should be approximately Gaussian if things have gone right! We can now use the learned model to generate probabilistic predictions whenever we want. All we need is to provide a pandas time-index with the desired times:

yp, sd = model.Predict(test_times)

Constituents

After calling Solve(), the derived constituents and associated uncertainty estimates can be accessed directly through a dictionary using:

consts = model.harmonics

amplitudes = [consts[const]['amp'] for const in consts]
amplitude_uncertainty = [consts[const]['amp_uncert'] for const in consts]
phases = [consts[const]['phase'] for const in consts]
phase_uncertainty = [consts[const]['phase_uncert'] for const in consts]

Constituents and confidence intervals can quickly be visualized by calling:

model.Visualize_Constituents()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vtide-0.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vtide-0.1.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file vtide-0.1.0.tar.gz.

File metadata

  • Download URL: vtide-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for vtide-0.1.0.tar.gz
Algorithm Hash digest
SHA256 daa0428fd43110f032885dfd00fca69b2fd1010770dfa204c353d38b9ca00a0d
MD5 ea6a82ea5a41fbb1d507757547cd3f6d
BLAKE2b-256 6f620d1f0c4607182de61db618ac993e276e3fd727fa666a91d2cf34ae72151c

See more details on using hashes here.

File details

Details for the file vtide-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vtide-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for vtide-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c6da93724bcd683fb424e24c6c65321d033b35bdebe4446f5a72c5d31df4b1b
MD5 ba4c9b34eaa8247c340c976dad00989d
BLAKE2b-256 b37b0744c61c81d99abe8ef0452c1af6fd75939ffaa8f00c7455d7f21b40b7be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page