Changeset 794


Ignore:
Timestamp:
Sep 21, 2012, 5:15:28 PM (12 years ago)
Author:
aslmd
Message:

UTIL PYTHON. Oops. Wrong version of mcdcgi.py, now corrected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/mcd/proto/cgi-bin/mcdcgi.py

    r793 r794  
    3838getlat = form.getvalue("latitude")
    3939if getlat == None: getlat = 1
    40 
    4140if getlat == "all":  islatfree = 1 ; query.lat = -9999.
    4241else:                islatfree = 0 ; query.lat = float(getlat)
     42
    4343getlon = form.getvalue("longitude")
    4444if getlon == None: getlon = 1
     
    4747
    4848getloct = form.getvalue("localtime")
    49 
    5049if getloct == None: getloct = 1
    5150if getloct == "all": isloctfree = 1 ; query.loct = -9999.
     
    8180# fg: init var as with form values
    8281if var1 == None: var1="t"
    83 if var2 == None: var2="p"
     82#if var2 == None: var2="p"
    8483
    8584vartoplot = []
    8685if var1 != "none": vartoplot = np.append(vartoplot,var1)
    87 if var2 != "none": vartoplot = np.append(vartoplot,var2)
     86if var2 != "none" and var2 != None: vartoplot = np.append(vartoplot,var2)
    8887if var3 != "none" and var3 != None: vartoplot = np.append(vartoplot,var3)
    8988if var4 != "none" and var4 != None: vartoplot = np.append(vartoplot,var4)
     
    128127
    129128    ### figure   
    130     query.map2d(vartoplot,incwind=iswindlog,fixedlt=input_fixedlt)
    131     mpl.savefig("img/temp.png",dpi=110,bbox_inches='tight',pad_inches=0.4)
    132     Image.open("img/temp.png").save(figname,'JPEG') ##lighter images   
    133     ## http://www.pythonware.com/library/pil/handbook/introduction.htm
     129    query.htmlmap2d(vartoplot,incwind=iswindlog,fixedlt=input_fixedlt,figname=figname)
     130    #mpl.savefig("img/temp.png",dpi=110,bbox_inches='tight',pad_inches=0.4)
     131    #Image.open("img/temp.png").save(figname,'JPEG') ##lighter images   
     132    ### http://www.pythonware.com/library/pil/handbook/introduction.htm
    134133
    135134## This is quite common
     
    147146## Now the part which differs
    148147if sumfree == 0:        query.update() ; query.htmlprinttabextvar(vartoplot)  #query.printmeanvar()
    149 elif sumfree >= 1:      print "<img src='"+figname+"'><br />"
     148elif sumfree >= 1:      print "<a href='../index.html'>Click here to start a new query</a><br /><img src='"+figname+"'><br />"
    150149else:                   print "<h1>ERROR : sumfree is not or badly defined ...</h1></body></html>"
    151150
     
    153152## This is quite common
    154153bottom = "<hr><a href='../index.html'>Click here to start a new query</a>.<hr></body></html>"
    155 print bottom
     154#print bottom
    156155
    157156##write to file object
Note: See TracChangeset for help on using the changeset viewer.