Changeset 859 for trunk/UTIL/PYTHON/mcd/mcd.py
- Timestamp:
- Jan 8, 2013, 9:33:07 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/mcd/mcd.py
r827 r859 8 8 9 9 import numpy as np 10 import fmcd11 10 import matplotlib.pyplot as mpl 12 11 import myplot … … 84 83 self.dpi = 80. 85 84 85 def toversion5(self): 86 self.name = "MCD v5.0" 87 self.dset = '/home/marshttp/MCD_v5.0/data/' 88 self.extvarkey = np.ones(100) 89 86 90 def viking1(self): self.name = "Viking 1 site. MCD v4.3 output" ; self.lat = 22.48 ; self.lon = -49.97 ; self.xdate = 97. 87 91 def viking2(self): self.name = "Viking 2 site. MCD v4.3 output" ; self.lat = 47.97 ; self.lon = -225.74 ; self.xdate = 117.6 88 92 89 93 def getdustlabel(self): 90 if self.dust == 1: self.dustlabel = " MY24minimum solar scenario"91 elif self.dust == 2: self.dustlabel = " MY24average solar scenario"92 elif self.dust == 3: self.dustlabel = " MY24maximum solar scenario"94 if self.dust == 1: self.dustlabel = "climatology minimum solar scenario" 95 elif self.dust == 2: self.dustlabel = "climatology average solar scenario" 96 elif self.dust == 3: self.dustlabel = "climatology maximum solar scenario" 93 97 elif self.dust == 4: self.dustlabel = "dust storm minimum solar scenario" 94 98 elif self.dust == 5: self.dustlabel = "dust storm average solar scenario" … … 140 144 17: "daily min mean surface temperature (K)",\ 141 145 18: "surf. temperature RMS day to day variations (K)",\ 142 19: "surface pressure ( high resolution if hireskey=1)",\146 19: "surface pressure (Pa)",\ 143 147 20: "GCM surface pressure (Pa)",\ 144 148 21: "atmospheric pressure RMS day to day variations (Pa)",\ … … 173 177 50: "Air viscosity estimation (N s m-2)" 174 178 } 179 ### MCD version 5 new variables. AS 12/2012. 180 if "v5" in self.name: 181 whichfield[29] = "not used (set to zero)" 182 whichfield[30] = "Surface roughness length z0 (m)" 183 whichfield[37] = "DOD RMS day to day variations" 184 whichfield[38] = "Dust mass mixing ratio (kg/kg)" 185 whichfield[39] = "Dust effective radius (m)" 186 whichfield[44] = whichfield[43] 187 whichfield[43] = whichfield[42] 188 whichfield[42] = whichfield[41] 189 whichfield[41] = whichfield[40] 190 whichfield[40] = "Dust deposition on flat surface (kg m-2 s-1)" 191 whichfield[45] = "Water ice effective radius (m)" 192 whichfield[46] = "Convective PBL height (m)" 193 whichfield[47] = "Max. upward convective wind within the PBL (m/s)" 194 whichfield[48] = "Max. downward convective wind within the PBL (m/s)" 195 whichfield[49] = "Convective vertical wind variance at level z (m2/s2)" 196 whichfield[50] = "Convective eddy vertical heat flux at level z (m/s/K)" 197 whichfield[51] = "Surface wind stress (Kg/m/s2)" 198 whichfield[52] = "Surface sensible heat flux (W/m2) (<0 when flux from surf to atm.)" 199 whichfield[53] = "R: Molecular gas constant (J K-1 kg-1)" 200 whichfield[54] = "Air viscosity estimation (N s m-2)" 201 whichfield[55] = "not used (set to zero)" 202 whichfield[56] = "not used (set to zero)" 203 whichfield[57] = "[CO2] vol. mixing ratio (mol/mol)" 204 whichfield[58] = "[N2] vol. mixing ratio (mol/mol)" 205 whichfield[59] = "[Ar] vol. mixing ratio (mol/mol)" 206 whichfield[60] = "[CO] vol. mixing ratio (mol/mol)" 207 whichfield[61] = "[O] vol. mixing ratio (mol/mol)" 208 whichfield[62] = "[O2] vol. mixing ratio (mol/mol)" 209 whichfield[63] = "[O3] vol. mixing ratio (mol/mol)" 210 whichfield[64] = "[H] vol. mixing ratio (mol/mol)" 211 whichfield[65] = "[H2] vol. mixing ratio (mol/mol)" 212 whichfield[66] = "[electron] vol. mixing ratio (mol/mol)" 213 whichfield[67] = "CO2 column (kg/m2)" 214 whichfield[68] = "N2 column (kg/m2)" 215 whichfield[69] = "Ar column (kg/m2)" 216 whichfield[70] = "CO column (kg/m2)" 217 whichfield[71] = "O column (kg/m2)" 218 whichfield[72] = "O2 column (kg/m2)" 219 whichfield[73] = "O3 column (kg/m2)" 220 whichfield[74] = "H column (kg/m2)" 221 whichfield[75] = "H2 column (kg/m2)" 222 whichfield[76] = "electron column (kg/m2)" 175 223 if num not in whichfield: myplot.errormess("Incorrect subscript in extvar.") 176 177 224 dastuff = whichfield[num] 178 179 225 if "(K)" in dastuff: self.fmt="%.0f" 180 226 elif "(Pa)" in dastuff: self.fmt="%.1f" 181 227 elif "(W/m2)" in dastuff: self.fmt="%.0f" 182 228 elif "(m/s)" in dastuff: self.fmt="%.1f" 229 elif "(m)" in dastuff: self.fmt="%.0f" 183 230 else: self.fmt="%.2e" 184 185 231 return dastuff 186 232 … … 197 243 elif num == "ps": num = 19 198 244 elif num == "tau": num = 36 199 elif num == "mtot": num = 40 200 elif num == "icetot": num = 42 245 elif num == "mtot": 246 if "v5" in self.name: num = 41 247 else: num = 40 248 elif num == "icetot": 249 if "v5" in self.name: num = 43 250 else: num = 42 201 251 elif num == "ps_ddv": num = 22 202 elif num == "h2ovap": num = 41 203 elif num == "h2oice": num = 43 252 elif num == "h2ovap": 253 if "v5" in self.name: num = 42 254 else: num = 41 255 elif num == "h2oice": 256 if "v5" in self.name: num = 44 257 else: num = 43 204 258 elif num == "cp": num = 8 205 259 elif num == "rho_ddv": num = 10 … … 210 264 elif num == "lwup": num = 33 211 265 elif num == "swup": num = 34 212 elif num == "o3": num = 44 213 elif num == "o": num = 46 214 elif num == "co": num = 48 215 elif num == "visc": num = 50 266 elif num == "o3": 267 if "v5" in self.name: num = 63 268 else: num = 44 269 elif num == "o": 270 if "v5" in self.name: num = 61 271 else: num = 46 272 elif num == "co": 273 if "v5" in self.name: num = 60 274 else: num = 48 275 elif num == "visc": 276 if "v5" in self.name: num = 54 277 else: num = 50 216 278 elif num == "co2ice": num = 35 279 elif num == "pbl": 280 if "v5" in self.name: num = 46 281 else: num = 30 # an undefined variable to avoid misleading output 282 elif num == "updraft": 283 if "v5" in self.name: num = 47 284 else: num = 30 # an undefined variable to avoid misleading output 285 elif num == "downdraft": 286 if "v5" in self.name: num = 48 287 else: num = 30 # an undefined variable to avoid misleading output 288 elif num == "pblwvar": 289 if "v5" in self.name: num = 49 290 else: num = 30 # an undefined variable to avoid misleading output 291 elif num == "pblhvar": 292 if "v5" in self.name: num = 50 293 else: num = 30 # an undefined variable to avoid misleading output 294 elif num == "stress": 295 if "v5" in self.name: num = 51 296 else: num = 30 # an undefined variable to avoid misleading output 297 elif num == "ar": 298 if "v5" in self.name: num = 59 299 else: num = 30 # an undefined variable to avoid misleading output 217 300 elif not isinstance(num, np.int): myplot.errormess("field reference not found.") 218 301 return num … … 230 313 self.locte = abs(self.locte)%24 231 314 if self.locts == self.locte: self.locte = self.locts + 24 232 if self.lat > 90.: self.lat = 90.233 if self.lat < -90.: self.lat = -90.234 if self.lats is not None and self.late is not None:235 if abs(self.lats) > 90.: self.lats = 90.236 if abs(self.late) > 90.: self.late = 90.237 if abs(self.lats) < -90.: self.lats = -90.238 if abs(self.late) < -90.: self.late = -90.239 315 ## now MCD request 316 if "v5" in self.name: from fmcd5 import call_mcd 317 else: from fmcd import call_mcd 240 318 (self.pres, self.dens, self.temp, self.zonwind, self.merwind, \ 241 319 self.meanvar, self.extvar, self.seedout, self.ierr) \ 242 320 = \ 243 fmcd.call_mcd(self.zkey,self.xz,self.lon,self.lat,self.hrkey, \321 call_mcd(self.zkey,self.xz,self.lon,self.lat,self.hrkey, \ 244 322 self.datekey,self.xdate,self.loct,self.dset,self.dust, \ 245 323 self.perturkey,self.seedin,self.gwlength,self.extvarkey ) … … 262 340 strloct = str(self.loct)+str(self.locts)+str(self.locte) 263 341 name = str(self.zkey)+strxz+strlon+strlat+str(self.hrkey)+str(self.datekey)+str(self.xdate)+strloct+str(self.dust) 342 if "v5" in self.name: name = "v5beta_" + name 264 343 return name 265 344 … … 286 365 def printallextvar(self): 287 366 # print all extra MCD variables 288 for i in range(50): self.printextvar(i+1) 367 if "v5" in self.name: limit=76 368 else: limit=50 369 for i in range(limit): self.printextvar(i+1) 289 370 290 371 def htmlprinttabextvar(self,tabtodo): … … 813 894 canvas.print_figure(figname, dpi=self.dpi) 814 895 815 816 896 ### TODO: makeplot2d, plot2d, passer plot settings 817 897
Note: See TracChangeset
for help on using the changeset viewer.