Skip to main content

Tidal constituents analysis in Python.

Project description

conda platforms latest-release-date license

pangeo-pytide

About

pytide allows to analyze the tidal constituents of a time series from a harmonic analysis. The definition of tidal constants and astronomical arguments is taken from FES2014 tidal prediction software.

It was developed to analyze the MIT/GCM LLC4320 model. The script "mit_gcm_detiding.py" used to perform this analysis is distributed with this distribution.

Try it for yourself

Try this library on http://binder.pangeo.io/:

How To Install

Anaconda is a free and open-source distribution of the Python programming language for scientific computing, that aims to simplify package management and deployment. Package versions are managed by the package management system conda.

The first step is to install the anaconda distribution. The installation manual for this software is detailed here.

To install the software using conda simply execute the following command:

conda install pytide -c conda-forge

This command will install the software and the necessary dependencies. More information is available on the syntax of this command on the related documentation.

If you want to build the package yourself, you can find more information on the help page of the project.

Quick Tutorial

The distribution contains a time series fes_tide_time_series.nc that will be used in this help.

The first step is to read this time series using the NetCDF4 library, for example:

import netCDF4
import pytide

with netCDF4.Dataset("tests/dataset/fes_tide_time_series.nc") as dataset:
    time = netCDF4.num2date(dataset['time'][:],
                            dataset['time'].unit,
                            only_use_cftime_datetimes=False)
    h = dataset['ocean'][:] * 1e-2      # cm to m

Then, we will create an instance of a pytide.WaveTable object:

wt = pytide.WaveTable()

By default, all components known by this object are loaded into memory. The list of components known by this object can be retrieved using the pytide.WaveTable.known_constituents method.

If you want to restrict the analysis to only a few components, you must provide a list to the constructor in order to specify the waves to be analyzed.

wt = pytide.WaveTable(["M2", "K1", "O1", "P1", "Q1", "S1"])

The pytide.WaveTable.constituents method allows to retrieve the list of waves defined during the construction of the object.

The different nodal corrections are then calculated from the time series to be analyzed:

f, vu = wt.compute_nodal_modulations(time.astype("datetime64"))
# You can also use a list of datetime.datetime objects
# wt.compute_nodal_modulations(list(time))

These coefficients are used by harmonic analysis to determine the properties of the different tidal waves defined during the construction of the instance.

w = wt.harmonic_analysis(h, f, vu)

This result can then be used to determine a tidal height for the analyzed time series:

hp = wt.tide_from_tide_series(time, w)

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

pytide-1.2.7.tar.gz (4.1 MB view details)

Uploaded Source

File details

Details for the file pytide-1.2.7.tar.gz.

File metadata

  • Download URL: pytide-1.2.7.tar.gz
  • Upload date:
  • Size: 4.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pytide-1.2.7.tar.gz
Algorithm Hash digest
SHA256 270ee5dfcab6f3dd967c992f14cd06c5606d06a507d57865efe8c7aa0c076c6c
MD5 ae793db4e2b036829f39240847d9ace2
BLAKE2b-256 38487d955ce9388c8d5dc8b728097a87aa52989cff85cb078072d72a23f0bb90

See more details on using hashes here.

Supported by

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