Changeset 13440


Ignore:
Timestamp:
09/25/12 15:43:03 (12 years ago)
Author:
cborstad
Message:

NEW: processdata and plot_unit for python plotting, some new plot options added, preliminary element and node plots

Location:
issm/trunk-jpl/src/m/plot
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/applyoptions.py

    r13424 r13440  
    139139        #grid {{{
    140140        if options.exist('grid'):
    141                 p.grid()
     141                if 'on' in options.getfieldvalue('grid','on'):
     142                        p.grid()
    142143        #}}}
    143144
     
    146147        #wrapping
    147148
    148         #colorbar
     149        #colorbar {{{
     150        if 'on' in options.getfieldvalue('colorbar','on'):
     151                p.colorbar()
     152        #}}}
    149153
    150154        #area
     
    161165
    162166        #contours
    163 
    164 
    165 
    166167
    167168        #axis positions
  • issm/trunk-jpl/src/m/plot/plot_manager.py

    r13424 r13440  
    11from pairoptions import *
    22import pylab as p
    3 from checkplotoptions import *
    4 from plot_mesh import *
     3from checkplotoptions import checkplotoptions
     4from plot_mesh import plot_mesh
     5from processmesh import processmesh
     6from processdata import processdata
     7from plot_unit import plot_unit
     8from applyoptions import applyoptions
    59
    610def plot_manager(md,options,subplotwidth,nlines,ncols,i):
     
    2529
    2630                # convert string to lower case for a case-insensitive comparison
    27                 if data.lower()=='mesh': plot_mesh(md,options,nlines,ncols,i)
     31                if data.lower()=='mesh':
     32                        plot_mesh(md,options,nlines,ncols,i)
     33                        return
    2834                else:
    2935                        print "WARNING: '%s' is not implemented or is not a valid string for option 'data'" % data
    3036
    3137        #elif data in vars(md):
    32         else:
    33                 print "'data' not a string, plotting model properties yet to be implemented..."
     38        #else:
     39                #print "'data' not a string, plotting model properties yet to be implemented..."
    3440
    35        
     41        #Overlay plot
     42
     43        #Gridded plot
     44
     45        #Section plot
     46
     47        #Profile plot
     48
     49        #process data and model
     50        x,y,z,elements,is2d,isplanet=processmesh(md,data,options)
     51        data2,datatype=processdata(md,data,options)
     52
     53        #standard plot
     54        p.subplot(nlines,ncols,i)
     55
     56        #plot unit
     57        plot_unit(x,y,z,elements,data2,is2d,isplanet,datatype,options)
     58
     59        #apply all options
     60        applyoptions(md,data2,options)
     61
     62        #ground overlay on kml plot_unit
  • issm/trunk-jpl/src/m/plot/plot_mesh.py

    r13417 r13440  
    1313        '''
    1414
    15         x,y,z,elements,is2d=processmesh(md,[],options)
     15        x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
    1616
    1717        if is2d:
  • issm/trunk-jpl/src/m/plot/plotmodel.py

    r13417 r13440  
    4141        #Go through plots
    4242        if numberofplots:
    43        
     43               
    4444                #Create figure
    4545                #plots will be visible by default if ipython is run in interactive mode (invoked by ipython --pylab)
     
    5252                else:
    5353                        p.figure(figurenumber)
    54 
    55        
     54                       
    5655                #try:
    5756                for i in xrange(numberofplots):
  • issm/trunk-jpl/src/m/plot/processdata.m

    r13275 r13440  
    4848end
    4949
    50 %get datatype
     50%get datasize
    5151datasize=size(data);
    5252
    53 %Process NaN if any (do not now before mask is applied)
     53%Process NaN if any (do not know before mask is applied)
    5454if exist(options,'nan')
    5555        data(find(isnan(data)))=getfieldvalue(options,'nan',0);
  • issm/trunk-jpl/src/m/plot/processmesh.py

    r13417 r13440  
    1717                raise ValueError('processmesh error: the number of elements is the same as the number of nodes')
    1818
    19         if not data or not isinstance(data,dict):
     19        if len(data)==0 or not isinstance(data,dict):
    2020               
    2121                if 'latlon' not in options.getfieldvalue('coord','xy').lower(): #convert to lower case for comparison
     
    5252                                is2d=0
    5353                else:
    54                         raise ValueError('processmesh error: dim = %d not supported')
     54                        raise ValueError('processmesh error: dim = %d not supported' % md.mesh.dimension)
    5555
    5656                #layer projection?
     
    5858                         if 'latlon' in options.getfieldvalue('coord','xy').lower():
    5959                                 raise ValueError('processmesh error: cannot work with 3D mesh in lat-lon coords')
    60                         #we modify (w/c?) the mesh temporarily to a 2D mesh from which the 3D mesh was extruded
     60                        #we modify the mesh temporarily to a 2D mesh from which the 3D mesh was extruded
    6161                         x=x2d
    6262                         y=y2d
     
    6565       
    6666        else:
    67                 #Process mesh for plotting (triangulation for 2D, polycollection for 3D?)
     67                #Process mesh for plotting
    6868                if md.mesh.dimension==2:
    6969                        is2d=1
     
    7979                z=z*unit
    8080
    81         ##is model a member of planet class? (won't work until planet class defined)
    82         #if isinstance(md,planet):
    83         #       isplanet=1
    84         #else:
    85         #       isplanet=0
    86         return x,y,z,elements,is2d
     81        #is model a member of planet class? (workaround until planet class defined)
     82        if md.__class__.__name__!='model':
     83                isplanet=1
     84        else:
     85                isplanet=0
     86
     87        return x,y,z,elements,is2d,isplanet
Note: See TracChangeset for help on using the changeset viewer.