I would like to extract a spatial subset of a rather large netcdf file. From Loop through netcdf files and run calculations - Python or R
from pylab import *
import netCDF4
f = netCDF4.MFDataset('/usgs/data2/rsignell/models/ncep/narr/air.2m.1989.nc')
# print variables
f.variables.keys()
atemp = f.variables['air'] # TODO: extract spatial subset
How do I extract just the subset of netcdf file corresponding to a state (say Iowa). Iowa has following boundary lat lon:
Longitude: 89° 5' W to 96° 31' W
Latitude: 40° 36' N to 43° 30' N