wavespectra 4.4.1__tar.gz → 4.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wavespectra-4.4.2/PKG-INFO +399 -0
- wavespectra-4.4.2/README.rst +320 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/pyproject.toml +6 -2
- {wavespectra-4.4.1 → wavespectra-4.4.2}/tests/test_cli.py +3 -3
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/__init__.py +1 -1
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/construct/frequency.py +1 -1
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/core/npstats.py +1 -1
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/core/utils.py +3 -3
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/awac.py +9 -12
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/datawell.py +1 -1
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/obscape.py +0 -2
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/specarray.py +2 -2
- wavespectra-4.4.2/wavespectra.egg-info/PKG-INFO +399 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra.egg-info/requires.txt +0 -1
- wavespectra-4.4.1/PKG-INFO +0 -277
- wavespectra-4.4.1/README.rst +0 -197
- wavespectra-4.4.1/wavespectra.egg-info/PKG-INFO +0 -277
- {wavespectra-4.4.1 → wavespectra-4.4.2}/AUTHORS.rst +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/LICENSE.txt +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/setup.cfg +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/setup.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/tests/test_cookiecutter_template.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/tests/test_partition.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/tests/test_specarray.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/cli.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/construct/__init__.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/construct/direction.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/core/__init__.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/core/attributes.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/core/attributes.yml +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/core/fitting.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/core/select.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/core/swan.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/core/xrstats.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/__init__.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/dataset.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/era5.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/funwave.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/json.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/ncswan.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/ndbc.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/ndbc_ascii.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/netcdf.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/octopus.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/spotter.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/swan.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/triaxys.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/wavespectra.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/ww3.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/ww3_station.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/wwm.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/input/xwaves.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/output/__init__.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/output/funwave.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/output/json.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/output/netcdf.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/output/octopus.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/output/orcaflex.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/output/swan.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/output/ww3.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/output/ww3.yml +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/partition/__init__.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/partition/hanson_and_phillips_2001.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/partition/partition.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/partition/specpart/specpart.c +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/partition/specpart/specpart.h +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/partition/specpart/specpart_wrap.c +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/partition/tracking.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/plot.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra/specdataset.py +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra.egg-info/SOURCES.txt +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra.egg-info/dependency_links.txt +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra.egg-info/entry_points.txt +0 -0
- {wavespectra-4.4.1 → wavespectra-4.4.2}/wavespectra.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wavespectra
|
|
3
|
+
Version: 4.4.2
|
|
4
|
+
Summary: Library for ocean wave spectra
|
|
5
|
+
Author-email: Wavespectra Developers <r.guedes@oceanum.science>
|
|
6
|
+
Maintainer-email: Rafael Guedes <r.guedes@oceanum.science>, Tom Durrant <t.durrant@oceanum.science>
|
|
7
|
+
License: Copyright (c) 2018 MetOcean Solutions Ltd
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
Project-URL: Documentation, https://wavespectra.readthedocs.io/en/latest/
|
|
27
|
+
Project-URL: Source, https://github.com/wavespectra/wavespectra
|
|
28
|
+
Project-URL: Tracker, https://github.com/wavespectra/wavespectra/issues
|
|
29
|
+
Project-URL: Changelog, https://github.com/wavespectra/wavespectra/blob/master/HISTORY.rst
|
|
30
|
+
Keywords: wave,spectra,ocean,xarray,statistics,analysis
|
|
31
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
32
|
+
Classifier: Intended Audience :: Science/Research
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Natural Language :: English
|
|
35
|
+
Classifier: Operating System :: OS Independent
|
|
36
|
+
Classifier: Topic :: Scientific/Engineering
|
|
37
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
38
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
39
|
+
Classifier: Programming Language :: Python :: 3
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
43
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
44
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
45
|
+
Requires-Python: >=3.9
|
|
46
|
+
Description-Content-Type: text/x-rst
|
|
47
|
+
License-File: LICENSE.txt
|
|
48
|
+
License-File: AUTHORS.rst
|
|
49
|
+
Requires-Dist: click
|
|
50
|
+
Requires-Dist: dask
|
|
51
|
+
Requires-Dist: matplotlib
|
|
52
|
+
Requires-Dist: python-dateutil
|
|
53
|
+
Requires-Dist: pyyaml
|
|
54
|
+
Requires-Dist: sortedcontainers
|
|
55
|
+
Requires-Dist: scipy
|
|
56
|
+
Requires-Dist: xarray
|
|
57
|
+
Provides-Extra: test
|
|
58
|
+
Requires-Dist: pytest; extra == "test"
|
|
59
|
+
Requires-Dist: tox; extra == "test"
|
|
60
|
+
Requires-Dist: ruff; extra == "test"
|
|
61
|
+
Provides-Extra: extra
|
|
62
|
+
Requires-Dist: fsspec; extra == "extra"
|
|
63
|
+
Requires-Dist: gcsfs; extra == "extra"
|
|
64
|
+
Requires-Dist: h5netcdf; extra == "extra"
|
|
65
|
+
Requires-Dist: netCDF4; extra == "extra"
|
|
66
|
+
Requires-Dist: zarr; extra == "extra"
|
|
67
|
+
Provides-Extra: docs
|
|
68
|
+
Requires-Dist: cmocean; extra == "docs"
|
|
69
|
+
Requires-Dist: ipython; extra == "docs"
|
|
70
|
+
Requires-Dist: pickleshare; extra == "docs"
|
|
71
|
+
Requires-Dist: pydata_sphinx_theme; extra == "docs"
|
|
72
|
+
Requires-Dist: sphinxcontrib-programoutput; extra == "docs"
|
|
73
|
+
Requires-Dist: sphinx-book-theme; extra == "docs"
|
|
74
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
75
|
+
Requires-Dist: sphinx-autobuild; extra == "docs"
|
|
76
|
+
Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
|
|
77
|
+
Requires-Dist: sphinx-gallery; extra == "docs"
|
|
78
|
+
Dynamic: license-file
|
|
79
|
+
|
|
80
|
+
===========
|
|
81
|
+
wavespectra
|
|
82
|
+
===========
|
|
83
|
+
|
|
84
|
+
.. image:: https://deepwiki.com/badge.svg
|
|
85
|
+
:target: https://deepwiki.com/wavespectra/wavespectra
|
|
86
|
+
:alt: Ask DeepWiki
|
|
87
|
+
|
|
88
|
+
.. image:: https://zenodo.org/badge/205463939.svg
|
|
89
|
+
:target: https://zenodo.org/badge/latestdoi/205463939
|
|
90
|
+
:alt: DOI
|
|
91
|
+
|
|
92
|
+
.. image:: https://img.shields.io/github/actions/workflow/status/wavespectra/wavespectra/python-publish.yml
|
|
93
|
+
:target: https://github.com/wavespectra/wavespectra/actions
|
|
94
|
+
:alt: Build Status
|
|
95
|
+
|
|
96
|
+
.. image:: https://coveralls.io/repos/github/wavespectra/wavespectra/badge.svg?branch=master
|
|
97
|
+
:target: https://coveralls.io/github/wavespectra/wavespectra?branch=master
|
|
98
|
+
:alt: Coverage
|
|
99
|
+
|
|
100
|
+
.. image:: https://readthedocs.org/projects/wavespectra/badge/?version=latest
|
|
101
|
+
:target: https://wavespectra.readthedocs.io/en/latest/
|
|
102
|
+
:alt: Documentation
|
|
103
|
+
|
|
104
|
+
.. image:: https://img.shields.io/pypi/v/wavespectra.svg
|
|
105
|
+
:target: https://pypi.org/project/wavespectra/
|
|
106
|
+
:alt: PyPI
|
|
107
|
+
|
|
108
|
+
.. image:: https://img.shields.io/pypi/dm/wavespectra
|
|
109
|
+
:target: https://pypistats.org/packages/wavespectra
|
|
110
|
+
:alt: Downloads
|
|
111
|
+
|
|
112
|
+
.. image:: https://anaconda.org/conda-forge/wavespectra/badges/version.svg
|
|
113
|
+
:target: https://anaconda.org/conda-forge/wavespectra
|
|
114
|
+
:alt: Conda
|
|
115
|
+
|
|
116
|
+
.. image:: https://img.shields.io/pypi/pyversions/wavespectra
|
|
117
|
+
:target: https://pypi.org/project/wavespectra/
|
|
118
|
+
:alt: Python
|
|
119
|
+
|
|
120
|
+
**Python library for ocean wave spectral data analysis and processing**
|
|
121
|
+
|
|
122
|
+
Wavespectra is a powerful, open-source Python library built on top of `xarray`_ for working with ocean wave spectral data. It provides comprehensive tools for reading, analysing, manipulating, and visualising wave spectra from various sources including numerical models and buoy observations.
|
|
123
|
+
|
|
124
|
+
.. _xarray: https://xarray.pydata.org/
|
|
125
|
+
|
|
126
|
+
Key Features
|
|
127
|
+
============
|
|
128
|
+
|
|
129
|
+
- **Unified Data Model**: Built on xarray with standardised conventions for wave spectral data
|
|
130
|
+
- **Extensive I/O Support**: Read/write 15+ formats including WW3, SWAN, ERA5, NDBC, and more
|
|
131
|
+
- **Rich Analysis Tools**: 60+ methods for wave parameter calculation and spectral transformations
|
|
132
|
+
- **Spectral Partitioning**: Separate wind sea and swell using multiple algorithms (PTM1-5, watershed, wave age)
|
|
133
|
+
- **Spectral Construction**: Create synthetic spectra using parametric forms (JONSWAP, TMA, Gaussian, Pierson-Moskowitz)
|
|
134
|
+
- **Flexible Visualisation**: Polar spectral plots with matplotlib integration
|
|
135
|
+
- **High Performance**: Leverages dask for efficient processing of large datasets
|
|
136
|
+
- **Extensible**: Plugin architecture for custom readers and analysis methods
|
|
137
|
+
|
|
138
|
+
Quick Start
|
|
139
|
+
===========
|
|
140
|
+
|
|
141
|
+
Installation
|
|
142
|
+
------------
|
|
143
|
+
|
|
144
|
+
Install from PyPI:
|
|
145
|
+
|
|
146
|
+
.. code-block:: console
|
|
147
|
+
|
|
148
|
+
# Basic installation
|
|
149
|
+
$ pip install wavespectra
|
|
150
|
+
|
|
151
|
+
# Full installation with all optional dependencies
|
|
152
|
+
$ pip install wavespectra[extra]
|
|
153
|
+
|
|
154
|
+
Or from conda-forge:
|
|
155
|
+
|
|
156
|
+
.. code-block:: console
|
|
157
|
+
|
|
158
|
+
$ conda install -c conda-forge wavespectra
|
|
159
|
+
|
|
160
|
+
Basic Usage
|
|
161
|
+
-----------
|
|
162
|
+
|
|
163
|
+
.. code-block:: python
|
|
164
|
+
|
|
165
|
+
import xarray as xr
|
|
166
|
+
from wavespectra import read_swan
|
|
167
|
+
|
|
168
|
+
# Read wave spectra from various formats
|
|
169
|
+
dset = read_swan("spectra.swn") # SWAN format
|
|
170
|
+
# dset = xr.open_dataset("era5.nc", engine="era5") # ERA5 reanalysis
|
|
171
|
+
# dset = xr.open_dataset("ww3.nc", engine="ww3") # WAVEWATCH III
|
|
172
|
+
|
|
173
|
+
# Calculate wave parameters
|
|
174
|
+
hs = dset.spec.hs() # Significant wave height
|
|
175
|
+
tp = dset.spec.tp() # Peak period
|
|
176
|
+
dm = dset.spec.dm() # Mean direction
|
|
177
|
+
dspr = dset.spec.dspr() # Directional spreading
|
|
178
|
+
|
|
179
|
+
# Multiple parameters at once
|
|
180
|
+
stats = dset.spec.stats(["hs", "tp", "dm", "dspr"])
|
|
181
|
+
|
|
182
|
+
# Spectral transformations
|
|
183
|
+
spectrum_1d = dset.spec.oned() # Convert to 1D
|
|
184
|
+
subset = dset.spec.split(fmin=0.05, fmax=0.5) # Frequency subset
|
|
185
|
+
rotated = dset.spec.rotate(angle=15) # Rotate directions
|
|
186
|
+
interpolated = dset.spec.interp(freq=new_freq) # Interpolate
|
|
187
|
+
|
|
188
|
+
# Visualisation
|
|
189
|
+
dset.spec.plot(kind="contourf", figsize=(8, 6)) # Polar plot
|
|
190
|
+
|
|
191
|
+
Working with Different Data Sources
|
|
192
|
+
-----------------------------------
|
|
193
|
+
|
|
194
|
+
.. code-block:: python
|
|
195
|
+
|
|
196
|
+
# Numerical model outputs
|
|
197
|
+
ww3_data = xr.open_dataset("ww3_output.nc", engine="ww3")
|
|
198
|
+
swan_data = read_swan("swan_output.swn")
|
|
199
|
+
era5_data = xr.open_dataset("era5_waves.nc", engine="era5")
|
|
200
|
+
|
|
201
|
+
# Buoy observations
|
|
202
|
+
ndbc_data = xr.open_dataset("ndbc_data.nc", engine="ndbc")
|
|
203
|
+
triaxys_data = xr.open_dataset("triaxys.nc", engine="triaxys")
|
|
204
|
+
|
|
205
|
+
# All use the same analysis interface
|
|
206
|
+
for dataset in [ww3_data, swan_data, era5_data]:
|
|
207
|
+
hs = dataset.spec.hs()
|
|
208
|
+
tp = dataset.spec.tp()
|
|
209
|
+
|
|
210
|
+
Advanced Analysis
|
|
211
|
+
-----------------
|
|
212
|
+
|
|
213
|
+
Spectral Partitioning
|
|
214
|
+
~~~~~~~~~~~~~~~~~~~~~
|
|
215
|
+
|
|
216
|
+
Separate spectra into wind sea and swell components using various methods:
|
|
217
|
+
|
|
218
|
+
.. code-block:: python
|
|
219
|
+
|
|
220
|
+
# PTM1: Watershed partitioning with wind sea identification
|
|
221
|
+
partitions = dset.spec.partition.ptm1(
|
|
222
|
+
wspd=dset.wspd, wdir=dset.wdir, dpt=dset.dpt, swells=2
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
# PTM3: Simple ordering by wave height (no wind/depth needed)
|
|
226
|
+
partitions = dset.spec.partition.ptm3(parts=3)
|
|
227
|
+
|
|
228
|
+
# PTM4: Wave age criterion to separate wind sea from swell
|
|
229
|
+
partitions = dset.spec.partition.ptm4(
|
|
230
|
+
wspd=dset.wspd, wdir=dset.wdir, dpt=dset.dpt, agefac=1.7
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
# PTM1_TRACK: Track partitions from unique wave systems over time
|
|
234
|
+
# Useful for following the evolution of individual swell events
|
|
235
|
+
partitions = dset.spec.partition.ptm1_track(
|
|
236
|
+
wspd=dset.wspd, wdir=dset.wdir, dpt=dset.dpt, swells=2
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
Spectral Construction
|
|
240
|
+
~~~~~~~~~~~~~~~~~~~~~
|
|
241
|
+
|
|
242
|
+
Create synthetic spectra from parametric forms:
|
|
243
|
+
|
|
244
|
+
.. code-block:: python
|
|
245
|
+
|
|
246
|
+
from wavespectra.construct.frequency import jonswap, tma, gaussian
|
|
247
|
+
from wavespectra.construct.direction import cartwright
|
|
248
|
+
from wavespectra.construct import construct_partition
|
|
249
|
+
|
|
250
|
+
# Create JONSWAP spectrum for developing seas
|
|
251
|
+
freq = np.arange(0.03, 0.4, 0.01)
|
|
252
|
+
spectrum = jonswap(freq=freq, hs=2.5, fp=0.1, gamma=3.3)
|
|
253
|
+
|
|
254
|
+
# Create TMA spectrum for finite depth
|
|
255
|
+
spectrum_shallow = tma(freq=freq, hs=2.0, fp=0.1, dep=15)
|
|
256
|
+
|
|
257
|
+
# Create 2D spectrum by combining frequency and directional components
|
|
258
|
+
dir = np.arange(0, 360, 10)
|
|
259
|
+
spectrum_2d = jonswap(freq=freq, hs=2.5, fp=0.1) * cartwright(dir=dir, dm=270, dspr=30)
|
|
260
|
+
|
|
261
|
+
# Or use construct_partition for a complete 2D spectrum
|
|
262
|
+
spectrum_2d = construct_partition(
|
|
263
|
+
freq_name="jonswap",
|
|
264
|
+
dir_name="cartwright",
|
|
265
|
+
freq_kwargs={"freq": freq, "hs": 2.5, "fp": 0.1, "gamma": 3.3},
|
|
266
|
+
dir_kwargs={"dir": dir, "dm": 270, "dspr": 30}
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
Spectral Fitting
|
|
270
|
+
~~~~~~~~~~~~~~~~
|
|
271
|
+
|
|
272
|
+
.. code-block:: python
|
|
273
|
+
|
|
274
|
+
# Fit parametric forms to existing spectra
|
|
275
|
+
jonswap_params = dset.spec.fit_jonswap() # Fit JONSWAP spectrum
|
|
276
|
+
|
|
277
|
+
Wave Physics
|
|
278
|
+
~~~~~~~~~~~~
|
|
279
|
+
|
|
280
|
+
.. code-block:: python
|
|
281
|
+
|
|
282
|
+
# Calculate wave physics parameters
|
|
283
|
+
celerity = dset.spec.celerity(depth=50) # Wave speed
|
|
284
|
+
wavelength = dset.spec.wavelen(depth=50) # Wavelength
|
|
285
|
+
stokes_drift = dset.spec.uss() # Stokes drift
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
Data Requirements
|
|
289
|
+
=================
|
|
290
|
+
|
|
291
|
+
Wavespectra expects xarray objects with specific coordinate and variable naming:
|
|
292
|
+
|
|
293
|
+
**Required coordinates:**
|
|
294
|
+
|
|
295
|
+
- ``freq``: Wave frequency in Hz
|
|
296
|
+
- ``dir``: Wave direction in degrees (for 2D spectra)
|
|
297
|
+
|
|
298
|
+
**Required variables:**
|
|
299
|
+
|
|
300
|
+
- ``efth``: Wave energy density in m²/Hz/degree (2D) or m²/Hz (1D)
|
|
301
|
+
|
|
302
|
+
**Optional variables:**
|
|
303
|
+
|
|
304
|
+
- ``wspd``: Wind speed in m/s
|
|
305
|
+
- ``wdir``: Wind direction in degrees
|
|
306
|
+
- ``dpt``: Water depth in metres
|
|
307
|
+
|
|
308
|
+
Supported Formats
|
|
309
|
+
=================
|
|
310
|
+
|
|
311
|
+
Input and Output Formats
|
|
312
|
+
------------------------
|
|
313
|
+
|
|
314
|
+
- **Wave Models**: WAVEWATCH III, SWAN, WWM, FUNWAVE, OrcaFlex
|
|
315
|
+
- **Reanalysis**: ERA5, ERA-Interim, ECMWF
|
|
316
|
+
- **Observations**: NDBC, TRIAXYS, Spotter, Octopus, AWAC
|
|
317
|
+
- **Generic**: NetCDF, JSON, CSV
|
|
318
|
+
|
|
319
|
+
Documentation
|
|
320
|
+
=============
|
|
321
|
+
|
|
322
|
+
Full documentation is available at `wavespectra.readthedocs.io`_
|
|
323
|
+
|
|
324
|
+
- `Installation Guide`_
|
|
325
|
+
- `Quick Start Tutorial`_
|
|
326
|
+
- `Spectral Construction`_
|
|
327
|
+
- `API Reference`_
|
|
328
|
+
- `Example Gallery`_
|
|
329
|
+
|
|
330
|
+
.. _wavespectra.readthedocs.io: https://wavespectra.readthedocs.io/en/latest/
|
|
331
|
+
.. _Installation Guide: https://wavespectra.readthedocs.io/en/latest/install.html
|
|
332
|
+
.. _Quick Start Tutorial: https://wavespectra.readthedocs.io/en/latest/quickstart.html
|
|
333
|
+
.. _Spectral Construction: https://wavespectra.readthedocs.io/en/latest/construction.html
|
|
334
|
+
.. _API Reference: https://wavespectra.readthedocs.io/en/latest/api.html
|
|
335
|
+
.. _Example Gallery: https://wavespectra.readthedocs.io/en/latest/gallery.html
|
|
336
|
+
|
|
337
|
+
Development
|
|
338
|
+
===========
|
|
339
|
+
|
|
340
|
+
Contributing
|
|
341
|
+
------------
|
|
342
|
+
|
|
343
|
+
We welcome contributions! Please see our `Contributing Guide`_ for details.
|
|
344
|
+
|
|
345
|
+
.. _Contributing Guide: https://wavespectra.readthedocs.io/en/latest/contributing.html
|
|
346
|
+
|
|
347
|
+
Development Installation
|
|
348
|
+
------------------------
|
|
349
|
+
|
|
350
|
+
.. code-block:: console
|
|
351
|
+
|
|
352
|
+
$ git clone https://github.com/wavespectra/wavespectra.git
|
|
353
|
+
$ cd wavespectra
|
|
354
|
+
$ pip install -e .[extra,test,docs]
|
|
355
|
+
|
|
356
|
+
Running Tests
|
|
357
|
+
-------------
|
|
358
|
+
|
|
359
|
+
.. code-block:: console
|
|
360
|
+
|
|
361
|
+
$ pytest tests
|
|
362
|
+
|
|
363
|
+
Building Documentation
|
|
364
|
+
----------------------
|
|
365
|
+
|
|
366
|
+
.. code-block:: console
|
|
367
|
+
|
|
368
|
+
$ make docs
|
|
369
|
+
|
|
370
|
+
Citation
|
|
371
|
+
========
|
|
372
|
+
|
|
373
|
+
If you use wavespectra in your research, please cite:
|
|
374
|
+
|
|
375
|
+
.. code-block:: bibtex
|
|
376
|
+
|
|
377
|
+
@software{wavespectra,
|
|
378
|
+
author = {Guedes, Rafael and Durrant, Tom and de Bruin, Ruben and Perez, Jorge and Iannucci, Matthew and Delaux, Sebastien and Harrington, John and others},
|
|
379
|
+
title = {wavespectra: Python library for ocean wave spectral data},
|
|
380
|
+
url = {https://github.com/wavespectra/wavespectra},
|
|
381
|
+
doi = {10.5281/zenodo.15238968}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
Licence
|
|
385
|
+
=======
|
|
386
|
+
|
|
387
|
+
This project is licenced under the MIT Licence - see the `LICENSE`_ file for details.
|
|
388
|
+
|
|
389
|
+
.. _LICENSE: LICENSE.txt
|
|
390
|
+
|
|
391
|
+
Support
|
|
392
|
+
=======
|
|
393
|
+
|
|
394
|
+
- **Documentation**: `wavespectra.readthedocs.io`_
|
|
395
|
+
- **Issues**: `GitHub Issues`_
|
|
396
|
+
- **Discussions**: `GitHub Discussions`_
|
|
397
|
+
|
|
398
|
+
.. _GitHub Issues: https://github.com/wavespectra/wavespectra/issues
|
|
399
|
+
.. _GitHub Discussions: https://github.com/wavespectra/wavespectra/discussions
|