Ignore:
Timestamp:
Dec 15, 2011, 4:05:49 PM (13 years ago)
Author:
aslmd
Message:

UTIL: Python graphics: 1. corrected locations lat/lon for meso. 2. fixed yaxis settings which did not work in some 1D and 2D cases. 3. moved 1D stuff in imov loop, so the loop is now consistent and generic. Also updated a bit farm_tour to avoid displaying e.g. grep as running job.

File:
1 edited

Legend:

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

    r469 r475  
    414414    if typefile in ['mesoapi','meso']:
    415415        [lon2d,lat2d] = getcoord2d(nc)
    416         lon2d = dumpbdy(lon2d,6)
    417         lat2d = dumpbdy(lat2d,6)
    418416    elif typefile in ['gcm']:
    419417        [lon2d,lat2d] = getcoord2d(nc,nlat="latitude",nlon="longitude",is1d=True)
     
    958956
    959957## Author: AS
    960 def bidimfind(lon2d,lat2d,vlon,vlat):
     958def bidimfind(lon2d,lat2d,vlon,vlat,file=None):
    961959   import numpy as np
     960   import matplotlib.pyplot as mpl
    962961   if vlat is None:    array = (lon2d - vlon)**2
    963962   elif vlon is None:  array = (lat2d - vlat)**2
     
    965964   idy,idx = np.unravel_index( np.argmin(array), lon2d.shape )
    966965   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)
    969967   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
    973976
    974977## Author: TN
Note: See TracChangeset for help on using the changeset viewer.