Changeset 1276 for trunk/UTIL


Ignore:
Timestamp:
Jun 2, 2014, 10:30:18 AM (10 years ago)
Author:
aslmd
Message:

MCD web interface converted to version 5.1 (no retrocompatibility to 5.0, simply come back to previous version for 5.0 support). Added dev mode to mcdcgi.py (simply have to set dev on on HTML form to get it) -- an unique page index_dev.html for tests. Added the possibilty to use space as a separator. Also make the web pages self aware for reload.

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

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/mcd/fmcd5_gfortran.sh

    r943 r1276  
    1414### LINKS
    1515NETCDF=/home/marshttp/NETCDF/netcdf64-4.0.1_gfortran_fPIC/
    16 wheremcd=/home/marshttp/MCD_v5.0//mcd/
     16wheremcd=/home/marshttp/MCD_v5.1//mcd/
     17num="5"
     18#num="5_dev"
    1719
    1820### LOG FILE
    19 touch fmcd5.log
    20 \rm fmcd5.log
     21touch fmcd$num.log
     22\rm fmcd$num.log
    2123
    2224### COPY/PREPARE SOURCES
     
    2830
    2931### BUILD THROUGH f2py WHAT IS NECESSARY TO CREATE THE PYTHON FUNCTIONS
    30 touch fmcd5.pyf
    31 \rm fmcd5.pyf
    32 f2py -h fmcd5.pyf -m fmcd5 tmp.call_mcd.F tmp.julian.F tmp.heights.F > fmcd5.log 2>&1
     32touch fmcd$num.pyf
     33\rm fmcd$num.pyf
     34f2py -h fmcd$num.pyf -m fmcd$num tmp.call_mcd.F tmp.julian.F tmp.heights.F > fmcd$num.log 2>&1
    3335
    3436#### IMPORTANT: we teach f2py about variables in the call_mcd subroutines which are intended to be out
    35 sed s/"real :: pres"/"real, intent(out) :: pres"/g fmcd5.pyf | \
     37sed s/"real :: pres"/"real, intent(out) :: pres"/g fmcd$num.pyf | \
    3638sed s/"real :: dens"/"real, intent(out) :: dens"/g | \
    3739sed s/"real :: temp"/"real, intent(out) :: temp"/g | \
     
    4143sed s/"real dimension(100) :: extvar"/"real dimension(100),intent(out) :: extvar"/g | \
    4244sed s/"real :: seedout"/"real, intent(out) :: seedout"/g | \
    43 sed s/"integer :: ier"/"integer, intent(out) :: ier"/g > fmcd5.pyf.modif
    44 mv fmcd5.pyf.modif fmcd5.pyf
     45sed s/"integer :: ier"/"integer, intent(out) :: ier"/g > fmcd$num.pyf.modif
     46mv fmcd$num.pyf.modif fmcd$num.pyf
    4547
    4648### BUILD
    47 f2py -c fmcd5.pyf tmp.call_mcd.F tmp.julian.F tmp.heights.F --fcompiler=gnu95 \
     49f2py -c fmcd$num.pyf tmp.call_mcd.F tmp.julian.F tmp.heights.F --fcompiler=gnu95 \
    4850  -L$NETCDF/lib -lnetcdf \
    4951  -lm -I$NETCDF/include \
     
    5153  --f77flags="-fPIC" \
    5254  --verbose \
    53   > fmcd5.log 2>&1
     55  > fmcd$num.log 2>&1
    5456#  --include-paths $NETCDF/include:$NETCDF/lib \ ---> makes it fail
    5557
  • trunk/UTIL/PYTHON/mcd/mcd.py

    r1077 r1276  
    8585
    8686    def toversion5(self):
    87         self.name      = "MCD v5.0"
    88         self.dset      = '/home/marshttp/MCD_v5.0/data/'
     87        self.name      = "MCD v5.1"
     88        self.dset      = '/home/marshttp/MCD_v5.1/data/'
    8989        self.extvarkey = np.ones(100)
    9090
     
    187187        ### MCD version 5 new variables. AS 12/2012.
    188188        if "v5" in self.name:
    189           whichfield[29] = "not used (set to zero)"
    190           whichfield[30] = "Surface roughness length z0 (m)"
     189          whichfield[30] = whichfield[34]
     190          whichfield[34] = "surface H2O ice layer (kg/m2, 0.5: perennial)"
     191          whichfield[29] = "Surface roughness length z0 (m)"
    191192          whichfield[37] = "DOD RMS day to day variations"
    192193          whichfield[38] = "Dust mass mixing ratio (kg/kg)"
     
    218219          whichfield[64] = "[H] vol. mixing ratio (mol/mol)"
    219220          whichfield[65] = "[H2] vol. mixing ratio (mol/mol)"
    220           whichfield[66] = "[electron] vol. mixing ratio (mol/mol)"
     221          whichfield[66] = "electron number density (cm-3)"
    221222          whichfield[67] = "CO2 column (kg/m2)"
    222223          whichfield[68] = "N2 column (kg/m2)"
     
    228229          whichfield[74] = "H column (kg/m2)"
    229230          whichfield[75] = "H2 column (kg/m2)"
    230           whichfield[76] = "electron column (kg/m2)"
     231          whichfield[76] = "Total Electronic Content (TEC) (m-2)"
    231232        if num not in whichfield: myplot.errormess("Incorrect subscript in extvar.")
    232233        dastuff = whichfield[num]
     
    276277        elif num == "swdown": num = 32
    277278        elif num == "lwup": num = 33
    278         elif num == "swup": num = 34
     279        elif num == "swup":
     280            if "v5" in self.name:  num = 30
     281            else:                  num = 34
    279282        elif num == "tau": num = 36
    280283        elif num == "tau_ddv":
     
    300303            else:                  num = 50
    301304        elif num == "co2ice": num = 35
     305        elif num == "n2":
     306            if "v5" in self.name:  num = 58
     307            else:                  num = 47
     308        elif num == "n2col":
     309            if "v5" in self.name:  num = 68
     310            else:                  num = 11 # an undefined variable to avoid misleading output
    302311        elif num == "rdust":
    303312            if "v5" in self.name:  num = 39
    304             else:                  num = 30 # an undefined variable to avoid misleading output
     313            else:                  num = 11 # an undefined variable to avoid misleading output
    305314        elif num == "sdust":
    306315            if "v5" in self.name:  num = 40
    307             else:                  num = 30 # an undefined variable to avoid misleading output
     316            else:                  num = 11 # an undefined variable to avoid misleading output
    308317        elif num == "pbl":
    309318            if "v5" in self.name:  num = 46
    310             else:                  num = 30 # an undefined variable to avoid misleading output
     319            else:                  num = 11 # an undefined variable to avoid misleading output
    311320        elif num == "updraft":
    312321            if "v5" in self.name:  num = 47
    313             else:                  num = 30 # an undefined variable to avoid misleading output
     322            else:                  num = 11 # an undefined variable to avoid misleading output
    314323        elif num == "downdraft":
    315324            if "v5" in self.name:  num = 48
    316             else:                  num = 30 # an undefined variable to avoid misleading output
     325            else:                  num = 11 # an undefined variable to avoid misleading output
    317326        elif num == "pblwvar":
    318327            if "v5" in self.name:  num = 49
    319             else:                  num = 30 # an undefined variable to avoid misleading output
     328            else:                  num = 11 # an undefined variable to avoid misleading output
    320329        elif num == "pblhvar":
    321330            if "v5" in self.name:  num = 50
    322             else:                  num = 30 # an undefined variable to avoid misleading output
     331            else:                  num = 11 # an undefined variable to avoid misleading output
    323332        elif num == "stress":
    324333            if "v5" in self.name:  num = 51
    325             else:                  num = 30 # an undefined variable to avoid misleading output
     334            else:                  num = 11 # an undefined variable to avoid misleading output
    326335        elif num == "ar":
    327336            if "v5" in self.name:  num = 59
    328             else:                  num = 30 # an undefined variable to avoid misleading output
     337            else:                  num = 11 # an undefined variable to avoid misleading output
    329338        elif num == "o2":
    330339            if "v5" in self.name:  num = 62
    331             else:                  num = 30 # an undefined variable to avoid misleading output
     340            else:                  num = 11 # an undefined variable to avoid misleading output
    332341        elif num == "co2col":
    333342            if "v5" in self.name:  num = 67
    334             else:                  num = 30 # an undefined variable to avoid misleading output
     343            else:                  num = 11 # an undefined variable to avoid misleading output
    335344        elif num == "arcol":
    336345            if "v5" in self.name:  num = 69
    337             else:                  num = 30 # an undefined variable to avoid misleading output
     346            else:                  num = 11 # an undefined variable to avoid misleading output
    338347        elif num == "cocol":
    339348            if "v5" in self.name:  num = 70
    340             else:                  num = 30 # an undefined variable to avoid misleading output
     349            else:                  num = 11 # an undefined variable to avoid misleading output
    341350        elif num == "o3col":
    342351            if "v5" in self.name:  num = 73
    343             else:                  num = 30 # an undefined variable to avoid misleading output
     352            else:                  num = 11 # an undefined variable to avoid misleading output
    344353        elif num == "hydro":
    345354            if "v5" in self.name:  num = 64
    346             else:                  num = 30 # an undefined variable to avoid misleading output
     355            else:                  num = 11 # an undefined variable to avoid misleading output
    347356        elif num == "hydro2":
    348357            if "v5" in self.name:  num = 65
    349             else:                  num = 30 # an undefined variable to avoid misleading output
     358            else:                  num = 11 # an undefined variable to avoid misleading output
    350359        elif num == "e":
    351360            if "v5" in self.name:  num = 66
    352             else:                  num = 30 # an undefined variable to avoid misleading output
     361            else:                  num = 11 # an undefined variable to avoid misleading output
    353362        elif num == "ecol":
    354363            if "v5" in self.name:  num = 76
    355             else:                  num = 30 # an undefined variable to avoid misleading output
     364            else:                  num = 11 # an undefined variable to avoid misleading output
     365        elif num == "groundice":
     366            if "v5" in self.name:  num = 34
     367            else:                  num = 11 # an undefined variable to avoid misleading output
    356368        elif not isinstance(num, np.int): myplot.errormess("field reference not found.")
    357369        return num
  • trunk/UTIL/PYTHON/mcd/proto/index5.html

    r1077 r1276  
    99</head>
    1010
    11 <body onload="DefaultDateValues();DefaultTimeValues();Convert2Ls();PlaceValues(0.,0.);DefaultSpaceTime()">
    12 
    13 <form name="calendar" action="./cgi-bin/mcdcgi.py" method="post" target="_blank">
     11<body onload="DefaultDateValues();DefaultTimeValues();Convert2Ls();PlaceValues('all','all');DefaultSpaceTime()">
     12
     13<!--<form name="calendar" action="./cgi-bin/mcdcgi.py" method="post" target="_blank"> -->
     14<form name="calendar" action="./cgi-bin/mcdcgi.py" method="get" target="_blank">
    1415<!-- aussi possible: get a la place de post. pour avoir un beau lien -->
    1516
    1617<center>
    1718<b style="font-size: 125%;">Mars Climate Database: The Web Interface</b><br>
    18 <a href="index5.html"><img src="PIA03610_red.jpg" height=80 width=1200></a><br>
     19<a href="#" onclick="window.location.reload(true);"><img src="PIA03610_red.jpg" height=80 width=1200></a><br>
    1920</center>
    2021
     
    5051Solar longitude <input type="text" size="3" name="ls"> degrees<br />
    5152Local Time <input type="text" size="3" name="localtime" value="0."> Martian hour<br />
    52 <span style="font-size: 80%;">write a value (or) a range val1;val2 (or) 'all'</span><br />
     53<span style="font-size: 80%;">write a value (or) a range 'val1 val2' (or) 'all'</span><br />
    5354<br />
    5455<input type="radio" name="datekeyhtml" value="0">
     
    9091<td align="center">
    9192<b>CUSTOMIZE COORDINATES ON MARS</b><br />
    92 <span style="font-size: 80%;">write a value (or) a range val1;val2 (or) 'all'</span><br />
     93<span style="font-size: 80%;">write a value (or) a range 'val1 val2' (or) 'all'</span><br />
    9394<ul>
    9495<li>Latitude <input type="text" size="7" name="latitude" value="0."> degree North
     
    122123<li>Interpolate using MOLA topography <input type="radio" name="hrkey" value="1" checked /> on <input type="radio" name="hrkey" value="0" /> off </li>
    123124<li> MCD version
    124 <input type="radio" name="betatest" value="on"  checked /> 5.0
     125<input type="radio" name="betatest" value="on"  checked /> 5.1
    125126</span>
    126127</li>
     
    163164<option value="h2oice"        >Water ice mixing ratio (mol/mol)</option>
    164165<option value="co2ice"        >surface CO2 ice layer (kg/m2)</option>
     166<option value="groundice"     >surface H2O ice layer (kg/m2, 0.5: perennial)</option>
    165167<option value="pbl"           >Convective PBL height (m)</option>
    166168<option value="stress"        >Surf. wind stress (Kg/m/s2)</option>
     
    182184<option value="co2col"        >CO2 column (kg/m2)</option>
    183185<option value="arcol"         >Ar column (kg/m2)</option>
     186<option value="n2col"         >N2 column (kg/m2)</option>
    184187<option value="cocol"         >CO column (kg/m2)</option>
    185188<option value="o3col"         >O3 column (kg/m2)</option>
    186189<option value="co2"           >[CO2] vol. mixing ratio (mol/mol)</option>
    187190<option value="ar"            >[Ar] vol. mixing ratio (mol/mol)</option>
     191<option value="n2"            >[N2] vol. mixing ratio (mol/mol)</option>
    188192<option value="co"            >[CO] vol. mixing ratio (mol/mol)</option>
    189193<option value="o3"            >[O3] ozone vol. mixing ratio (mol/mol)</option>
     
    192196<option value="hydro"         >[H] vol. mixing ratio (mol/mol)</option>
    193197<option value="hydro2"        >[H2] vol. mixing ratio (mol/mol)</option>
    194 <option value="e"             >[e-] vol. mixing ratio (mol/mol)</option>
    195 <option value="ecol"          >e- column (kg/m2)</option>
     198<option value="e"             >electron number density (cm-3)</option>
     199<option value="ecol"          >Total Electronic Content (TEC) (m-2)</option>
    196200<option value="cp"            >Air heat capacity Cp (J kg-1 K-1)</option>
    197201<option value="visc"          >Air viscosity estimation (N s m-2)</option>
     
    218222<option value="h2oice"        >Water ice mixing ratio (mol/mol)</option>
    219223<option value="co2ice"        >surface CO2 ice layer (kg/m2)</option>
     224<option value="groundice"     >surface H2O ice layer (kg/m2, 0.5: perennial)</option>
    220225<option value="pbl"           >Convective PBL height (m)</option>
    221226<option value="stress"        >Surf. wind stress (Kg/m/s2)</option>
     
    237242<option value="co2col"        >CO2 column (kg/m2)</option>
    238243<option value="arcol"         >Ar column (kg/m2)</option>
     244<option value="n2col"         >N2 column (kg/m2)</option>
    239245<option value="cocol"         >CO column (kg/m2)</option>
    240246<option value="o3col"         >O3 column (kg/m2)</option>
    241247<option value="co2"           >[CO2] vol. mixing ratio (mol/mol)</option>
    242248<option value="ar"            >[Ar] vol. mixing ratio (mol/mol)</option>
     249<option value="n2"            >[N2] vol. mixing ratio (mol/mol)</option>
    243250<option value="co"            >[CO] vol. mixing ratio (mol/mol)</option>
    244251<option value="o3"            >[O3] ozone vol. mixing ratio (mol/mol)</option>
     
    247254<option value="hydro"         >[H] vol. mixing ratio (mol/mol)</option>
    248255<option value="hydro2"        >[H2] vol. mixing ratio (mol/mol)</option>
    249 <option value="e"             >[e-] vol. mixing ratio (mol/mol)</option>
    250 <option value="ecol"          >e- column (kg/m2)</option>
     256<option value="e"             >electron number density (cm-3)</option>
     257<option value="ecol"          >Total Electronic Content (TEC) (m-2)</option>
    251258<option value="cp"            >Air heat capacity Cp (J kg-1 K-1)</option>
    252259<option value="visc"          >Air viscosity estimation (N s m-2)</option>
     
    273280<option value="h2oice"        >Water ice mixing ratio (mol/mol)</option>
    274281<option value="co2ice"        >surface CO2 ice layer (kg/m2)</option>
     282<option value="groundice"     >surface H2O ice layer (kg/m2, 0.5: perennial)</option>
    275283<option value="pbl"           >Convective PBL height (m)</option>
    276284<option value="stress"        >Surf. wind stress (Kg/m/s2)</option>
     
    292300<option value="co2col"        >CO2 column (kg/m2)</option>
    293301<option value="arcol"         >Ar column (kg/m2)</option>
     302<option value="n2col"         >N2 column (kg/m2)</option>
    294303<option value="cocol"         >CO column (kg/m2)</option>
    295304<option value="o3col"         >O3 column (kg/m2)</option>
    296305<option value="co2"           >[CO2] vol. mixing ratio (mol/mol)</option>
    297306<option value="ar"            >[Ar] vol. mixing ratio (mol/mol)</option>
     307<option value="n2"            >[N2] vol. mixing ratio (mol/mol)</option>
    298308<option value="co"            >[CO] vol. mixing ratio (mol/mol)</option>
    299309<option value="o3"            >[O3] ozone vol. mixing ratio (mol/mol)</option>
     
    302312<option value="hydro"         >[H] vol. mixing ratio (mol/mol)</option>
    303313<option value="hydro2"        >[H2] vol. mixing ratio (mol/mol)</option>
    304 <option value="e"             >[e-] vol. mixing ratio (mol/mol)</option>
    305 <option value="ecol"          >e- column (kg/m2)</option>
     314<option value="e"             >electron number density (cm-3)</option>
     315<option value="ecol"          >Total Electronic Content (TEC) (m-2)</option>
    306316<option value="cp"            >Air heat capacity Cp (J kg-1 K-1)</option>
    307317<option value="visc"          >Air viscosity estimation (N s m-2)</option>
     
    328338<option value="h2oice"        >Water ice mixing ratio (mol/mol)</option>
    329339<option value="co2ice"        >surface CO2 ice layer (kg/m2)</option>
     340<option value="groundice"     >surface H2O ice layer (kg/m2, 0.5: perennial)</option>
    330341<option value="pbl"           >Convective PBL height (m)</option>
    331342<option value="stress"        >Surf. wind stress (Kg/m/s2)</option>
     
    347358<option value="co2col"        >CO2 column (kg/m2)</option>
    348359<option value="arcol"         >Ar column (kg/m2)</option>
     360<option value="n2col"         >N2 column (kg/m2)</option>
    349361<option value="cocol"         >CO column (kg/m2)</option>
    350362<option value="o3col"         >O3 column (kg/m2)</option>
    351363<option value="co2"           >[CO2] vol. mixing ratio (mol/mol)</option>
    352364<option value="ar"            >[Ar] vol. mixing ratio (mol/mol)</option>
     365<option value="n2"            >[N2] vol. mixing ratio (mol/mol)</option>
    353366<option value="co"            >[CO] vol. mixing ratio (mol/mol)</option>
    354367<option value="o3"            >[O3] ozone vol. mixing ratio (mol/mol)</option>
     
    357370<option value="hydro"         >[H] vol. mixing ratio (mol/mol)</option>
    358371<option value="hydro2"        >[H2] vol. mixing ratio (mol/mol)</option>
    359 <option value="e"             >[e-] vol. mixing ratio (mol/mol)</option>
    360 <option value="ecol"          >e- column (kg/m2)</option>
     372<option value="e"             >electron number density (cm-3)</option>
     373<option value="ecol"          >Total Electronic Content (TEC) (m-2)</option>
    361374<option value="cp"            >Air heat capacity Cp (J kg-1 K-1)</option>
    362375<option value="visc"          >Air viscosity estimation (N s m-2)</option>
     
    402415<tr>
    403416<td align="center">
    404 <input type="button" value="Values" style="font-weight:bold" onClick="submit_form_beginner()"/>
    405 <input type="button" value="Daily cycle" style="font-weight:bold" onClick="PlaceValues2('all');submit_form_beginner()"/><br />
    406 <input type="button" value="Vertical profile" style="font-weight:bold" onClick="PlaceValues3('all');submit_form_beginner()"/>
     417<input type="button" value="Values" style="font-weight:bold" onClick="CorrectValue();submit_form_beginner()"/>
     418<input type="button" value="Daily cycle" style="font-weight:bold" onClick="CorrectValue();PlaceValues2('all');submit_form_beginner()"/><br />
     419<input type="button" value="Vertical profile" style="font-weight:bold" onClick="CorrectValue();PlaceValues3('all');submit_form_beginner()"/>
    407420<input type="button" value="Global map" style="font-weight:bold" onClick="PlaceValues('all','all');submit_form_beginner()"/><br />
    408421</td>
    409422<td align="center">
    410423<input type="button" value="SUBMIT" style="font-weight:bold" onClick="submit_form()"/>
    411 <input type="button" value="RESET" style="font-weight:bold" onClick="window.open('index5.html','_self')"/><br />
     424<input type="button" value="RESET" style="font-weight:bold" onClick="window.location.reload(true);"/><br />
    412425</td>
    413426<td align="center">
  • trunk/UTIL/PYTHON/mcd/proto/martian_time.js

    r859 r1276  
    363363}
    364364
     365
     366function CorrectValue(){
     367if ( document.calendar.longitude.value == "all") {
     368  document.calendar.longitude.value = 0.
     369}
     370if ( document.calendar.latitude.value == "all") {
     371  document.calendar.latitude.value = 0.
     372}
     373}
    365374
    366375function PlaceValues(lon,lat){
Note: See TracChangeset for help on using the changeset viewer.