wavespectra

Library for ocean wave spectra

https://github.com/wavespectra/wavespectra

Science Score: 46.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    2 of 20 committers (10.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.0%) to scientific vocabulary

Keywords

ocean python spectra statistics wave xarray

Keywords from Contributors

interactive projection unitful mesh optim embedded genomics observability autograding hacking
Last synced: 6 months ago · JSON representation

Repository

Library for ocean wave spectra

Basic Info
Statistics
  • Stars: 83
  • Watchers: 12
  • Forks: 33
  • Open Issues: 13
  • Releases: 22
Topics
ocean python spectra statistics wave xarray
Created over 6 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Support Authors

README.rst

wavespectra
===========
Python library for ocean wave spectra.

.. image:: https://zenodo.org/badge/205463939.svg
   :target: https://zenodo.org/badge/latestdoi/205463939
.. image:: https://img.shields.io/github/actions/workflow/status/wavespectra/wavespectra/python-publish.yml
    :target: https://github.com/wavespectra/wavespectra/actions
    :alt: GitHub Workflow Status (with event)
.. image:: https://coveralls.io/repos/github/wavespectra/wavespectra/badge.svg?branch=master
    :target: https://coveralls.io/github/wavespectra/wavespectra?branch=master
.. image:: https://readthedocs.org/projects/wavespectra/badge/?version=latest
    :target: https://wavespectra.readthedocs.io/en/latest/
.. image:: https://img.shields.io/pypi/v/wavespectra.svg
    :target: https://pypi.org/project/wavespectra/
.. image:: https://img.shields.io/pypi/dm/wavespectra
    :target: https://pypistats.org/packages/wavespectra
    :alt: PyPI - Downloads
.. image:: https://anaconda.org/conda-forge/wavespectra/badges/version.svg
    :target: https://anaconda.org/conda-forge/wavespectra
.. image:: https://anaconda.org/conda-forge/wavespectra/badges/platforms.svg
    :target: https://anaconda.org/conda-forge/wavespectra
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/python/black
.. image:: https://img.shields.io/pypi/pyversions/wavespectra
    :target: https://pypi.org/project/wavespectra/
    :alt: PyPI - Python Version

Main contents:
--------------
* SpecArray_: extends xarray's `DataArray`_ with methods to manipulate wave spectra and calculate spectral statistics.
* SpecDataset_: wrapper around `SpecArray`_ with methods for selecting and saving spectra in different formats.

Documentation:
--------------
The documentation is hosted on ReadTheDocs at https://wavespectra.readthedocs.io/en/latest/.

Install:
--------
Where to get it
~~~~~~~~~~~~~~~
The source code is currently hosted on GitHub at: https://github.com/wavespectra/wavespectra

Binary installers for the latest released version are available at the `Python package index`_.

Install from pypi
~~~~~~~~~~~~~~~~~
.. code:: bash

   # Default install, miss some dependencies and functionality
   pip install wavespectra

   # Complete install
   pip install wavespectra[extra]

Install from conda
~~~~~~~~~~~~~~~~~~~
.. code:: bash

    # wavespectra is available in the conda-forge channel
    conda install -c conda-forge wavespectra

Install from sources
~~~~~~~~~~~~~~~~~~~~
Install requirements. Navigate to the base root of wavespectra_ and execute:

.. code:: bash

   # Default install, miss some dependencies and functionality
   pip install -r requirements/default.txt

   # Also, for complete install
   pip install -r requirements/extra.txt

Then install wavespectra:

.. code:: bash

   python setup.py install

   # Run pytest integration
   python setup.py test

Alternatively, to install in `development mode`_:

.. code:: bash

   pip install -e .

Code structure:
---------------
The two main classes SpecArray_ and SpecDataset_ are defined as `xarray accessors`_. The accessors are registered on xarray's DataArray_ and Dataset_ respectively as a new namespace called `spec`.

To use methods in the accessor classes simply import the classes into your code and they will be available to your xarray.Dataset or xarray.DataArray instances through the `spec` attribute, e.g.

.. code:: python

   import datetime
   import numpy as np
   import xarray as xr

   from wavespectra.specarray import SpecArray
   from wavespectra.specdataset import SpecDataset

   coords = {'time': [datetime.datetime(2017,01,n+1) for n in range(2)],
             'freq': [0.05,0.1],
             'dir': np.arange(0,360,120)}
   efth = xr.DataArray(data=np.random.rand(2,2,3),
                       coords=coords,
                       dims=('time','freq', 'dir'),
                       name='efth')

   In [1]: efth
   Out[1]:
   
   array([[[ 0.100607,  0.328229,  0.332708],
           [ 0.532   ,  0.665938,  0.177731]],

          [[ 0.469371,  0.002963,  0.627179],
           [ 0.004523,  0.682717,  0.09766 ]]])
   Coordinates:
     * freq     (freq) float64 0.05 0.1
     * dir      (dir) int64 0 120 240
     * time     (time) datetime64[ns] 2017-01-01 2017-01-02

   In [2]: efth.spec
   Out[2]:
   
   array([[[ 0.100607,  0.328229,  0.332708],
           [ 0.532   ,  0.665938,  0.177731]],

          [[ 0.469371,  0.002963,  0.627179],
           [ 0.004523,  0.682717,  0.09766 ]]])
   Coordinates:
     * freq     (freq) float64 0.05 0.1
     * dir      (dir) int64 0 120 240
     * time     (time) datetime64[ns] 2017-01-01 2017-01-02

   In [3]: efth.spec.hs()
   Out[3]:
   
   array([ 10.128485,   9.510618])
   Coordinates:
     * time     (time) datetime64[ns] 2017-01-01 2017-01-02
   Attributes:
       standard_name: sea_surface_wave_significant_height
       units: m

SpecDataset provides a wrapper around the methods in SpecArray. For instance, these produce same result:

.. code:: python

   In [4]: dset = efth.to_dataset(name='efth')

   In [5]: tm01 = dset.spec.tm01()

   In [6]: tm01.identical(dset.efth.spec.tm01())
   Out[6]: True

Data requirements:
------------------

SpecArray_ methods require DataArray_ to have the following attributes:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- wave frequency coordinate in `Hz` named as `freq` (required).
- wave frequency coordinate in `Hz` named as `freq` (required).
- wave direction coordinate in `degree` (coming from) named as `dir` (optional for 1D, required for 2D spectra).
- wave energy density data in `m2/Hz/degree` (2D) or `m2/Hz` (1D) named as `efth`

SpecDataset_ methods require xarray's Dataset_ to have the following attributes:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- spectra DataArray named as `efth`, complying with the above specifications

Examples:
---------

Define and plot spectra history from example SWAN_ spectra file:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

   from wavespectra import read_swan

   dset = read_swan('/source/wavespectra/tests/manus.spec')
   spec_hist = dset.isel(lat=0, lon=0).sel(freq=slice(0.05,0.2)).spec.oned().T
   spec_hist.plot.contourf(levels=10)

.. _SpecArray: https://github.com/wavespectra/wavespectra/blob/master/wavespectra/specarray.py
.. _SpecDataset: https://github.com/wavespectra/wavespectra/blob/master/wavespectra/specdataset.py
.. _DataArray: http://xarray.pydata.org/en/stable/generated/xarray.DataArray.html
.. _Dataset: http://xarray.pydata.org/en/stable/generated/xarray.Dataset.html
.. _readspec: https://github.com/wavespectra/wavespectra/blob/master/wavespectra/readspec.py
.. _xarray accessors: http://xarray.pydata.org/en/stable/internals.html?highlight=accessor
.. _SWAN: http://swanmodel.sourceforge.net/online_doc/swanuse/node50.html
.. _Python package index: https://pypi.python.org/pypi/wavespectra
.. _wavespectra: https://github.com/wavespectra/wavespectra
.. _development mode: https://pip.pypa.io/en/latest/reference/pip_install/#editable-installs

Owner

  • Name: Wavespectra
  • Login: wavespectra
  • Kind: organization

Libraries for ocean wave spectra

GitHub Events

Total
  • Create event: 11
  • Issues event: 11
  • Release event: 5
  • Watch event: 11
  • Delete event: 8
  • Issue comment event: 33
  • Push event: 23
  • Pull request review event: 2
  • Pull request review comment event: 2
  • Pull request event: 7
  • Fork event: 4
Last Year
  • Create event: 11
  • Issues event: 11
  • Release event: 5
  • Watch event: 11
  • Delete event: 8
  • Issue comment event: 33
  • Push event: 23
  • Pull request review event: 2
  • Pull request review comment event: 2
  • Pull request event: 7
  • Fork event: 4

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 1,524
  • Total Committers: 20
  • Avg Commits per committer: 76.2
  • Development Distribution Score (DDS): 0.11
Past Year
  • Commits: 175
  • Committers: 6
  • Avg Commits per committer: 29.167
  • Development Distribution Score (DDS): 0.091
Top Committers
Name Email Commits
Rafael Guedes r****s@o****e 1,356
Tom Durrant t****t@g****m 34
Ruben de Bruin 3****n 29
metocean-jorge.perez j****z@m****z 24
d.johnson@metocean.co.nz d****n@m****z 18
Matthew Iannucci m****i@g****m 17
Sebastien Delaux s****x@o****e 11
John Harrington j****n@j****m 7
Ryan Coe r****e@s****v 6
Paul Branson p****n@c****u 6
Dave d****n@o****e 4
Henrique Rapizo h****o@m****z 2
dependabot[bot] 4****] 2
Ruben de Bruin r****n@h****m 2
Murex93 s****n@l****a 1
Spicer Bak 8****F 1
cmichelenstrofer c****l@s****v 1
gregchalmers g****s@m****z 1
Color Code c****e@l****m 1
lubyant b****8@w****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 90
  • Total pull requests: 56
  • Average time to close issues: 7 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 37
  • Total pull request authors: 12
  • Average comments per issue: 2.44
  • Average comments per pull request: 1.64
  • Merged pull requests: 49
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 9
  • Pull requests: 6
  • Average time to close issues: 2 days
  • Average time to close pull requests: 9 days
  • Issue authors: 9
  • Pull request authors: 3
  • Average comments per issue: 1.22
  • Average comments per pull request: 1.5
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • rafa-guedes (28)
  • RubendeBruin (8)
  • Taddei-S (4)
  • guin0x (4)
  • ryancoe (4)
  • LWCAO (2)
  • tomdurrant (2)
  • DrakonianMight (2)
  • cmichelenstrofer (2)
  • salman451 (2)
  • michaelcdevin (1)
  • lubyant (1)
  • Murex93 (1)
  • dpzimmer (1)
  • mjr994 (1)
Pull Request Authors
  • rafa-guedes (35)
  • RubendeBruin (14)
  • seboceanum (4)
  • JohnCHarrington (3)
  • tomdurrant (3)
  • lubyant (2)
  • dependabot[bot] (2)
  • Murex93 (2)
  • cmichelenstrofer (1)
  • mpiannucci (1)
  • ryancoe (1)
  • davemetocean (1)
Top Labels
Issue Labels
enhancement (11) bug (5) help wanted (5) testing (2) dependencies (2) documentation (1) question (1)
Pull Request Labels
dependencies (2) enhancement (1)

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 1,285 last-month
  • Total docker downloads: 122
  • Total dependent packages: 3
    (may contain duplicates)
  • Total dependent repositories: 6
    (may contain duplicates)
  • Total versions: 103
  • Total maintainers: 1
proxy.golang.org: github.com/wavespectra/wavespectra
  • Versions: 40
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
pypi.org: wavespectra

Library for ocean wave spectra

  • Documentation: https://wavespectra.readthedocs.io/en/latest/
  • License: Copyright (c) 2018 MetOcean Solutions Ltd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 4.4.1
    published 10 months ago
  • Versions: 58
  • Dependent Packages: 2
  • Dependent Repositories: 5
  • Downloads: 1,285 Last month
  • Docker Downloads: 122
Rankings
Docker downloads count: 2.6%
Dependent packages count: 4.8%
Dependent repos count: 6.6%
Average: 7.1%
Forks count: 8.4%
Stargazers count: 9.8%
Downloads: 10.2%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: wavespectra

Wavespectra is an open source project for working with ocean wave spectral data. The library is built on top of xarray, leveraging from xarray’s labelled multi-dimensional arrays and making dealing with wave spectra simple and fast..

  • Versions: 5
  • Dependent Packages: 1
  • Dependent Repositories: 1
Rankings
Dependent repos count: 24.4%
Dependent packages count: 29.0%
Average: 34.6%
Forks count: 40.2%
Stargazers count: 44.7%
Last synced: 6 months ago

Dependencies

setup.py pypi
  • attrdict *
  • click *
  • cmocean *
  • dask *
  • hypothesis *
  • matplotlib *
  • numba *
  • numpy <=1.21
  • pandas *
  • python-dateutil *
  • pyyaml *
  • scipy *
  • sortedcontainers *
  • toolz *
  • xarray *
.github/workflows/python-publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • pypa/gh-action-pypi-publish v1.6.4 composite
pyproject.toml pypi
  • click *
  • cmocean *
  • dask *
  • matplotlib *
  • numba *
  • numpy *
  • pandas *
  • python-dateutil *
  • pyyaml *
  • scipy *
  • sortedcontainers *
  • toolz *
  • typing_extensions *
  • xarray *
Dockerfile docker
  • ubuntu 22.04 build