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>  f0      = addfile("pop.h.nc","r")<BR>  SSH     = f0->SSH<BR>  TAREA   = f0->TAREA<BR>  lat2d = f0->TLAT<BR>  lon2d = f0->TLONG</P>
<P>  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>            122880 values<BR>Number of Dimensions: 3<BR>Dimensions and sizes:   [time | 1] x [nlat | 384] x [nlon | 320]<BR>Coordinates: <BR>            time: [712146..712146]<BR>Number Of Attributes: 6<BR>  long_name :   Sea Surface Height<BR>  units :       centimeter<BR>  coordinates : TLONG TLAT time<BR>  cell_methods :        time: mean<BR>  _FillValue :  9.96921e+36<BR>  missing_value :       9.96921e+36<BR>===============================================================</P>
z{Sʗ{VZǭ0U슉
z{S}ĝx;
z{Ch+bx)ޝmjY&j)b	b.+-{--rz)*'칻&ކiYnffX)ߣܖ֥
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