Fetch WaveWatch3 data.
Project description
WAVEWATCH III data in Python
About
The bmi_wavewatch3 Python package provides both a command line interface and a programming interface for downloading and working with WAVEWATCH III data.
bmi_wavewatch3 provides access to the following raster data sources,
30 year wave hindcast Phase 1
30 year wave hindcast Phase 2
Production hindcast Singlegrid
Production hindcast Multigrid
All data sources provide both global and regional grids.
Installation
bmi_wavewatch3 can be installed by running pip install bmi-wavewatch3. It requires Python >= 3.8 to run.
If you simply can’t wait for the latest release, you can install bmi_wavewatch3 directly from GitHub,
$ pip install git+https://github.com/csdms/bmi-wavewatch3
bmi_wavewatch3 is also available through conda, conda install bmi-wavewatch3 -c conda-forge.
Usage
To get started, you can download WAVEWATCH III data by date with the ww3 command (use ww3 –help to print a brief message),
$ ww3 fetch "2010-05-22"
You can also do this through Python,
>>> from bmi_wavewatch3 import WaveWatch3
>>> WaveWatch3.fetch("2010-05-22")
The bmi_wavewatch3 package provides the WaveWatch3 class for downloading data and presenting it as an xarray Dataset.
>>> from bmi_wavewatch3 import WaveWatch3
>>> ww3 = WaveWatch3("2010-05-22")
>>> ww3.data
<xarray.Dataset>
...
Use the inc method to advance in time month-by-month,
>>> ww3.date
'2010-05-22'
>>> ww3.inc()
'2010-06-22'
>>> ww3.data.time
<xarray.DataArray 'time' ()>
array('2010-06-01T00:00:00.000000000', dtype='datetime64[ns]')
...
This will download new datasets as necessary and load the new data into the data attribute.
Example
>>> from bmi_wavewatch3 import WaveWatch3
>>> ww3 = WaveWatch3("2009-11-08")
The data can be accessed as an xarray Dataset through the data attribute.
>>> ww3.data
<xarray.Dataset>
Dimensions: (step: 241, latitude: 311, longitude: 720)
Coordinates:
time datetime64[ns] 2009-11-01
* step (step) timedelta64[ns] 0 days 00:00:00 ... 30 days 00:00:00
surface float64 1.0
* latitude (latitude) float64 77.5 77.0 76.5 76.0 ... -76.5 -77.0 -77.5
* longitude (longitude) float64 0.0 0.5 1.0 1.5 ... 358.0 358.5 359.0 359.5
valid_time (step) datetime64[ns] dask.array<chunksize=(241,), meta=np.ndarray>
Data variables:
dirpw (step, latitude, longitude) float32 dask.array<chunksize=(241, 311, 720), meta=np.ndarray>
perpw (step, latitude, longitude) float32 dask.array<chunksize=(241, 311, 720), meta=np.ndarray>
swh (step, latitude, longitude) float32 dask.array<chunksize=(241, 311, 720), meta=np.ndarray>
u (step, latitude, longitude) float32 dask.array<chunksize=(241, 311, 720), meta=np.ndarray>
v (step, latitude, longitude) float32 dask.array<chunksize=(241, 311, 720), meta=np.ndarray>
Attributes:
GRIB_edition: 2
GRIB_centre: kwbc
GRIB_centreDescription: US National Weather Service - NCEP
GRIB_subCentre: 0
Conventions: CF-1.7
institution: US National Weather Service - NCEP
history: 2022-06-08T16:08 GRIB to CDM+CF via cfgrib-0.9.1...
The step attribute points to the current time slice into the data (i.e number of three hour increments since the start of the month),
>>> ww3.step
56
>>> ww3.data.swh[ww3.step, :, :].plot()
Credits
Development Lead
Eric Hutton (@mcflugen)
Contributors
None yet. Why not be the first?
0.1.0b2 (unreleased)
Nothing changed yet.
0.1.0b1 (2022-06-09)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for bmi-wavewatch3-0.1.0b3.dev0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d47fa6728e6548175806983297893a600f5f21bf5c857622bbda478fef7798a1 |
|
MD5 | 722277705332ad61363d1e37d13c1ff2 |
|
BLAKE2b-256 | 4b002c0ae6ec066c50b296562ea7f5236e74491d3e379aa79639beed4726bece |