Changeset 1581 in lmdz_wrf
- Timestamp:
- Jun 9, 2017, 9:51:14 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diagnostics.py
r1419 r1581 304 304 zclear = 1. 305 305 zcloud = 0. 306 ncvar.percendone(it*dx*dy + ix*dy + iy, dx*dy*dt, 5, 'diagnosted')306 gen.percendone(it*dx*dy + ix*dy + iy, dx*dy*dt, 5, 'diagnosted') 307 307 clt[it,iy,ix] = var_clt(cldfra[it,:,iy,ix]) 308 308 … … 318 318 zclear = 1. 319 319 zcloud = 0. 320 ncvar.percendone(ix*dy + iy, dx*dy*dt, 5, 'diagnosted')320 gen.percendone(ix*dy + iy, dx*dy*dt, 5, 'diagnosted') 321 321 clt[iy,ix] = var_clt(cldfra[:,iy,ix]) 322 322 … … 463 463 for ix in range(dx): 464 464 for iy in range(dy): 465 ncvar.percendone(it*dx*dy + ix*dy + iy, dx*dy*dt, 5, 'diagnosted')465 gen.percendone(it*dx*dy + ix*dy + iy, dx*dy*dt, 5, 'diagnosted') 466 466 cllmh[:,it,iy,ix] = var_cllmh(cldfra[it,:,iy,ix], pres[it,:,iy,ix]) 467 467 … … 477 477 for ix in range(dx): 478 478 for iy in range(dy): 479 ncvar.percendone(ix*dy + iy,dx*dy, 5, 'diagnosted')479 gen.percendone(ix*dy + iy,dx*dy, 5, 'diagnosted') 480 480 cllmh[:,iy,ix] = var_cllmh(cldfra[:,iy,ix], pres[:,iy,ix]) 481 481 482 482 return cllmh, cllmhdims, cllmhvdims 483 484 def compute_clivi(dens, qtot, dimns, dimvns): 485 """ Function to compute cloud-ice water path (clivi) 486 [dens] = density [in kgkg-1] (assuming [t],z,y,x) 487 [qtot] = added mixing ratio of all cloud-ice species in [kgkg-1] (assuming [t],z,y,x) 488 [dimns]= list of the name of the dimensions of [q] 489 [dimvns]= list of the name of the variables with the values of the 490 dimensions of [q] 491 """ 492 fname = 'compute_clivi' 493 494 clividims = dimns[:] 495 clivivdims = dimvns[:] 496 497 if len(qtot.shape) == 4: 498 clividims.pop(1) 499 clivivdims.pop(1) 500 else: 501 clividims.pop(0) 502 clivivdims.pop(0) 503 504 data1 = dens*qtot 505 clivi = np.sum(data1, axis=1) 506 507 return clivi, clividims, clivivdims 508 509 510 def compute_clwvl(dens, qtot, dimns, dimvns): 511 """ Function to compute condensed water path (clwvl) 512 [dens] = density [in kgkg-1] (assuming [t],z,y,x) 513 [qtot] = added mixing ratio of all cloud-water species in [kgkg-1] (assuming [t],z,y,x) 514 [dimns]= list of the name of the dimensions of [q] 515 [dimvns]= list of the name of the variables with the values of the 516 dimensions of [q] 517 """ 518 fname = 'compute_clwvl' 519 520 clwvldims = dimns[:] 521 clwvlvdims = dimvns[:] 522 523 if len(qtot.shape) == 4: 524 clwvldims.pop(1) 525 clwvlvdims.pop(1) 526 else: 527 clwvldims.pop(0) 528 clwvlvdims.pop(0) 529 530 data1 = dens*qtot 531 clwvl = np.sum(data1, axis=1) 532 533 return clwvl, clwvldims, clwvlvdims 483 534 484 535 def var_virtualTemp (temp,rmix): … … 619 670 qvapor[it,:,iy,ix]) 620 671 621 ncvar.percendone(it*dx*dy + ix*dy + iy, dx*dy*dt, 5, 'diagnosted')672 gen.percendone(it*dx*dy + ix*dy + iy, dx*dy*dt, 5, 'diagnosted') 622 673 else: 623 674 mslpv[:,iy,ix] = psurface[:,iy,ix] … … 639 690 for ix in range(dx): 640 691 for iy in range(dy): 641 ncvar.percendone(ix*dy + iy,dx*dy, 5, 'diagnosted')692 gen.percendone(ix*dy + iy,dx*dy, 5, 'diagnosted') 642 693 if terval[iy,ix] > 0.: 643 694 mslpv[iy,ix] = var_mslp(pressure[:,iy,ix], psurface[iy,ix], \ … … 879 930 availdiags = ['ACRAINTOT', 'accum', 'clt', 'cllmh', 'deaccum', 'LMDZrh', 'mslp', \ 880 931 'OMEGAw', 'RAINTOT', \ 881 'rvors', 'td', 'turbulence', 'WRF geop', 'WRFp', 'WRFrvors', 'ws', 'wds', 'wss',\882 'WRF height', 'WRFheightrel', 'WRFua', 'WRFva']932 'rvors', 'td', 'turbulence', 'WRFclivi', 'WRFclwvl', 'WRFgeop', 'WRFp', \ 933 'WRFrvors', 'ws', 'wds', 'wss', 'WRFheight', 'WRFheightrel', 'WRFua', 'WRFva'] 883 934 884 935 methods = ['accum', 'deaccum'] … … 886 937 # Variables not to check 887 938 NONcheckingvars = ['cllmh', 'deaccum', 'TSrhs', 'TStd', 'TSwds', 'TSwss', 'WRFbils', \ 888 'WRF dens', 'WRFgeop',\939 'WRFclivi', 'WRFclwvl', 'WRFdens', 'WRFgeop', \ 889 940 'WRFp', 'WRFtd', \ 890 941 'WRFpos', 'WRFprc', 'WRFprls', 'WRFrh', 'LMDZrh', 'LMDZrhs', 'WRFrhs', 'WRFrvors', \ … … 1305 1356 dnamesvar, dvnamesvar) 1306 1357 1358 # Removing the nonChecking variable-dimensions from the initial list 1359 varsadd = [] 1360 diagoutvd = list(dvnames) 1361 for nonvd in NONchkvardims: 1362 if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd) 1363 varsadd.append(nonvd) 1307 1364 ncvar.insert_variable(ncobj, 'psl', diagout, diagoutd, diagoutvd, newnc) 1308 1365 … … 1472 1529 ncvar.insert_variable(ncobj, 'bils', diagout, dnamesvar, dvnamesvar, newnc) 1473 1530 1531 # WRFclivi WRF water vapour path WRFdens, QICE, QGRAUPEL, QHAIL 1532 elif diag == 'WRFclivi': 1533 1534 var0 = WRFdens 1535 qtot = ncobj.variables[depvars[1]] 1536 qtotv = qtot[:] 1537 Nspecies = len(depvars) - 2 1538 for iv in range(Nspecies): 1539 var1 = ncobj.variables[depvars[iv+2]][:] 1540 qtotv = qtotv + var1 1541 1542 dnamesvar = list(qtot.dimensions) 1543 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 1544 1545 diagout, diagoutd, diagoutvd = compute_clivi(var0, qtotv, dnamesvar,dvnamesvar) 1546 1547 # Removing the nonChecking variable-dimensions from the initial list 1548 varsadd = [] 1549 diagoutvd = list(dvnames) 1550 for nonvd in NONchkvardims: 1551 if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd) 1552 varsadd.append(nonvd) 1553 ncvar.insert_variable(ncobj, 'clivi', diagout, diagoutd, diagoutvd, newnc) 1554 1555 # WRFclwvl WRF water cloud-condensed path WRFdens, QCLOUD, QICE, QGRAUPEL, QHAIL 1556 elif diag == 'WRFclwvl': 1557 1558 var0 = WRFdens 1559 qtot = ncobj.variables[depvars[1]] 1560 qtotv = ncobj.variables[depvars[1]] 1561 Nspecies = len(depvars) - 2 1562 for iv in range(Nspecies): 1563 var1 = ncobj.variables[depvars[iv+2]] 1564 qtotv = qtotv + var1[:] 1565 1566 dnamesvar = list(qtot.dimensions) 1567 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 1568 1569 diagout, diagoutd, diagoutvd = compute_clwvl(var0, qtotv, dnamesvar,dvnamesvar) 1570 1571 # Removing the nonChecking variable-dimensions from the initial list 1572 varsadd = [] 1573 diagoutvd = list(dvnames) 1574 for nonvd in NONchkvardims: 1575 if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd) 1576 varsadd.append(nonvd) 1577 ncvar.insert_variable(ncobj, 'clwvl', diagout, diagoutd, diagoutvd, newnc) 1578 1474 1579 # WRFgeop geopotential from WRF as PH + PHB 1475 1580 elif diag == 'WRFgeop':
Note: See TracChangeset
for help on using the changeset viewer.