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()
Metadata
Release files for vtide 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vtide-0.1.0.tar.gz | 13.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vtide-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.3 kB
Release files / vtide-0.1.0.tar.gz
| Download URL | vtide-0.1.0.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
daa0428fd43110f032885dfd00fca69b2fd1010770dfa204c353d38b9ca00a0d
|
|
BLAKE2b-256 checksum How to use checksums |
6f620d1f0c4607182de61db618ac993e276e3fd727fa666a91d2cf34ae72151c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.7
|
Release files / vtide-0.1.0-py3-none-any.whl
| Download URL | vtide-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c6da93724bcd683fb424e24c6c65321d033b35bdebe4446f5a72c5d31df4b1b
|
|
BLAKE2b-256 checksum How to use checksums |
b37b0744c61c81d99abe8ef0452c1af6fd75939ffaa8f00c7455d7f21b40b7be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.7
|