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
xarray.DataArray
'Significant_height_of_combined_wind_waves_and_swell_surface'
- time1: 285
- lat: 336
- lon: 720
- ...
[68947200 values with dtype=float32]
- lat(lat)float3290.0 89.5 89.0 ... -77.0 -77.5
- units :
- degrees_north
- _CoordinateAxisType :
- Lat
array([ 90. , 89.5, 89. , ..., -76.5, -77. , -77.5], dtype=float32)
- lon(lon)float320.0 0.5 1.0 ... 358.5 359.0 359.5
- units :
- degrees_east
- _CoordinateAxisType :
- Lon
array([ 0. , 0.5, 1. , ..., 358.5, 359. , 359.5], dtype=float32)
- time1(time1)datetime64[ns]2020-09-28 ... 2020-11-04T18:00:00
- standard_name :
- time
- long_name :
- GRIB forecast or observation time
- _CoordinateAxisType :
- Time
array(['2020-09-28T00:00:00.000000000', '2020-09-28T03:00:00.000000000', '2020-09-28T06:00:00.000000000', ..., '2020-11-04T06:00:00.000000000', '2020-11-04T12:00:00.000000000', '2020-11-04T18:00:00.000000000'], dtype='datetime64[ns]')
- reftime1(time1)datetime64[ns]...
- standard_name :
- forecast_reference_time
- long_name :
- GRIB reference time
- _CoordinateAxisType :
- RunTime
array(['2020-09-28T00:00:00.000000000', '2020-09-28T00:00:00.000000000', '2020-09-28T06:00:00.000000000', ..., '2020-10-28T06:00:00.000000000', '2020-10-28T06:00:00.000000000', '2020-10-28T06:00:00.000000000'], dtype='datetime64[ns]')
- long_name :
- Significant height of combined wind waves and swell @ Ground or water surface
- 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 and swell
- 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]: