Changeset 805


Ignore:
Timestamp:
Oct 15, 2012, 12:00:39 AM (12 years ago)
Author:
aslmd
Message:

UTIL PYTHON mcd online. improved interface for time (earth and mars). improved titles.

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

Legend:

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

    r653 r805  
    3636### FINISH
    3737sounding.close() ; additional.close()
    38 query.plot1d(["p","t","u","v"],vertplot=1) ; mpl.show()
     38query.plot1d(["p","t","u","v"]) ; mpl.show()
  • trunk/UTIL/PYTHON/mcd/mcd.py

    r800 r805  
    9393        self.getdustlabel()
    9494        self.title = self.name + " with " + self.dustlabel + "."
     95        if self.lats is None:  self.title = self.title + " Latitude " + str(self.lat) + "E"
     96        if self.lons is None:  self.title = self.title + " Longitude " + str(self.lon) + "N"
     97        if self.xzs is None:   
     98            self.vertunits()
     99            self.title = self.title + " Altitude " + str(self.xz) + " " + self.vunits
     100        if self.locts is None: self.title = self.title + " Local time " + str(self.loct) + "h"
    95101
    96102    def getextvarlab(self,num):
     
    231237        print "Zonal wind = %5.3f meters per second." % (self.zonwind)
    232238        print "Meridional wind = %5.3f meters per second." % (self.merwind)
     239        print "Total horizontal wind = %5.3f meters per second." % ( np.sqrt(self.zonwind**2 + self.merwind**2) )
    233240
    234241    def printextvar(self,num):
     
    311318      elif self.zkey == 5: self.xlabel = "altitude above mean Mars Radius(=3396000m) (m)"
    312319
     320    def vertunits(self):
     321      if self.zkey == 1:   self.vunits = "m CP"
     322      elif self.zkey == 2: self.vunits = "m AMR"
     323      elif self.zkey == 3: self.vunits = "m ALS"
     324      elif self.zkey == 4: self.vunits = "Pa"
     325      elif self.zkey == 5: self.vunits = "m AMMRad"
     326
    313327###################
    314328### 1D analysis ###
     
    326340    def diurnal(self,nd=13):
    327341    ### retrieve a local time slice
     342      save = self.loct
    328343      self.xlabel = "Local time (Martian hour)"
    329344      self.prepare(ndx=nd) ; self.ininterv(0.,24.,nd,start=self.locts,end=self.locte)
    330345      for i in range(nd): self.loct = self.xcoord[i] ; self.update() ; self.put1d(i)
     346      self.loct = save
    331347
    332348    def zonal(self,nd=37):
    333349    ### retrieve a longitude slice
     350      save = self.lon
    334351      self.xlabel = "East longitude (degrees)"
    335352      self.prepare(ndx=nd) ; self.ininterv(-180.,180.,nd,start=self.lons,end=self.lone)
    336353      for i in range(nd): self.lon = self.xcoord[i] ; self.update() ; self.put1d(i)
     354      self.lon = save
    337355
    338356    def meridional(self,nd=19):
    339357    ### retrieve a latitude slice
     358      save = self.lat
    340359      self.xlabel = "North latitude (degrees)"
    341360      self.prepare(ndx=nd) ; self.ininterv(-90.,90.,nd,start=self.lats,end=self.late)
    342361      for i in range(nd): self.lat = self.xcoord[i] ; self.update() ; self.put1d(i)
     362      self.lat = save
    343363
    344364    def profile(self,nd=20,tabperso=None):
    345365    ### retrieve an altitude slice (profile)
     366      save = self.xz
    346367      self.vertlabel()
    347368      self.vertplot = True
     
    351372      if tabperso is not None: self.xcoord = tabperso
    352373      for i in range(nd): self.xz = self.xcoord[i] ; self.update() ; self.put1d(i)
     374      self.xz = save
    353375
    354376    def seasonal(self,nd=12):
    355377    ### retrieve a seasonal slice
     378      save = self.xdate
    356379      self.xlabel = "Areocentric longitude (degrees)"
    357380      self.prepare(ndx=nd) ; self.ininterv(0.,360.,nd,start=self.xdates,end=self.xdatee)
    358381      for i in range(nd): self.xdate = self.xcoord[i] ; self.update() ; self.put1d(i)
     382      self.xdate = save
    359383
    360384    def makeplot1d(self,choice):
     
    407431    ### retrieve a latitude/longitude slice
    408432    ### default is: local time is not fixed. user-defined local time is at longitude 0.
     433      save1 = self.lon ; save2 = self.lat ; save3 = self.loct
    409434      self.xlabel = "East longitude (degrees)" ; self.ylabel = "North latitude (degrees)"
    410435      self.prepare(ndx=ndx,ndy=ndy)
     
    415440       for j in range(ndy):
    416441         self.lon = self.xcoord[i] ; self.lat = self.ycoord[j]
    417          if not fixedlt: self.loct = (umst + self.lon/15.) % 24
     442         if not fixedlt:
     443           if self.lons is not None and self.lone is not None: self.loct = (umst + (self.lons+self.lone)/30.) % 24
     444           else:                                               self.loct = (umst + self.lon/15.) % 24
    418445         self.update() ; self.put2d(i,j)
    419446      if not fixedlt: self.loct = umst
     447      self.lon = save1 ; self.lat = save2 ; self.loct = save3
    420448
    421449    def put2d(self,i,j):
     
    503531        # contour field
    504532        c = yeah.contourf( x, y, what_I_plot, zelevels, cmap = palette, alpha = trans )
    505         Figure.colorbar(fig,c,orientation='vertical',format="%.1e")
     533        clb = Figure.colorbar(fig,c,orientation='vertical',format="%.1e")
     534        clb.set_label(fieldlab)
    506535        ax = fig.gca() ; ax.set_title(fieldlab) ; ax.set_ylabel("Latitude") ; ax.set_xlabel("Longitude")
    507536        ax.set_xticks(np.arange(-180,181,45)) ; ax.set_xbound(lower=self.lons, upper=self.lone)
  • trunk/UTIL/PYTHON/mcd/proto/cgi-bin/mcdcgi.py

    r800 r805  
    6969if sumfree > 2: exit() ## only 1D or 2D plots for the moment
    7070
    71 try: query.xdate = float(form.getvalue("ls"))
    72 except: query.xdate = float(1)
     71try: query.datekey = int(form.getvalue("datekeyhtml"))
     72except: query.datekey = float(1)
     73if query.datekey == 1:
     74    try: query.xdate = float(form.getvalue("ls"))
     75    except: query.xdate = float(1)
     76else:
     77    try: query.xdate = float(form.getvalue("julian"))
     78    except: query.xdate = float(1)
     79    query.loct = 0.
     80
    7381try: query.hrkey = int(form.getvalue("hrkey"))
    7482except: query.hrkey = int(1)
     
    156164#print "<br />"
    157165
     166print "<a href='../index.html'>Click here to start a new query</a><br />"
     167
    158168## Now the part which differs
    159169if sumfree == 0:        query.update() ; query.htmlprinttabextvar(vartoplot)  #query.printmeanvar()
    160 elif sumfree >= 1:      print "<a href='../index.html'>Click here to start a new query</a><br /><img src='"+figname+"'><br />"
     170elif sumfree >= 1:      print "<img src='"+figname+"'><br />"
    161171else:                   print "<h1>ERROR : sumfree is not or badly defined ...</h1></body></html>"
    162172
  • trunk/UTIL/PYTHON/mcd/proto/index.html

    r797 r805  
    5050</td>
    5151<td align="center">
    52 <b>CUSTOMIZE EARTH TIME</b><br />
    53 Year / Month / Day @ hh:mm:ss [UTC]<br />
     52<input type="radio" name="datekeyhtml" value="1" checked>
     53<b><font color="red">MARS date</font></b>
     54Solar longitude <input type="text" size="3" name="ls"> degrees<br />
     55Local Time <input type="text" size="4" name="localtime" value="0."> Martian hour<br />
     56<input type="radio" name="datekeyhtml" value="0">
     57<b><font color="blue">EARTH date</font></b>
     58YY / MM / DD @ hh:mm:ss<br />
    5459<input type="text" size="3" name="year"> / <input type="text" size="1" name="month"> / <input type="text" size="1" name="day"> @
    55 <input type="text" size="1" name="hours">:<input type="text" size="1" name="minutes">:<input type="text" size="1" name="seconds"><br />
    56 <input type="button" value="SAVE CHANGES" onClick="Convert2Ls();" style="font-weight:bold"><br />
     60<input type="text" size="1" name="hours">:<input type="text" size="1" name="minutes">:<input type="text" size="1" name="seconds">
     61UTC<br />
    5762</td>
    5863<td align="center">
    5964Earth Julian Date <input type="text" size="6" name="julian" readonly="readonly"><br />
    60 Martian year <input type="text" size="1" name="martianyear" readonly="readonly"> <br />
    61 Martian month <input type="text" size="1" name="martianmonth" readonly="readonly"> / 12<br />
    62 Martian sol <input type="text" size="2" name="sol" readonly="readonly"> / 669
     65Martian year <input type="text" size="1" name="martianyear" readonly="readonly">
     66month <input type="text" size="1" name="martianmonth" readonly="readonly"> / 12 <br />
     67Martian sol <input type="text" size="2" name="sol" readonly="readonly"> / 669<br />
     68<input type="button" value="EARTH DATE >>> MARS DATE" onClick="Convert2Ls();"><br />
    6369</td>
    6470</tr>
     
    98104write a value (or) a range val1;val2 (or) 'all'<br />
    99105<ul>
    100 <li>Latitude <input type="text" size="7" name="latitude" value="0."> degree North 
     106<li>Latitude <input type="text" size="7" name="latitude" value="0."> degree North
    101107<li>Longitude <input type="text" size="7" name="longitude" value="0."> degree East
    102 <li>Local Time <input type="text" size="7" name="localtime" value="0."> Martian hour
    103108<li>Altitude <input type="text" size="9" name="altitude" value="10."> <select name="zkey">
    104109<option value="1"         >m (O: Mars center)</option>
     
    131136<!--[Advanced settings for well-informed Martians]<br />-->
    132137<ul>
    133 <li>Force Mars solar longitude to be <input type="text" size="3" name="ls"> degrees</li>
    134138<li>High resolution topography? <input type="radio" name="hrkey" value="1" checked /> Yes <input type="radio" name="hrkey" value="0" /> No </li>
    135139<li>Dust scenario? <select name="dust">
Note: See TracChangeset for help on using the changeset viewer.