[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[THREDDS #KAL-154307]: NBM Data Set



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.