Closed ginandtronic closed 7 years ago
>>> from netCDF4 import Dataset
>>> >>> URL="http://nomads.ncdc.noaa.gov/thredds/dodsC/gfs-003/201608/20160831/gfs_3_20160831_1800_384.grb"
>>> nc = Dataset(URL)
>>> nc
<type 'netCDF4._netCDF4.Dataset'>
root group (NETCDF3_CLASSIC data model, file format DAP2):
Conventions: CF-1.4
Originating_center: US National Weather Service - NCEP(WMC) (7)
Generating_Model: Global Forecast System Model (formerly known as the Aviation)
Product_Type: product valid at reference time P1
title: US National Weather Service - NCEP(WMC) Global Forecast System Model (formerly known as the Aviation) product valid at reference time P1
institution: Center US National Weather Service - NCEP(WMC) (7)
source: product valid at reference time P1
history: Direct read of GRIB-1 into NetCDF-Java 4 API
CF%3afeature_type: GRID
file_format: GRIB-1
location: /nomads3_data/raid2/noaaport/merged/gfs-hi/201608/20160831/gfs_3_20160831_1800_384.grb
_CoordinateModelRunDate: 2016-08-31T18:00:00Z
Thanks @jswhit
I'm still getting the error below?? Here is my file https://www.dropbox.com/s/2mktr2dj8vjs0h8/WIND.py?dl=0
`KeyError Traceback (most recent call last)
/tmp/tmpK3KPGu.py in
KeyError: 'Pressure_msl' `
Apparently the variable is now called 'Pressure_reduced_to_MSL'. You can see this by looking at the keys of the data.variables dictionary.
Excellent thanks very much
Also changed the below
slpin = 0.01*data.variables['Pressure_msl'][:].squeeze()
uin = data.variables['U-component_of_wind_height_above_ground'][:].squeeze()
vin = data.variables['V-component_of_wind_height_above_ground'][:].squeeze()
to
slpin = 0.01*data.variables['Pressure_reduced_to_MSL'][:].squeeze() uin = data.variables['u-component_of_storm_motion'][:].squeeze() vin = data.variables['v-component_of_storm_motion'][:].squeeze()
Hi id like to plot the latest forecast data from here http://nomads.ncdc.noaa.gov/thredds/catalog/gfs-003/catalog.html
Using this http://matplotlib.org/basemap/users/figures/plotwindvec.py but dont understand how to point to the file??
`# specify date to plot. yyyy=1993; mm=03; dd=14; hh=00 date = datetime.datetime(yyyy,mm,dd,hh)
set OpenDAP server URL.
URLbase="http://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cmd_pgbh/" URL=URLbase+"%04i/%04i%02i/%04i%02i%02i/pgbh00.gdas.%04i%02i%02i%02i.grb2" %\ (yyyy,yyyy,mm,yyyy,mm,dd,yyyy,mm,dd,hh)`