Ignore:
Timestamp:
Jan 8, 2013, 9:33:07 AM (12 years ago)
Author:
aslmd
Message:

UTIL PYTHON MCDonline. Support for MCD5. Added eps figures. Various other informations added (diapo mode, text file with web arborescence).

File:
1 edited

Legend:

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

    r827 r859  
    7373query=mcd.mcd()
    7474
     75# set MCD version changes if needed
     76betatest = form.getvalue("betatest")
     77if betatest == "on": query.toversion5()
     78
    7579# Get the kind of vertical coordinates and choose default behavior for "all"
    7680try: query.zkey = int(form.getvalue("zkey"))
     
    9397if query.datekey == 1:
    9498    try: query.xdate = float(form.getvalue("ls"))
    95     except: query.xdate = float(1) ; badlschar = True
     99    except: query.xdate = float(1) ; badlschar = True # comment the second part if in debug command line mode
    96100else:
    97101    try: query.xdate = float(form.getvalue("julian"))
     
    161165except: query.max2d = None
    162166
    163 try: query.dpi = float(form.getvalue("dpi"))
     167try: query.dpi = form.getvalue("dpi")
    164168except: query.dpi = 80.
    165 
     169if query.dpi == "eps":  yeaheps = True  ; query.dpi = 300.
     170else:                   yeaheps = False ; query.dpi = float(query.dpi)
    166171
    167172# Get variables to plot
     
    194199
    195200 # reference name (to test which figures are already in the database)
    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)
    197  figname = '../img/'+reference+'.png'
     201 try: 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)
     202 except: reference = "test"
     203 if yeaheps:  figname = '../img/'+reference+'.eps'
     204 else:        figname = '../img/'+reference+'.png'
    198205 txtname = '../txt/'+reference+'.txt'
    199206 testexist = daos.path.isfile(figname)
     
    234241
    235242header="""<html><head><title>Mars Climate Database: The Web Interface</title></head><body>"""
     243if betatest == "on":
     244    print "<b>!!! THIS IS A BETA VERSION. RESULTS ARE NOT VALIDATED !!!</b>"
     245    if sumfree == 2:     print "<br>"
    236246
    237247print header
     
    248258else:
    249259  if sumfree == 0:      query.update() ; query.htmlprinttabextvar(vartoplot)
    250   elif sumfree == 2:    print "<img src='"+figname+"'><br />"
     260  elif sumfree == 2:   
     261                        if yeaheps:  print "<hr><a href='"+figname+"'>!!!! Click here to download the EPS figure file !!!!</a><br /><hr>"
     262                        else:        print "<img src='"+figname+"'><br />"
    251263  elif sumfree == 1:     
    252264                        print "<a href='"+txtname+"'>Click here to download an ASCII file containing data</a><br />"
    253265                        print "<hr>"
    254                         print "<img src='"+figname+"'><br />"
     266                        if yeaheps:  print "<hr><a href='"+figname+"'>!!!! Click here to download the EPS figure file !!!!</a><br /><hr>"
     267                        else:        print "<img src='"+figname+"'><br />"
    255268
    256269## This is quite common
Note: See TracChangeset for help on using the changeset viewer.