Global WaveWatch IIIΒΆ

The power of xarray and holoviz for visualizing gridded data, here accessing and visualizing the NOAA WaveWatch III global wave forecast from the Unidata THREDDS server.

Just two imports:

[1]:
import xarray as xr
import hvplot.xarray

An OPeNDAP Data URL for Global Wave Forecast Data, from the Unidata THREDDS Server:

[2]:
url = 'https://thredds.ucar.edu/thredds/dodsC/grib/NCEP/WW3/Global/Best'

We open the dataset…

[3]:
ds = xr.open_dataset(url)

Examine a variable…

[4]:
var = 'Significant_height_of_combined_wind_waves_and_swell_surface'
[5]:
ds[var]
[5]:
<xarray.DataArray 'Significant_height_of_combined_wind_waves_and_swell_surface' (time1: 285, lat: 336, lon: 720)>
[68947200 values with dtype=float32]
Coordinates:
  * lat       (lat) float32 90.0 89.5 89.0 88.5 88.0 ... -76.0 -76.5 -77.0 -77.5
  * lon       (lon) float32 0.0 0.5 1.0 1.5 2.0 ... 358.0 358.5 359.0 359.5
  * time1     (time1) datetime64[ns] 2020-09-28 ... 2020-11-04T18:00:00
    reftime1  (time1) datetime64[ns] 2020-09-28 ... 2020-10-28T06:00:00
Attributes:
    long_name:                      Significant height of combined wind waves...
    units:                          m
    abbreviation:                   HTSGW
    grid_mapping:                   LatLon_Projection
    Grib_Variable_Id:               VAR_10-0-3_L1
    Grib2_Parameter:                [10  0  3]
    Grib2_Parameter_Discipline:     Oceanographic products
    Grib2_Parameter_Category:       Waves
    Grib2_Parameter_Name:           Significant height of combined wind waves...
    Grib2_Level_Type:               1
    Grib2_Level_Desc:               Ground or water surface
    Grib2_Generating_Process_Type:  Forecast

Make a quick, interactive plot…

[6]:
ds[var][-1,:,:].hvplot(x='lon', y='lat', cmap='rainbow', rasterize=True)
[6]:

Make a projected plot, complete with coastlines and animation controls…

[7]:
import cartopy.crs as ccrs
[8]:
crs = ccrs.Orthographic(central_longitude=-70, central_latitude=30)

Select only the last 42 steps so that the first step is close to the present time

[9]:
ds[var][-42:,:,:].hvplot(x='lon', y='lat',
                            cmap='rainbow', rasterize=True, coastline=True,
                            project=True, projection=crs,
                            widget_type='scrubber', widget_location='bottom')
/srv/conda/envs/notebook/lib/python3.8/site-packages/cartopy/io/__init__.py:260: DownloadWarning: Downloading: https://naciscdn.org/naturalearth/110m/physical/ne_110m_coastline.zip
  warnings.warn('Downloading: {}'.format(url), DownloadWarning)
[9]: