regional average help

From: Changlin Chen <clchen_at_nyahnyahspammersnyahnyah>
Date: Tue Mar 23 2010 - 01:58:31 MDT

Hi,
I have a file output from ccsm_pop model, the lat and lon is 2D and not a monotonically increasing or decreasing array.
I want to calculate regional ocean average, and TAREA is a 2D weight array with the same size of lon and lat.
$----
  f0 = addfile("pop.h.nc","r")
  SSH = f0->SSH
  TAREA = f0->TAREA
  lat2d = f0->TLAT
  lon2d = f0->TLONG
  wp_ave = wgt_areaave2(SSH(0,{-20:20},{120:180}),TAREA({-20:20},{120:180}),0)
$----
But it can't work, with an error:
"fatal:Dimension (nlon) of (SSH) does not have an associated coordinate variable"
How can I solve these problems? Thanks!
============================================================
Variable: SSH
Type: float
Total Size: 491520 bytes
            122880 values
Number of Dimensions: 3
Dimensions and sizes: [time | 1] x [nlat | 384] x [nlon | 320]
Coordinates:
            time: [712146..712146]
Number Of Attributes: 6
  long_name : Sea Surface Height
  units : centimeter
  coordinates : TLONG TLAT time
  cell_methods : time: mean
  _FillValue : 9.96921e+36
  missing_value : 9.96921e+36
===============================================================

‰íz{SÊ—­{†Ù¥r«±ë
‰íz{S­©ì}êÄ�ÊŠxjǺ<P>Hi,<BR>I have a file output from ccsm_pop model, the lat and lon is 2D and not a monotonically increasing or decreasing array.<BR>I want to calculate regional ocean average, and TAREA is a 2D weight array with the same size of lon and lat.</P>
<P>$----<BR>&nbsp; f0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = addfile("pop.h.nc","r")<BR>&nbsp; SSH&nbsp;&nbsp;&nbsp;&nbsp; = f0-&gt;SSH<BR>&nbsp; TAREA&nbsp;&nbsp; = f0-&gt;TAREA<BR>&nbsp; lat2d = f0-&gt;TLAT<BR>&nbsp; lon2d = f0-&gt;TLONG</P>
<P>&nbsp; wp_ave = wgt_areaave2(SSH(0,{-20:20},{120:180}),TAREA({-20:20},{120:180}),0)<BR>$----<BR>But it can't work, with an error: </P>
<P>"fatal:Dimension (nlon) of (SSH) does not have an associated coordinate variable"</P>
<P>How can I solve these problems? Thanks!</P>
<P>============================================================<BR>Variable: SSH<BR>Type: float<BR>Total Size: 491520 bytes<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 122880 values<BR>Number of Dimensions: 3<BR>Dimensions and sizes:&nbsp;&nbsp; [time | 1] x [nlat | 384] x [nlon | 320]<BR>Coordinates: <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; time: [712146..712146]<BR>Number Of Attributes: 6<BR>&nbsp; long_name :&nbsp;&nbsp; Sea Surface Height<BR>&nbsp; units :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; centimeter<BR>&nbsp; coordinates : TLONG TLAT time<BR>&nbsp; cell_methods :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; time: mean<BR>&nbsp; _FillValue :&nbsp; 9.96921e+36<BR>&nbsp; missing_value :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 9.96921e+36<BR>===============================================================</P>
‰íz{SÊ—­{¦V¢�ÈZ®Ç­0ƒUê슉õ
‰íz{S­©ì}êÄ�ÊŠx;
‰íz{CŠÊh²+b¢x§–)Þ�ÉmjY&j)bž b.+-Š{-®ç-Š‰ì²æìr¸›zº)¶*'²éì¹»®&Þ†ÛiÿùšŠYšžç­çnþf¢–f§þX¬¶)ߣùÜ–Ö¥
Received on Tue Mar 23 02:00:37 2010

This archive was generated by hypermail 2.1.8 : Sat Mar 27 2010 - 07:18:15 MDT