Changeset 475 for trunk/UTIL/PYTHON/myplot.py
- Timestamp:
- Dec 15, 2011, 4:05:49 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/myplot.py
r469 r475 414 414 if typefile in ['mesoapi','meso']: 415 415 [lon2d,lat2d] = getcoord2d(nc) 416 lon2d = dumpbdy(lon2d,6)417 lat2d = dumpbdy(lat2d,6)418 416 elif typefile in ['gcm']: 419 417 [lon2d,lat2d] = getcoord2d(nc,nlat="latitude",nlon="longitude",is1d=True) … … 958 956 959 957 ## Author: AS 960 def bidimfind(lon2d,lat2d,vlon,vlat ):958 def bidimfind(lon2d,lat2d,vlon,vlat,file=None): 961 959 import numpy as np 960 import matplotlib.pyplot as mpl 962 961 if vlat is None: array = (lon2d - vlon)**2 963 962 elif vlon is None: array = (lat2d - vlat)**2 … … 965 964 idy,idx = np.unravel_index( np.argmin(array), lon2d.shape ) 966 965 if vlon is not None: 967 #print lon2d[idy,idx],vlon 968 if (np.abs(lon2d[idy,idx]-vlon)) > 5: errormess("longitude not found ",printvar=lon2d) 966 if (np.abs(lon2d[idy,idx]-vlon)) > 5: errormess("longitude not found ",printvar=lon2d) 969 967 if vlat is not None: 970 #print lat2d[idy,idx],vlat 971 if (np.abs(lat2d[idy,idx]-vlat)) > 5: errormess("latitude not found ",printvar=lat2d) 972 return idx,idy 968 if (np.abs(lat2d[idy,idx]-vlat)) > 5: errormess("latitude not found ",printvar=lat2d) 969 if file is not None: 970 print idx,idy,lon2d[idy,idx],vlon 971 print idx,idy,lat2d[idy,idx],vlat 972 var = file.variables["HGT"][:,:,:] 973 mpl.contourf(var[0,:,:],30,cmap = mpl.get_cmap(name="Greys_r") ) ; mpl.axis('off') ; mpl.plot(idx,idy,'bo') 974 mpl.show() 975 return idy,idx 973 976 974 977 ## Author: TN
Note: See TracChangeset
for help on using the changeset viewer.