Re: question on how to calculate the area sum with two-dimensional coordinates data

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 27 2013 - 14:00:12 MDT

Try the following.

http://www.ncl.ucar.edu/Document/Functions/Built-in/gc_qarea.shtml

There are a few points on the grid that have repetitve values but
at other location, I thin the following works ok.

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

   re = 6.37122e06 ; [m] average radius of earth
   re2 = re^2

   diri = "./"
   fili = "sic_OImon_MRI-CGCM3_historical_r1i1p1_185001-200512.nc"
   f = addfile(diri+fili,"r")
   sic = f->sic ; sic(time, rlat, rlon)
   latv = f->lat_vertices ; latv(rlat, rlon, vertices)
   lonv = f->lon_vertices ; lonv(rlat, rlon, vertices)

   area = re2*gc_qarea(latv, lonv)
   area!0 = latv!0
   area!1 = latv!1
   area@long_name = "area of grid cells"
   area@units = "m^2"

   printVarSummary(area)
   print("area: min="+min(area)+" max="+max(area))

  ;if (any(isnan_ieee(area))) then
  ; value = 1.e20
  ; replace_ieeenan (area, value, 0)
  ; area@_FillValue = value
  ; printVarSummary(area)
  ; print("area: min="+min(area)+" max="+max(area))
  ;end if

On 03/27/2013 01:12 PM, Dennis Shea wrote:
> Hi Tingting
>
> Can you please point me toward a dataset so I may look at it?
> Ideally, the file would contain an area variable. For example,
> the POP models have
>
> float TAREA(nlat, nlon) ;
> TAREA:long_name = "area of T cells" ;
> TAREA:units = "centimeter^2" ;
> TAREA:coordinates = "TLONG TLAT" ;
> TAREA:_FillValue = 9.96921e+36f ;
> TAREA:missing_value = 9.96921e+36f ;
>
> Consider:
>
> x(time,nlat,nlon) [ dimension #s (0,1,2) ]
>
> A global weighted mean would be
>
> xAVG = dim_sum_n(x*conform(x,TAREA,(/1,2/)),0)/ sum(TAREA)
>
> Then xAVG(ntim)
>
> On 3/27/13 11:40 AM, tingting@ucar.edu wrote:
>> Hello,
>> I am doing the MRI-CGCM3 model output validation and need to calculate
>> SIE(sea ice extent), the coordinates of MRI output are two-dimensional,
>> while the NCL function(wgt_areasum2) seems to deal with data with regular
>> coordinates, right?
>> So,my question is that how to calculate the area sum? Or, do I need to
>> regrid the MRI to regular-grid data?
>> Thank you for any coming help in advance.
>> Tingting
>>
>>
>> _______________________________________________
>> 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-talk
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Mar 27 14:00:22 2013

This archive was generated by hypermail 2.1.8 : Tue Apr 02 2013 - 21:23:48 MDT