Ignore:
Timestamp:
Nov 18, 2011, 8:43:59 PM (13 years ago)
Author:
aslmd
Message:

GRAPHICS: improved the selection of lon,lat with pp.py for mesoscale files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/myplot.py

    r398 r399  
    22def errormess(text,printvar=None):
    33    print text
    4     if printvar: print printvar
     4    if printvar is not None: print printvar
    55    exit()
    66    return
     
    829829  return zesaxis
    830830
     831## Author: AS
     832def 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
    831846## Author: TN
    832 def  getsindex(saxis,index,axis):
     847def getsindex(saxis,index,axis):
    833848# input  : all the desired slices and the good index
    834849# output : all indexes to be taken into account for reducing field
     
    890905   print "CHECK: x.shape, y.shape", x.shape, y.shape
    891906   if len(shape) == 1:
    892       print shape[0]
    893907      if shape[0] != len(x):
    894908         print "WARNING HERE !!!"
    895909         x = y
    896910   elif len(shape) == 2:
    897       print shape[1], len(y), shape[0], len(x)
    898911      if shape[1] == len(y) and shape[0] == len(x) and shape[0] != shape[1]:
    899912         what_I_plot = swapaxes(what_I_plot,0,1)
    900913         print "INFO: swapaxes", what_I_plot.shape, shape
    901          #x0 = x
    902          #x = y
    903          #y = x0
    904    #print "define_axis", x, y
    905914   return what_I_plot,x,y
    906915
Note: See TracChangeset for help on using the changeset viewer.