Ignore:
Timestamp:
Oct 1, 2012, 1:29:35 AM (12 years ago)
Author:
aslmd
Message:

UTIL PYTHON. Added local plot/map capability to MCD interface. Added possibility to set projection and title. Added possibility to map horizontal wind velocity

File:
1 edited

Legend:

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

    r794 r796  
     1###!/usr/bin/env python
    12#!/usr/bin/python
    23###!/home/aymeric/Software/epd-7.0-2-rh5-x86/bin/python
     
    1213##################################################
    1314### ajouts et corrections par Franck Guyon 09/2012
     15### ajouts suite a brainstorm equipe AS 10/2012
    1416
    1517import cgi, cgitb
     
    3638# Get data from user-defined fields and define free dimensions
    3739# FG: add tests if var==None to have values in local without forms ones
     40query.lat = -9999.
    3841getlat = form.getvalue("latitude")
    39 if getlat == None: getlat = 1
    40 if getlat == "all":  islatfree = 1 ; query.lat = -9999.
     42if getlat == None: getlat = "1"
     43if getlat == "all":  islatfree = 1 ; query.lats = -90. ; query.late = 90.
     44elif ";" in getlat:  islatfree = 1 ; ind = getlat.find(";") ; query.lats = float(getlat[:ind]) ; query.late = float(getlat[ind+1:])
    4145else:                islatfree = 0 ; query.lat = float(getlat)
    4246
     47query.lon = -9999.
    4348getlon = form.getvalue("longitude")
    44 if getlon == None: getlon = 1
    45 if getlon == "all":  islonfree = 1 ; query.lon = -9999.
     49if getlon == None: getlon = "1"
     50if getlon == "all":  islonfree = 1 ; query.lons = -180. ; query.lone = 180.
     51elif ";" in getlon:  islonfree = 1 ; ind = getlon.find(";") ; query.lons = float(getlon[:ind]) ; query.lone = float(getlon[ind+1:])
    4652else:                islonfree = 0 ; query.lon = float(getlon)
    4753
     54query.loct = -9999.
    4855getloct = form.getvalue("localtime")
    49 if getloct == None: getloct = 1
    50 if getloct == "all": isloctfree = 1 ; query.loct = -9999.
     56if getloct == None: getloct = "1"
     57if getloct == "all": isloctfree = 1 ; query.locts = 0. ; query.locte = 24.
     58elif ";" in getloct: isloctfree = 1 ; ind = getloct.find(";") ; query.locts = float(getloct[:ind]) ; query.locte = float(getloct[ind+1:])
    5159else:                isloctfree = 0 ; query.loct = float(getloct)
    5260
     61query.xz = -9999.
    5362getalt = form.getvalue("altitude")
    54 if getalt == None: getalt = 1
    55 if getalt == "all":  isaltfree = 1 ; query.xz = -9999.
     63if getalt == None: getalt = "1"
     64if getalt == "all":  isaltfree = 1 ; query.xzs = 0. ; query.xze = 120000.
     65elif ";" in getalt:  isaltfree = 1 ; ind = getalt.find(";") ; query.xzs = float(getalt[:ind]) ; query.xze = float(getalt[ind+1:])
    5666else:                isaltfree = 0 ; query.xz = float(getalt)
    5767
     
    96106
    97107# reference name (to test which figures are already in the database)
    98 reference = str(islatfree)+str(islonfree)+str(isloctfree)+str(isaltfree)+query.getnameset()+str(var1)+str(var2)+str(var3)+str(var4)+str(iswind)+str(isfixedlt)
     108reference = query.getnameset()+str(var1)+str(var2)+str(var3)+str(var4)+str(iswind)+str(isfixedlt)
    99109figname = '../img/'+reference+'.png'
    100110
     
    127137
    128138    ### figure   
    129     query.htmlmap2d(vartoplot,incwind=iswindlog,fixedlt=input_fixedlt,figname=figname)
     139    zetitle = "MCD v4.3 - Dust scenario "+str(query.dust)+" - Date is "+str(query.xdate)
     140    query.htmlmap2d(vartoplot,incwind=iswindlog,fixedlt=input_fixedlt,figname=figname,title=zetitle)
    130141    #mpl.savefig("img/temp.png",dpi=110,bbox_inches='tight',pad_inches=0.4)
    131142    #Image.open("img/temp.png").save(figname,'JPEG') ##lighter images   
Note: See TracChangeset for help on using the changeset viewer.