Registry / analytics / utide
library0.3.1pypypi✓ verified 83d ago

A Python port of the MATLAB UTide package for tidal analysis and prediction of water levels and currents. Handles harmonic analysis and tidal prediction with robust handling of nodal/satellite corrections. Latest version 0.3.1, released 2023-09.

pip install utide
INSTALL
IMPORT
SIG · UTIDE
U
utide
analyticspythonv0.3.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

solve
from utide import solve
from utide import ut_solve
The old MATLAB-style 'ut_solve' is not exported from the Python package; use 'solve' instead.
reconstruct
from utide import reconstruct
from utide import ut_reconstr
Old MATLAB name 'ut_reconstr' is not available; use 'reconstruct'.
harmonic_analysis
from utide import harmonic_analysis

Basic tidal analysis and prediction using utide.

import numpy as np from utide import solve, reconstruct # Example time series (hourly for 35 days) t = np.arange(0, 35*24, 1) # hours # Simulate water level with two tidal constituents wl = 1.0 * np.cos(2*np.pi * t/12.42) + 0.3 * np.cos(2*np.pi * t/12.0) # Perform harmonic analysis coef = solve(t, wl, lat=45.0, nodal=True, trend=True, method='ols') # Reconstruct tidal prediction for the same time period tide = reconstruct(t, coef) print(tide.h) # tidal elevation
Debug
Known issues
breakingThe 'method' parameter in solve() no longer accepts 'robust' as of v0.3.0; use 'ols' (ordinary least squares) or 'lss' (least squares with iterative reweighting). The 'robust' option was removed without fallback.
fix
Replace method='robust' with method='ols' or method='lss'.
affects: >=0.3.0
deprecatedThe 'conf_int' parameter in solve() is deprecated as of v0.3.0 and will be removed in a future version. Confidence intervals are now automatically computed when method='ols' and can be accessed via coef.conf_int.
fix
Omit conf_int from the call; confidence intervals are handled automatically.
affects: >=0.3.0
gotchaInput time array 't' must be in hours (not days, seconds, or datetime objects). Using datetime or days will produce incorrect frequencies and wrong results.
fix
Convert time to hours since an arbitrary start. For example, if you have datetime array 'dt', do: t = (dt - dt[0]).total_seconds() / 3600.
affects: all
gotchaThe 'lat' parameter in solve() is required for nodal/satellite corrections. If omitted or set to None, no nodal corrections are applied, which may cause phase errors for long records (>1 year).
fix
Always provide a numeric latitude (e.g., lat=45.0) even if you are not interested in corrections; it changes the constituents used.
affects: all
Errors
Common errors & fixes
AttributeError: module 'utide' has no attribute 'ut_solve'
Users try to use the old MATLAB function name 'ut_solve' which is not exported in the Python package.
fix
Import 'solve' directly: from utide import solve
ValueError: method must be one of 'ols' or 'lss'
Using method='robust' which was removed in v0.3.0.
fix
Replace method='robust' with method='ols' or method='lss'.
TypeError: solve() got an unexpected keyword argument 'conf_int'
The 'conf_int' parameter was deprecated and removed in some recent version. It is no longer accepted.
fix
Remove conf_int from the call. Confidence intervals are automatically computed when suitable.
UserWarning: Latitude not provided; nodal corrections not applied.
No 'lat' parameter passed to solve(). While not an error, it may produce inaccurate results.
fix
Pass a numeric latitude, e.g., lat=45.0.
Upgrade
Version history
0.3.1latest on PyPI · released Apr 28, 2025
Audit
Dependencies
numpyrequiredCore array operations and linear algebra
scipyrequiredOptimization and interpolation routines
matplotliboptionalOptional for plotting utilities (if using utide.plot)
Agent activity
47 hits · last 30 days
node
40
Amazon
1
OpenAI (training)
1
Resources

No resource links recorded.

utide — pip install utide · libregistry