Changeset 399 for trunk/UTIL/PYTHON/myplot.py
- Timestamp:
- Nov 18, 2011, 8:43:59 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/myplot.py
r398 r399 2 2 def errormess(text,printvar=None): 3 3 print text 4 if printvar : print printvar4 if printvar is not None: print printvar 5 5 exit() 6 6 return … … 829 829 return zesaxis 830 830 831 ## Author: AS 832 def bidimfind(lon2d,lat2d,vlon,vlat): 833 import numpy as np 834 if vlat is None: array = (lon2d - vlon)**2 835 elif vlon is None: array = (lat2d - vlat)**2 836 else: array = (lon2d - vlon)**2 + (lat2d - vlat)**2 837 idy,idx = np.unravel_index( np.argmin(array), lon2d.shape ) 838 if vlon is not None: 839 #print lon2d[idy,idx],vlon 840 if (np.abs(lon2d[idy,idx]-vlon)) > 5: errormess("longitude not found ",printvar=lon2d) 841 if vlat is not None: 842 #print lat2d[idy,idx],vlat 843 if (np.abs(lat2d[idy,idx]-vlat)) > 5: errormess("latitude not found ",printvar=lat2d) 844 return idx,idy 845 831 846 ## Author: TN 832 def 847 def getsindex(saxis,index,axis): 833 848 # input : all the desired slices and the good index 834 849 # output : all indexes to be taken into account for reducing field … … 890 905 print "CHECK: x.shape, y.shape", x.shape, y.shape 891 906 if len(shape) == 1: 892 print shape[0]893 907 if shape[0] != len(x): 894 908 print "WARNING HERE !!!" 895 909 x = y 896 910 elif len(shape) == 2: 897 print shape[1], len(y), shape[0], len(x)898 911 if shape[1] == len(y) and shape[0] == len(x) and shape[0] != shape[1]: 899 912 what_I_plot = swapaxes(what_I_plot,0,1) 900 913 print "INFO: swapaxes", what_I_plot.shape, shape 901 #x0 = x902 #x = y903 #y = x0904 #print "define_axis", x, y905 914 return what_I_plot,x,y 906 915
Note: See TracChangeset
for help on using the changeset viewer.