Hi Thejna
Just looking at the numbers, I would say that the 'vavg=-296.803'
looks about right. [The 52.5N, 13E is approximately for Berlin.]
The 'dp' are layer thicknesses in pressure. They 'dp' look like they
are in Pa. The look reasonable. The 'dp' are weights for
each pressure level. The formula is:
x_wgt_avg = SUM[ x(p)*wgt(p) ]/ SUM[ wgt(p) ]
--- I am not sure how the 'ncwa' operator was used. Clearly, the -146 is wrong if it is for the same location. Perhaps, you should send a help request to http://sourceforge.net/projects/nco/forums/forum/9830 Note: ncl-talk does not respond to usage or help regarding the NCO. Good Luck On 12/27/12 7:25 AM, Thejna Tharammal wrote: > Thank you. I tried the steps and the results are as below: > ;============================================================= > Variable: dp > Type: float > Total Size: 479232 bytes > 119808 values > Number of Dimensions: 3 > Dimensions and sizes: [26] x [48] x [96] > Coordinates: > > > Variable: vavg > Type: float > Total Size: 18432 bytes > 4608 values > Number of Dimensions: 2 > Dimensions and sizes: [lat | 48] x [lon | 96] > Coordinates: > lat: [-87.15909455586285..87.15909455586285] > lon: [ 0..356.25] > Number Of Attributes: 3 > units : Permil > long_name : Weighted Vertical Average: ~F33~d~F26~D in vapor > _FillValue : -9999 > (0) vavg: min=-476.326 max=-260.598 > (0) --- > (0) x=-269.741 dp=270.114 xdp=-72860.8 > (1) x=-299.394 dp=498.721 xdp=-149314 > (2) x=-349.433 dp=816.959 xdp=-285473 > (3) x=-414.574 dp=1178.52 xdp=-488584 > (4) x=-478.909 dp=1478.61 xdp=-708119 > (5) x=-527.338 dp=1698.25 xdp=-895554 > (6) x=-557.539 dp=1690.66 xdp=-942606 > (7) x=-571.784 dp=1372.02 xdp=-784498 > (8) x=-577.103 dp=1614.11 xdp=-931507 > (9) x=-572.299 dp=1898.91 xdp=-1.08675e+06 > (10) x=-538.315 dp=2233.97 xdp=-1.20258e+06 > (11) x=-500.48 dp=2628.16 xdp=-1.31534e+06 > (12) x=-484.412 dp=3091.88 xdp=-1.49775e+06 > (13) x=-470.985 dp=3637.45 xdp=-1.71318e+06 > (14) x=-432.153 dp=4279.27 xdp=-1.8493e+06 > (15) x=-372.448 dp=5034.33 xdp=-1.87503e+06 > (16) x=-325.192 dp=5922.63 xdp=-1.92599e+06 > (17) x=-283.061 dp=6967.67 xdp=-1.97228e+06 > (18) x=-251.629 dp=8197.11 xdp=-2.06263e+06 > (19) x=-223.193 dp=9643.47 xdp=-2.15236e+06 > (20) x=-193.715 dp=9425.81 xdp=-1.82592e+06 > (21) x=-167.191 dp=8580.53 xdp=-1.43459e+06 > (22) x=-143.797 dp=7158.41 xdp=-1.02936e+06 > (23) x=-125.373 dp=5219.05 xdp=-654326 > (24) x=-115.379 dp=2883.48 xdp=-332693 > (25) x=-111.104 dp=1475.61 xdp=-163946 > (0) --- > (0) LAT=52.5 LON=13 vavg=-296.803 > (0) --- > ;============================================================= > > I am not sure how to interpret the dp values, could you please explain if > they are in the acceptable range? > For the same coordinates, I get lower (~ -146) using ncwa vertical > integration. > Thanks, > Thejna > > ----------------original message----------------- > From: "Dennis Shea" shea@ucar.edu > To: "Thejna Tharammal" ttharammal@marum.de > CC: ncl-talk@ucar.edu > Date: Wed, 26 Dec 2012 21:54:56 -0700 > ------------------------------------------------- > > >> Why not debug at one grid point? >> >> >> http://www.ncl.ucar.edu/Document/Functions/Built-in/dpres_hybrid_ccm >> .shtml >> >> Example 3 ... modified here >> >> --- >> >> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" >> >> .... >> >> dp = dpres_hybrid_ccm (ps,p0,hyai,hybi) ; Pa >> xdp = x*dp ; (temporary variable) >> copy_VarCoords(x, xdp) >> >> vint = dim_sum_n( xdp, 1) >> dpsum= dim_sum_n( dp, 1) >> vavg = vint/dpsum ; weight average >> >> copy_VarCoords(ps, vavg) ; add variable meta data >> vavg@long_name = "Weighted Vertical Average: "+x@long_name >> vavg@units = x@units >> printVarSummary(vavg) >> print("vavg: min="+min(vavg)+" max="+max(vavg)) >> >> LAT = 52.5 ; arbitrary grid point >> LON = 13.0 >> >> nt = 0 >> print("---") >> copy_VarCoords(x, dp) >> print("x="+x(nt,:,{LAT},{LON}) +" dp="+ dp(nt,:,{LAT},{LON}) +" >> xdp="+xdp(nt,:,{LAT},{LON})) >> print("---") >> print("LAT="+LAT+" LON="+LON+" vavg="+vavg(nt,{LAT},{LON})) >> print("---") >> >> delete( [/dp, xdp, ps, vint, dpsum/] ) ; delete temporary variables >> >> >> >> >> >> On 12/26/12 8:12 PM, Thejna Tharammal wrote: >>> >>> Hi all, >>> >>> I want to calculate the total column mean of a variable from the CCSM > model >>> results. I tried to use dim_sum_n for the purpose as, >>> >>> ;************************************** >>> >>> >>> dp = dpres_hybrid_ccm (ps,p0,hyai,hybi) >>> >>> xdp=x(0,:,:,:)*dp >>> >>> vint=x(0,0,:,:) >>> >>> vint = dim_sum_n(xdp,0) >>> >>> ; for average, 1/(b-a) * integral ( from a to b ) of f(x) >>> >>> vintAvg=vint >>> >>> vintAvg =vint/dim_sum_n(dp, 0) >>> >>> ;************************************** >>> >>> I find that the results obtained are very different from the ones > calculated >>> using nco vertical integration functions ("ncwa -a lev") as a test. So I >>> wonder if the >>> method I used is correct? >>> >>> Thanks, >>> >>> Thejna >>> >>> >>> >>> >>> >>> _______________________________________________ >>> ncl-talk mailing list >>> List instructions, subscriber options, unsubscribe: >>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk >>> >> > > _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Thu Dec 27 09:16:45 2012
This archive was generated by hypermail 2.1.8 : Fri Jan 04 2013 - 15:32:29 MST