Problem of area weighted sum using "wgt_areasum2" function

From: jun <jcheng2_at_nyahnyahspammersnyahnyah>
Date: Thu, 18 Sep 2008 13:22:31 -0500

Hello

When I using function "wgt_areasum2" to calculate the total sum of
heat flux for each ocean, the results look like some weird, so I use
the following script to test this function of area weighted sum. The
variable "ar" in ocn_g.nc file has been set to "1" in ocean grid
and to missing value at land grid. So the sum using this function
should be the total area of global ocean.

The calculating result of global ocean area is 1.6348*10^14*m^2, but
the actual value should be 3.61*10^14*m^2 (refer to: http://
en.wikipedia.org/wiki/Ocean).

  So, could you give me some suggestion about using of this function?

Thanks.

Jun Cheng

; Area of global ocn
;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;************************************************
begin
;************************************************
; Read in shferature
;************************************************
   ds = addfile("/ptmp/jcheng2/ocn_g.nc","r")

   ar = ds->og
   lat = ds->lat
   lon = ds->lon
;*************************************************
; Area average
;*************************************************
     lat1 = new(dimsizes(lat({-90:90})),float)
     lon1 = new(dimsizes(lon({0:360})),float)
     lat1 = lat({-90:90})
     lon1 = lon({0:360})

     jlat = dimsizes( lat1 )
     rad = 4.0*atan(1.0)/180.0
     re = 6371220.0
     rr = re*rad
     dlon = abs(lon1(2)-lon1(1))*rr

     dx = dlon*cos(lat1*rad)
     dy = new ( jlat, typeof(dx))
     dy(0) = abs(lat1(2)-lat1(1))*rr
     dy(1:jlat-2) = abs(lat1(2:jlat-1)-lat1(1:jlat-2))*rr*0.5
     dy(jlat-1) = abs(lat1(jlat-1)-lat1(jlat-2))*rr

     area0 = dx*dy ;
cell area function of latitude only
     area = new((/dimsizes(lat1),dimsizes(lon1)/),float)
     area = conform(area,area0,0)

     ari = wgt_areasum2(ar({-90:90},{0:360}), area, 0)

   print(ari)

end

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 18 2008 - 12:22:31 MDT

This archive was generated by hypermail 2.2.0 : Tue Sep 23 2008 - 14:12:01 MDT