Changeset 827 for trunk/UTIL


Ignore:
Timestamp:
Nov 2, 2012, 5:15:38 PM (12 years ago)
Author:
aslmd
Message:

PYTHON UTIL mcd interface. few improvements: set bounds, set better resolution for figs, address Steve remarks.

Location:
trunk/UTIL/PYTHON/mcd
Files:
3 edited

Legend:

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

    r821 r827  
    8080        self.fixedlt = False
    8181        self.zonmean = False
     82        self.min2d = None
     83        self.max2d = None
     84        self.dpi = 80.
    8285
    8386    def viking1(self): self.name = "Viking 1 site. MCD v4.3 output" ; self.lat = 22.48 ; self.lon = -49.97 ; self.xdate = 97.
     
    101104        if not oneline: self.title = self.title + "\n"
    102105        if self.lats is None:  self.title = self.title + " Latitude " + str(self.lat) + "N"
    103         if self.zonmean: self.title = self.title + "Zonal mean over all longitudes."
    104         elif self.lons is None: self.title = self.title + " Longitude " + str(self.lon) + "E"
     106        if self.zonmean and self.lats is not None and self.xzs is not None:
     107            self.title = self.title + "Zonal mean over all longitudes."
     108        elif self.lons is None:
     109            self.title = self.title + " Longitude " + str(self.lon) + "E"
    105110        if self.xzs is None:   
    106111            self.vertunits()
     
    513518      # The size * the dpi gives the final image size
    514519      #   a4"x4" image * 80 dpi ==> 320x320 pixel image
    515       canvas.print_figure(figname, dpi=80)
     520      canvas.print_figure(figname, dpi=self.dpi)
    516521
    517522###################
     
    704709        ## define field. bound field.
    705710        what_I_plot = np.transpose(field)
    706         zevmin, zevmax = myplot.calculate_bounds(what_I_plot)  ## vmin=min(what_I_plot_frame), vmax=max(what_I_plot_frame))
     711        zevmin, zevmax = myplot.calculate_bounds(what_I_plot,vmin=self.min2d,vmax=self.max2d) 
    707712        what_I_plot = myplot.bounds(what_I_plot,zevmin,zevmax)
    708713        ## define contour field levels. define color palette
     
    734739      # The size * the dpi gives the final image size
    735740      #   a4"x4" image * 80 dpi ==> 320x320 pixel image
    736       canvas.print_figure(figname, dpi=80)
     741      canvas.print_figure(figname, dpi=self.dpi)
    737742
    738743    def htmlplot2d(self,tabtodo,figname="temp.png"):
     
    775780        ## define field. bound field.
    776781        what_I_plot = np.transpose(field)
    777         zevmin, zevmax = myplot.calculate_bounds(what_I_plot)  ## vmin=min(what_I_plot_frame), vmax=max(what_I_plot_frame))
     782        zevmin, zevmax = myplot.calculate_bounds(what_I_plot,vmin=self.min2d,vmax=self.max2d) 
    778783        what_I_plot = myplot.bounds(what_I_plot,zevmin,zevmax)
    779784        ## define contour field levels. define color palette
     
    806811      # The size * the dpi gives the final image size
    807812      #   a4"x4" image * 80 dpi ==> 320x320 pixel image
    808       canvas.print_figure(figname, dpi=80)
     813      canvas.print_figure(figname, dpi=self.dpi)
    809814
    810815
  • trunk/UTIL/PYTHON/mcd/proto/cgi-bin/mcdcgi.py

    r821 r827  
    9090try: query.datekey = int(form.getvalue("datekeyhtml"))
    9191except: query.datekey = float(1)
     92badlschar = False
    9293if query.datekey == 1:
    9394    try: query.xdate = float(form.getvalue("ls"))
    94     except: query.xdate = float(1)
     95    except: query.xdate = float(1) ; badlschar = True
    9596else:
    9697    try: query.xdate = float(form.getvalue("julian"))
     
    105106if badls:
    106107    errormess = errormess+"<li>Solar longitude must be between 0 and 360."
     108if badlschar:
     109    errormess = errormess+"<li>Solar longitude is in the wrong format. It should be a positive number between 0 and 360. Intervals of solar longitude are not allowed."
    107110badloct = (isloctfree == 0 and query.loct > 24.) \
    108111       or (isloctfree == 1 and (query.locts > 24. or query.locte > 24.)) \
     
    153156except: query.colorm = "jet"
    154157
     158try: query.min2d = float(form.getvalue("minval"))
     159except: query.min2d = None
     160try: query.max2d = float(form.getvalue("maxval"))
     161except: query.max2d = None
     162
     163try: query.dpi = float(form.getvalue("dpi"))
     164except: query.dpi = 80.
     165
     166
    155167# Get variables to plot
    156168var1 = form.getvalue("var1")
     
    182194
    183195 # reference name (to test which figures are already in the database)
    184  reference = query.getnameset()+str(var1)+str(var2)+str(var3)+str(var4)+str(iswind)+str(isfixedlt)+str(iszonmean)+query.colorm
     196 reference = query.getnameset()+str(var1)+str(var2)+str(var3)+str(var4)+str(iswind)+str(isfixedlt)+str(iszonmean)+query.colorm+str(query.min2d)+str(query.max2d)+str(query.dpi)
    185197 figname = '../img/'+reference+'.png'
    186198 txtname = '../txt/'+reference+'.txt'
  • trunk/UTIL/PYTHON/mcd/proto/index.html

    r821 r827  
    107107<td align="center">
    108108<ul>
    109 <li>High resolution mode? <input type="radio" name="hrkey" value="1" checked /> Yes <input type="radio" name="hrkey" value="0" /> No </li>
    110 <li>Dust scenario? <select name="dust">
     109<li>Dust scenario <select name="dust">
    111110<option value="1"         >MY24 min solar</option>
    112111<option value="2" selected>MY24 ave solar</option>
     
    118117<option value="8"         >cold scenario (low dust, min solar)</option>
    119118</select></li>
     119<li>Interpolate using MOLA topography <input type="radio" name="hrkey" value="1" checked /> on <input type="radio" name="hrkey" value="0" /> off </li>
    120120</ul>
    121121</td>
     
    254254<td align="center">
    255255<ul>
    256 <li> Add wind vectors
    257 <input type="radio" name="iswind" value="off" checked /> No
    258 <input type="radio" name="iswind" value="on"          /> Yes</li> 
     256<li> Set picture resolution
     257<input type="radio" name="dpi" value="80" checked> medium
     258<input type="radio" name="dpi" value="160"> high
    259259</li>
    260260<li> Set colormap
     
    269269</select>
    270270</li>
    271 <li> Ask for zonal mean in lat/alt plot<br />
    272 <input type="radio" name="zonmean" value="off" checked /> No
    273 <input type="radio" name="zonmean" value="on"          /> Yes (please be patient)
     271<li> Set bounds in 2D plots
     272<input type="text" size="2" name="minval"> min
     273<input type="text" size="2" name="maxval"> max
     274</li>
     275<li> Wind vectors in lat/lon plot
     276<input type="radio" name="iswind" value="off" checked /> off
     277<input type="radio" name="iswind" value="on"          /> on</li> 
     278</li>
     279<li> Zonal average in lat/alt plot
     280<input type="radio" name="zonmean" value="off" checked /> off
     281<input type="radio" name="zonmean" value="on"          /> on
    274282</li>
    275283</ul>
Note: See TracChangeset for help on using the changeset viewer.