Use xarray to extract data from NetCDF4 files on a regular web server using the fsspec HTTPFileSystem class
Note: The web server must be configured to support byte-range requests
import fsspec
import xarray as xr
import hvplot.xarray
fs = fsspec.filesystem('https')
url = 'https://geoport.usgs.esipfed.org/thredds/fileServer/vortexfs1/usgs/Projects/COAWST/2021/coawst_us_20210712_13.nc'
ds = xr.open_dataset(fs.open(url), engine='h5netcdf')
ds.temp
<xarray.DataArray 'temp' (ocean_time: 12, s_rho: 16, eta_rho: 336, xi_rho: 896)> [57802752 values with dtype=float32] Coordinates: * s_rho (s_rho) float64 -0.9688 -0.9062 -0.8438 ... -0.09375 -0.03125 lon_rho (eta_rho, xi_rho) float64 ... lat_rho (eta_rho, xi_rho) float64 ... * ocean_time (ocean_time) datetime64[ns] 2021-07-12T13:00:00 ... 2021-07-13 Dimensions without coordinates: eta_rho, xi_rho Attributes: long_name: potential temperature units: Celsius time: ocean_time grid: grid location: face field: temperature, scalar, series
[57802752 values with dtype=float32]
array([-0.96875, -0.90625, -0.84375, -0.78125, -0.71875, -0.65625, -0.59375, -0.53125, -0.46875, -0.40625, -0.34375, -0.28125, -0.21875, -0.15625, -0.09375, -0.03125])
[301056 values with dtype=float64]
[301056 values with dtype=float64]
array(['2021-07-12T13:00:00.000000000', '2021-07-12T14:00:00.000000000', '2021-07-12T15:00:00.000000000', '2021-07-12T16:00:00.000000000', '2021-07-12T17:00:00.000000000', '2021-07-12T18:00:00.000000000', '2021-07-12T19:00:00.000000000', '2021-07-12T20:00:00.000000000', '2021-07-12T21:00:00.000000000', '2021-07-12T22:00:00.000000000', '2021-07-12T23:00:00.000000000', '2021-07-13T00:00:00.000000000'], dtype='datetime64[ns]')
ds.temp.hvplot.quadmesh(x='lon_rho', y='lat_rho', geo=True, rasterize=True, tiles='OSM', cmap='turbo')