0
在這部分代碼中,我定義了一個函數來對感興趣的區域進行子集。但是,我想在後面的另一個函數中使用變量latselect和lonselect。所以,我有:我如何評估一個局部變量函數?
def DatasetToSubset(file, LatUpbound, LatLowBound, LonUpBound, LonLowBound):
nc=netCDF4.Dataset(file)
lats=nc.variables['lat'][:]; lons=nc.variables['lon'][:]
latselect=np.logical_and(lats > LatLowBound, lats < LatUpBound)
lonselect=np.logical_and(lon > LonLowBound, lon < LonUpBound)
data=nc.variables['Runoff'][1000, latselect, lonselect]
return data; return latselect; return lonselect