Changeset 1343 for trunk/UTIL
- Timestamp:
- Aug 26, 2014, 11:53:30 PM (10 years ago)
- Location:
- trunk/UTIL/PYTHON/mcd
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/mcd/frozen_myplot.py
r944 r1343 987 987 zevmax = mean(fieldcalc) + dev ### for continuity 988 988 ### 989 if zevmin < 0. and min(fieldcalc) > 0.: zevmin = 0. 989 if zevmin < min(fieldcalc): zevmin = min(fieldcalc) 990 if zevmax > max(fieldcalc): zevmax = max(fieldcalc) 991 #if zevmin < 0. and min(fieldcalc) > 0.: zevmin = 0. 990 992 #print "BOUNDS field ", min(fieldcalc), max(fieldcalc), " //// adopted", zevmin, zevmax 991 993 return zevmin, zevmax -
trunk/UTIL/PYTHON/mcd/inimeso/inimeso5.py
r1075 r1343 7 7 from mcd import mcd 8 8 9 rho_dust = 2500. # Mars dust density (kg.m-3) 10 grav = 3.72 11 ksi = 3. / 4. / rho_dust / grav 12 nueff = 0.5 13 9 14 ### MCD INSTANCE and SETTINGS (actually, default. but one never knows) 10 15 query = mcd() ; query.zkey = 3 ; query.dust = 2 ; query.hrkey = 1 11 12 16 query.toversion5() 13 17 … … 20 24 ### OPEN FILES TO BE WRITTEN 21 25 sounding = open("input_sounding", "w") ; additional = open("input_therm", "w") ; more = open("input_more", "w") 26 dust = open("input_dust", "w") 22 27 23 28 ### GET and WRITE SURFACE VALUES 24 29 query.xz = 0.1 ; query.update() ; query.printmeanvar() 25 sounding.write( "%10.2f%12.2f%12.2f\n" % (query.pres/100.,query.temp*(610./query.pres)**(1.0/3.9),0.) ) 30 query.extvar[42] = 1.5*1e-3 31 query.extvar[44] = 0.0 32 sounding.write( "%10.2f%12.2f%12.2f\n" % (query.pres/100.,query.temp*(610./query.pres)**(1.0/3.9),(query.extvar[42]+query.extvar[44])*1e3) ) 26 33 more.write( "%10.2f%10.2f" % (query.extvar[1],query.extvar[14]) ) ; more.close() 27 34 … … 29 36 query.profile( tabperso = np.append([0.1,5,10,20,50,100],np.linspace(200.,float(split(lines[4])[0])*1000.,float(split(lines[5])[0]))) ) 30 37 for iz in range(len(query.prestab)): 38 39 query.extvartab[iz,42] = 1.5*1e-3 40 query.extvartab[iz,44] = 0.0 41 31 42 sounding.write( "%10.2f%12.2f%12.2f%12.2f%12.2f\n" % ( \ 32 43 query.extvartab[iz,2],query.temptab[iz]*(610./query.prestab[iz])**(1.0/3.9),\ 33 0.,query.zonwindtab[iz],query.merwindtab[iz]) ) 44 (query.extvartab[iz,42]+query.extvartab[iz,44])*1e3,\ 45 query.zonwindtab[iz],query.merwindtab[iz]) ) 34 46 additional.write( "%12.2f%12.2f%18.6e%18.6e%12.2f\n" % ( \ 35 47 query.extvartab[iz,53],query.extvartab[iz,8],\ 36 48 query.prestab[iz],query.denstab[iz],query.temptab[iz]) ) 37 49 50 ### DUST PROFILES 51 q = query.extvartab[iz,38] # extvar(38)= Dust mass mixing ratio (kg/kg) 52 reff = query.extvartab[iz,39] # extvar(39)= Dust effective radius (m) 53 print q,reff 54 N = (grav*ksi*((1+nueff)**3)/np.pi)*q/(reff**3) 55 dust.write( "%18.6e%18.6e\n" % (q,N) ) 56 38 57 ### FINISH 39 sounding.close() ; additional.close() 40 query.plot1d(["p","t","u","v"]) ; mpl.show() 58 sounding.close() ; additional.close() ; dust.close() 59 query.plot1d(["p","t","u","v","h2ovap","h2oice"]) ; mpl.show() 60 -
trunk/UTIL/PYTHON/mcd/mcd.py
r1338 r1343 512 512 513 513 def vertlabel(self): 514 # if self.zkey == 1: self.xlabel = "radius from centre of planet (m)" 515 # elif self.zkey == 2: self.xlabel = "height above areoid (m) (MOLA zero datum)" 516 # elif self.zkey == 3: self.xlabel = "height above surface (m)" 517 # elif self.zkey == 4: self.xlabel = "pressure level (Pa)" 518 # elif self.zkey == 5: self.xlabel = "altitude above mean Mars Radius(=3396000m) (m)" 514 519 if self.zkey == 1: self.xlabel = "radius from centre of planet (m)" 515 elif self.zkey == 2: self.xlabel = " height above areoid (m) (MOLA zero datum)"520 elif self.zkey == 2: self.xlabel = "altitude above MOLA$_0$ (m)" 516 521 elif self.zkey == 3: self.xlabel = "height above surface (m)" 517 elif self.zkey == 4: self.xlabel = "pressure level(Pa)"518 elif self.zkey == 5: self.xlabel = "altitude above mean Mars Radius(=3396000m)(m)"522 elif self.zkey == 4: self.xlabel = "pressure (Pa)" 523 elif self.zkey == 5: self.xlabel = "altitude above mean Mars radius (m)" 519 524 520 525 def vertunits(self): … … 665 670 if not self.vertplot and self.islog: ax.set_yscale('log') 666 671 if self.vertplot and self.islog: ax.set_xscale('log') 672 673 #ax.ticklabel_format(useOffset=False,axis='x') 674 #ax.ticklabel_format(useOffset=False,axis='y') 667 675 668 676 if self.lats is not None: ax.set_xticks(np.arange(-90,91,15)) ; ax.set_xbound(lower=self.lats, upper=self.late) … … 815 823 for i in range(len(tabtodo)): mpl.subplot(subv,subh,i+1) ; self.makemap2d(tabtodo[i],incwind=incwind,proj=proj) 816 824 825 def makeinterv(self): 826 self.latinterv = 30. 827 self.loninterv = 45. 828 if self.lats is not None: 829 if (abs(self.late-self.lats) < 90.): self.latinterv = 10. 830 if (abs(self.late-self.lats) < 10.): self.latinterv = 1. 831 if self.lons is not None: 832 if (abs(self.lone-self.lons) < 135.): self.loninterv = 15. 833 if (abs(self.lone-self.lons) < 15.): self.loninterv = 1. 834 817 835 def htmlmap2d(self,tabtodo,incwind=False,figname="temp.png",back="zMOL"): 818 836 ### complete 2D figure with possible multiplots … … 890 908 [x2d,y2d] = np.meshgrid(x,y) 891 909 yeah.quiver(x2d,y2d,np.transpose(windx),np.transpose(windy)) 910 892 911 ax = fig.gca() ; ax.set_ylabel("Latitude") ; ax.set_xlabel("Longitude") 893 ax.set_xticks(np.arange(-360,361,45)) ; ax.set_xbound(lower=self.lons, upper=self.lone) 894 ax.set_yticks(np.arange(-90,91,30)) ; ax.set_ybound(lower=self.lats, upper=self.late) 912 913 # make intervals 914 self.makeinterv() 915 ax.set_xticks(np.arange(-360,361,self.loninterv)) ; ax.set_xbound(lower=self.lons, upper=self.lone) 916 ax.set_yticks(np.arange(-90,91,self.latinterv)) ; ax.set_ybound(lower=self.lats, upper=self.late) 895 917 self.gettitle() 896 918 fig.text(0.5, 0.95, self.title, ha='center') … … 952 974 ax = fig.gca() ; ax.set_ylabel(self.ylabel) ; ax.set_xlabel(self.xlabel) 953 975 954 if self.lons is not None: ax.set_xticks(np.arange(-360,361,45)) ; ax.set_xbound(lower=self.lons, upper=self.lone) 955 elif self.lats is not None: ax.set_xticks(np.arange(-90,91,30)) ; ax.set_xbound(lower=self.lats, upper=self.late) 976 self.makeinterv() 977 if self.lons is not None: ax.set_xticks(np.arange(-360,361,self.loninterv)) ; ax.set_xbound(lower=self.lons, upper=self.lone) 978 elif self.lats is not None: ax.set_xticks(np.arange(-90,91,self.latinterv)) ; ax.set_xbound(lower=self.lats, upper=self.late) 956 979 957 980 if self.locts is not None: -
trunk/UTIL/PYTHON/mcd/proto/cgi-bin/mcdcgi.py
r1277 r1343 98 98 99 99 # Get data from user-defined fields and define free dimensions 100 islatfree, query.lat, query.lats, query.late = gethtmlcoord( form.getvalue("latitude"), -90., 90. ) 100 getlat = form.getvalue("latitude") 101 if getlat is None: 102 errormess = errormess+"<li>A value or interval for latitude is missing. Please correct." 103 islatfree = False ; query.lat = 0. ; query.lats = 0. ; query.late = 0. 104 else: 105 islatfree, query.lat, query.lats, query.late = gethtmlcoord( getlat, -90., 90. ) 101 106 islonfree, query.lon, query.lons, query.lone = gethtmlcoord( form.getvalue("longitude"), -180., 180. ) 102 107 isloctfree, query.loct, query.locts, query.locte = gethtmlcoord( form.getvalue("localtime"), 0., 24. )
Note: See TracChangeset
for help on using the changeset viewer.