problem with dim_avg and dim_avg_Wrap?

From: Anji Seth <anji.seth_at_nyahnyahspammersnyahnyah>
Date: Mon, 4 Dec 2006 10:03:26 -0500

Hello,

I am computing a time average of a 10-year timeseries of monthly
surface temperature
which I have pieced together from (12 month) annual nc files.
In this routine I am getting an error using dim_avg, which I do not
understand.
the errors is
"fatal:Dimension (0) of (tsAvgTime) is not named and therefore doesn't
have an as
sociated coordinate variable"
but the variable tsAvgTime is computed from, ts, does have lat and lon
variables associated?
  I have also tried "dim_avg_Wrap" to see if maintaining the meta data
might help, and then I get an error that says "dim_avg_Wrap" is
unidentified? (I have gsn_code.ncl, gsn_csm.ncl and
shea_util.ncl loaded).

Any help would be appreciated. I have included the pertinent parts of
my script
and run results below. Thanks very much! -Anji

The ncl script is as follows:

      26 lat = a1->lat
      27 lon = a1->lon
      28 nlat = 90
      29 nlon = 180
      30 nmon = 120
      31 time = ispan(1,120,1)
      32
      33 printVarSummary (lat)

      38 ts = new((/nmon,nlat,nlon/),"double")
      39 ts(0:11,:,:) = a1->TS
      40 ts(12:23,:,:) = a2->TS
      41 ts(24:35,:,:) = a3->TS
      42 ts(36:47,:,:) = a4->TS
      43 ts(48:59,:,:) = a5->TS
      44 ts(60:71,:,:) = a6->TS
      45 ts(72:83,:,:) = a7->TS
      46 ts(84:95,:,:) = a8->TS
      47 ts(96:107,:,:) = a9->TS
      48 ts(108:119,:,:) = a10->TS
      49
      50 ts = ts - 273.
      51
      52 printVarSummary (ts)
      53
      54 ; reorder dimensions to use dim_avg for right most dimension
      55 tsAvgTime = dim_avg(ts(lat|:,lon|:,time|:)) ; ==>
tsAvgTime(nlat,nlon)
      56
      57 printVarSummary (tsAvgTime)

When I run this script I get the following:

Variable: lat ! So I think lat and lon are defined ok from the nc
file...
Type: float
Total Size: 360 bytes
             90 values
Number of Dimensions: 1
Dimensions and sizes: [lat | 90]
Coordinates:
             lat: [-89..89]
Number Of Attributes: 3
   long_name : latitude
   units : degrees north
   FORTRAN_format : f8.3

Variable: ts ! ts seems to be ok, too...
Type: double
Total Size: 15552000 bytes
             1944000 values
Number of Dimensions: 3
Dimensions and sizes: [time | 120] x [lat | 90] x [lon | 180]
Coordinates:
             time: [15.5..3634.5]
             lat: [-89..89]
             lon: [ 1..359]
Number Of Attributes: 4
   FORTRAN_format : e13.5
   units : deg K
   long_name : TS
   _FillValue : -9999

Variable: tsAvgTime ! but tsAvgTime does not show a lat or lon?
Type: double
Total Size: 129600 bytes
             16200 values
Number of Dimensions: 2
Dimensions and sizes: [90] x [180]
Coordinates:
Number Of Attributes: 1
   _FillValue : -9999
fatal:Dimension (0) of (tsAvgTime) is not named and therefore doesn't
have an as
sociated coordinate variable
^Mfatal:Execute: Error occurred at or near line 90 in file AnnTemp.ncl

Anji Seth, Geography, University of Connecticut

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Dec 04 2006 - 08:03:26 MST

This archive was generated by hypermail 2.2.0 : Tue Dec 05 2006 - 13:29:24 MST