Ignore:
Timestamp:
Mar 31, 2012, 7:33:41 PM (13 years ago)
Author:
aslmd
Message:

UTIL PYTHON : for mesoscale plots 1. improved the case of pressure interpolation -i 1 or 2 ; 2. fixed the mean capabilities e.g. --lat 15.,35. now working fine the problem was the wrong dimension being considered in slon, my bad.

File:
1 edited

Legend:

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

    r608 r610  
    173173##########################################################
    174174      if typefile in ["gcm","earthgcm","ecmwf"]:
    175           if slon is not None: sslon = slon  ## a fix of the sslon not initialized. but what is the use of sslon?
    176           if slat is not None: sslat = slat  ## a fix of the sslat not initialized. but what is the use of sslat?
     175          if slon is not None: sslon = slon 
     176          if slat is not None: sslat = slat 
    177177          ### LAT
    178178          if "latitude" in nc.variables:  lat = nc.variables["latitude"][:]
     
    208208              else:                                                                           iwantawhereplot = None   #do not show anything, just select indices
    209209              numlon = 1 ; numlat = 1
    210               if slon is not None:   numlon = slon.shape[0]   
    211               if slat is not None:   numlat = slat.shape[0]
     210              if slon is not None:   numlon = slon.shape[1]   
     211              if slat is not None:   numlat = slat.shape[1]
    212212              indices = np.ones([numlon,numlat,2]) ; vlon = None ; vlat = None
    213213              for iii in range(numlon): 
    214214               for jjj in range(numlat):
    215                  if slon is not None:  vlon = slon[iii][0]  ### note: slon[:][0] does not work
    216                  if slat is not None:  vlat = slat[jjj][0]  ### note: slon[:][0] does not work
     215                 if slon is not None:  vlon = slon[0][iii]  ### note: slon[:][0] does not work
     216                 if slat is not None:  vlat = slat[0][jjj]  ### note: slon[:][0] does not work
    217217                 indices[iii,jjj,:] = bidimfind(lon2d,lat2d,vlon,vlat,file=iwantawhereplot) 
    218218                 lonp,latp = ( lon2d[indices[iii,jjj,0],indices[iii,jjj,1]] , lat2d[indices[iii,jjj,0],indices[iii,jjj,1]] )
     
    220220              for iii in range(numlon):
    221221               for jjj in range(numlat):
    222                  if slon is not None: sslon[iii][0] = indices[iii,0,1] ; sslon[iii][1] = indices[iii,0,1] #...this is idx
    223                  if slat is not None: sslat[jjj][0] = indices[0,jjj,0] ; sslat[jjj][1] = indices[0,jjj,0] #...this is idy
     222                 if slon is not None: sslon[0][iii] = indices[iii,0,1] #...this is idx
     223                 if slat is not None: sslat[0][jjj] = indices[0,jjj,0] #...this is idy
    224224              lonp,latp = ( lon2d[indices[0,0,0],indices[0,0,1]] , lat2d[indices[0,0,0],indices[0,0,1]] )
    225225          ######
     
    262262              if vertmode == 0:     vert = np.arange(0,getattr(nc,vertdim),1)
    263263              elif vertmode == -1:  vert = nc.variables["PHTOT"][0,:,0,0]/3.72 ; vert = np.array(vert[0:len(vert)-1]) #; print vert
    264               else:                 vert = nc.variables["vert"][:]
     264              elif vertmode == 1 or vertmode == 2:  vert = nc.variables["vert"][:]        ## pressure in Pa
     265              else:                                 vert = nc.variables["vert"][:]/1000.  ## altitude in km
    265266       #if firstfile:
    266267       #   lat0 = lat
Note: See TracChangeset for help on using the changeset viewer.