Ignore:
Timestamp:
Oct 20, 2012, 11:45:11 AM (12 years ago)
Author:
aslmd
Message:

UTIL PYTHON mcd interface. added option to print ASCII file. added sanity checks. topography contours are all solid lines. html section have cleaner bounds for axis. allowed for more separator namely , and /

File:
1 edited

Legend:

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

    r807 r811  
    4343if getlat == "all":  islatfree = 1 ; query.lats = -90. ; query.late = 90.
    4444elif ";" in getlat:  islatfree = 1 ; ind = getlat.find(";") ; query.lats = float(getlat[:ind]) ; query.late = float(getlat[ind+1:])
     45elif "," in getlat:  islatfree = 1 ; ind = getlat.find(",") ; query.lats = float(getlat[:ind]) ; query.late = float(getlat[ind+1:])
     46elif "/" in getlat:  islatfree = 1 ; ind = getlat.find("/") ; query.lats = float(getlat[:ind]) ; query.late = float(getlat[ind+1:])
    4547else:                islatfree = 0 ; query.lat = float(getlat)
    4648
     
    5052if getlon == "all":  islonfree = 1 ; query.lons = -180. ; query.lone = 180.
    5153elif ";" in getlon:  islonfree = 1 ; ind = getlon.find(";") ; query.lons = float(getlon[:ind]) ; query.lone = float(getlon[ind+1:])
     54elif "," in getlon:  islonfree = 1 ; ind = getlon.find(",") ; query.lons = float(getlon[:ind]) ; query.lone = float(getlon[ind+1:])
     55elif "/" in getlon:  islonfree = 1 ; ind = getlon.find("/") ; query.lons = float(getlon[:ind]) ; query.lone = float(getlon[ind+1:])
    5256else:                islonfree = 0 ; query.lon = float(getlon)
    5357
     
    5761if getloct == "all": isloctfree = 1 ; query.locts = 0. ; query.locte = 24.
    5862elif ";" in getloct: isloctfree = 1 ; ind = getloct.find(";") ; query.locts = float(getloct[:ind]) ; query.locte = float(getloct[ind+1:])
     63elif "," in getloct: isloctfree = 1 ; ind = getloct.find(",") ; query.locts = float(getloct[:ind]) ; query.locte = float(getloct[ind+1:])
     64elif "/" in getloct: isloctfree = 1 ; ind = getloct.find("/") ; query.locts = float(getloct[:ind]) ; query.locte = float(getloct[ind+1:])
    5965else:                isloctfree = 0 ; query.loct = float(getloct)
    6066
     
    7379    elif query.zkey == 1:  query.xzs = 3396000. ; query.xze = 3596000.
    7480elif ";" in getalt:  isaltfree = 1 ; ind = getalt.find(";") ; query.xzs = float(getalt[:ind]) ; query.xze = float(getalt[ind+1:])
     81elif "," in getalt:  isaltfree = 1 ; ind = getalt.find(",") ; query.xzs = float(getalt[:ind]) ; query.xze = float(getalt[ind+1:])
     82elif "/" in getalt:  isaltfree = 1 ; ind = getalt.find("/") ; query.xzs = float(getalt[:ind]) ; query.xze = float(getalt[ind+1:])
    7583else:                isaltfree = 0 ; query.xz = float(getalt)
    7684
     
    124132reference = query.getnameset()+str(var1)+str(var2)+str(var3)+str(var4)+str(iswind)+str(isfixedlt)
    125133figname = '../img/'+reference+'.png'
     134txtname = '../txt/'+reference
    126135testexist = daos.path.isfile(figname)
    127136
     
    133142
    134143    ### getting data
    135     if isloctfree == 1:         query.diurnal(nd=24)
     144    if isloctfree == 1:         query.diurnal(nd=24) 
    136145    elif islonfree == 1:        query.zonal()
    137146    elif islatfree == 1:        query.meridional()
     
    140149
    141150    ### generic building of figure
     151    query.getascii(vartoplot,filename=txtname)
    142152    query.htmlplot1d(vartoplot,figname=figname)
    143153    #mpl.savefig("img/temp.png",dpi=85,bbox_inches='tight',pad_inches=0.25)
     
    178188## Now the part which differs
    179189if sumfree == 0:        query.update() ; query.htmlprinttabextvar(vartoplot)  #query.printmeanvar()
    180 elif sumfree >= 1:      print "<img src='"+figname+"'><br />"
     190elif sumfree == 2:      print "<img src='"+figname+"'><br />"
     191elif sumfree == 1:     
     192    print "<a href='"+txtname+"'>Click here to download an ASCII file containing data</a><br />"
     193    print "<img src='"+figname+"'><br />"
    181194else:                   print "<h1>ERROR : sumfree is not or badly defined ...</h1></body></html>"
    182195
Note: See TracChangeset for help on using the changeset viewer.