Giter Site home page Giter Site logo

dlxiii / tappy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pwcazenave/tappy

0.0 1.0 0.0 2.37 MB

Tidal Analysis Program in PYthon (TAPPY) uses the least squares optimization function from scipy to perform a harmonic analysis (calculate amplitude and phases of a set of sine waves) of a hourly time series of water level values.

License: GNU General Public License v2.0

Shell 0.32% Python 56.63% Jupyter Notebook 43.06%

tappy's Introduction

TAPPY

TAPPY is a tidal analysis package. It breaks down an hourly record of water levels into the component sine waves. It is written in Python and uses the least squares optimization and other functions in SciPy. The focus is to make the most accurate analysis possible. TAPPY only determines the constituents that are calculatable according to the length of the time series.

Authors

  • Tim Cera (tim at cerazone.net)
  • Pierre Cazenave (Plymouth Marine Laboratory)

Source

This repository is an import of the CVS repository found on the official site:

https://sourceforge.net/p/tappy/wiki/Main_Page

http://sourceforge.net/projects/tappy

I (Pierre Cazenave) have made minor changes to the code to allow TAPPY to be used as a module in scripts.

Installation

TAPPY requires the astronomia, filelike and pyparsing packages which are available with pip:

pip install astronomia filelike pyparsing

TAPPY itself can be installed with setup.py:

python setup.py install

or as a non-privileged user (gets installed to ~/.local):

python setup.py install --user

Examples

The official SourceForge wiki covers the general usage of TAPPY. Given the change I made to allow the code to be imported as a module, an example of its use in that manner is useful.

import tappy

if __name__ == '__main__':

    # Load a time series to analyse
    dates = ... # a datetime.datetime list of dates
    elevation = ... # a list of surface elevation values

    # Set up the bits needed for TAPPY. This is mostly lifted from
    # tappy.py in the baker function "analysis" (around line 1721).
    quiet = True
    debug = False
    outputts = False
    outputxml = False
    ephemeris = False
    rayleigh = 1.0
    print_vau_table = False
    missing_data = 'ignore'
    linear_trend = False
    remove_extreme = False
    zero_ts = None
    filter = None
    pad_filters = None
    include_inferred = True

    if rayleigh:
        ray = float(rayleigh)

    x = tappy.tappy(
        outputts = outputts,
        outputxml = outputxml,
        quiet=quiet,
        debug=debug,
        ephemeris=ephemeris,
        rayleigh=rayleigh,
        print_vau_table=print_vau_table,
        missing_data=missing_data,
        linear_trend=linear_trend,
        remove_extreme=remove_extreme,
        zero_ts=zero_ts,
        filter=filter,
        pad_filters=pad_filters,
        include_inferred=include_inferred,
        )

    x.dates = dates
    x.elevation = elevation[:, p].tolist()
    package = x.astronomic(x.dates)
    (x.zeta, x.nu, x.nup, x.nupp, x.kap_p, x.ii, x.R, x.Q, x.T, x.jd, x.s, x.h, x.N, x.p, x.p1) = package
    (x.speed_dict, x.key_list) = x.which_constituents(len(x.dates),
            package, rayleigh_comp=ray)

    x.constituents() # the analysis

    # Print the M2 amplitude and phase.
    print('M2 phase:     {}'.format(x.phase[x.key_list.index('M2')]))
    print('M2 amplitude: {}'.format(x.r[x.key_list.index('M2')]))

tappy's People

Contributors

pwcazenave avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.