This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Greetings!
Here's an example using MetPy, Siphon and access using a remote access protocol:
from datetime import datetime, timedelta
import metpy
from siphon.catalog import TDSCatalog
cat =
TDSCatalog('https://thredds.ucar.edu/thredds/catalog/grib/NCEP/NBM/CONUS/catalog.xml')
ds = cat.datasets['Best National Blend of Models CONUS Grids Time Series']
# Use opendap/cdmremote
nc = ds.remote_access(use_xarray=True)
vis_1wk = nc.metpy.parse_cf('Visibility_surface')
start = datetime.utcnow()
vis_1wk.metpy.sel(time=slice(start, start + timedelta(days=7)))
This one uses the netCDF Subset Service (based on the above):
# Use NCSS
ncss = ds.subset()
query = ncss.query().variables('Visibility_surface').time_range(start,
start + timedelta(days=7)).accept('netcdf4')
nc = ncss.get_data(query)
Hope this helps!
> Yes python is the main language I am programming with. That would be great
> thanks!
>
Ticket Details
===================
Ticket ID: KAL-154307
Department: Support THREDDS
Priority: High
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata
inquiry tracking system and then made publicly available through the web. If
you do not want to have your interactions made available in this way, you must
let us know in each email you send to us.