In [1]:
%matplotlib inline
In [2]:
import numpy as np
import xarray as xr
In [3]:
import datetime as dt
from datetime import datetime, timedelta #
dayFile = datetime.now() - timedelta(days=1)
dayFile = dayFile.strftime("%Y%m%d")
url='http://nomads.ncep.noaa.gov:9090/dods/nam/nam%s/nam1hr_00z' %(dayFile)
print(url)
In [4]:
ds = xr.open_dataset(url)
In [5]:
# Specify desired station time series location
# note we add 360 because of the lon convention in this dataset
#lati = 36.605; loni = -121.85899 # west of Pacific Grove, CA
lati = 41.4; loni = -100.8 # Georges Bank
In [6]:
# extract a dataset closeste to specified point
dsloc = ds.sel(lon=loni, lat=lati, method='nearest')
In [7]:
# select a variable to plot
dsloc['dswrfsfc'].plot()
Out[7]:
In [ ]: