Ignore:
Timestamp:
Feb 11, 2013, 5:21:29 PM (12 years ago)
Author:
aslmd
Message:

UTIL PYTHON. A bug fix for previous commit. Ensure that what is coming from getfieldred has not changed dimension.

File:
1 edited

Legend:

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

    r876 r877  
    9797    dimension = len(nc.variables[var].dimensions)
    9898    ## this allows to get much faster and use much less memory esp. with large datasets
    99     if dimension == 2:    field = nc.variables[var][indextime,indexlon]
    100     elif dimension == 3:  field = nc.variables[var][indextime,indexlat,indexlon]
    101     elif dimension == 4:  field = nc.variables[var][indextime,indexvert,indexlat,indexlon]
    102     elif dimension == 1:  field = nc.variables[var][indextime]
     99    print "   Opening variable",var," with", dimension, "dimensions ..."
     100    if dimension == 2:   
     101        field = nc.variables[var][indextime,indexlon]
     102        field = np.reshape(field,(len(indextime),len(indexlon)))
     103    elif dimension == 3: 
     104        field = nc.variables[var][indextime,indexlat,indexlon]
     105        field = np.reshape(field,(len(indextime),len(indexlat),len(indexlon)))
     106    elif dimension == 4: 
     107        field = nc.variables[var][indextime,indexvert,indexlat,indexlon]
     108        field = np.reshape(field,(len(indextime),len(indexvert),len(indexlat),len(indexlon)))
     109    elif dimension == 1: 
     110        field = nc.variables[var][indextime]
     111        field = np.reshape(field,(len(indextime)))
    103112    return field
    104113
     
    13581367   shape = what_I_plot.shape
    13591368   if indextime is None and len(time) > 1:
    1360       print "AXIS is time"
     1369      #print "AXIS is time"
    13611370      x = time
    13621371      count = count+1
    13631372   if indexlon is None and len(lon) > 1 and redope not in ['edge_x1','edge_x2']:
    1364       print "AXIS is lon"
     1373      #print "AXIS is lon"
    13651374      if count == 0: x = lon
    13661375      else: y = lon
    13671376      count = count+1
    13681377   if indexlat is None and len(lat) > 1 and redope not in ['edge_y1','edge_y2']:
    1369       print "AXIS is lat"
     1378      #print "AXIS is lat"
    13701379      if count == 0: x = lat
    13711380      else: y = lat
    13721381      count = count+1
    13731382   if indexvert is None and len(vert) > 1 and ((dim0 == 4) or (y is None)):
    1374       print "AXIS is vert"
     1383      #print "AXIS is vert"
    13751384      if vertmode == 0: # vertical axis is as is (GCM grid)
    13761385         if count == 0: x=range(len(vert))
Note: See TracChangeset for help on using the changeset viewer.