Re: annual mean and contour

From: Xiaoyan Ma <xiaoyan.ma_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 07 2012 - 14:31:48 MST
Thanks, Dave. It works now.


On 02/07/12, David Brown <dbrown@ucar.edu> wrote:

Excuse me. It was pointed out that I am wrong. The ispan call does indeed return 85 values. However, in spite of the fact that you have

nlat set to 85, there is nothing in the code that shows what is the actual dimensionality of the 'var' variable.  You need a printVarSummary(var)
to verify that you have what you think you have for its shape.
 -dave

On Feb 7, 2012, at 2:04 PM, David Brown wrote:

Well the error message is telling you what is wrong: ispan(-42,42,1) produces 84 values, whereas your nlat value is 85. 
However, you should put some 'printVarSummary' messages in your code to help show you what is the problem.
 -dave

On Feb 7, 2012, at 1:45 PM, Xiaoyan Ma wrote:

Hi

I want to calculate the annual mean from 12 months hdf files, and then make a contour, below is what I did.
There is a fatal error as below
---------------------------------------------------------------------------------------------
fatal:Coordinate variables must be the same dimension as their dimension
fatal:Execute: Error occurred at or near line 43 in file
-------------------------------------------------------------------------------------------
line 43 is "   var&lat        = ispan(-42,42,1)*dlat "

Also the values of var is not correct. can anyone help to fix the problem?

Thanks,
Xiaoyan

================================
   nlat  = 85
   nlon  = 72
   ntim = 12

   do nt=0,ntim-1
   fname = m+sprinti("%0.2i", nt+1)+".hdf"
   print(fname)
   in = addfiles(fname, "r") ;; load all the files
   var0 = in[:]->variable_name
   end do
   var = dim_avg_n(var0, 0)

   dlat  = 170./nlat
   dlon  = 360./nlon

   var!0          = "lat"
   var&lat        = ispan(-42,42,1)*dlat
   var&lat@units  = "degrees_north"

   var!1          = "lon"
   var&lon        = ispan(-36,35,1)*dlon
   var&lon@units  = "degrees_east"

...

_______________________________________________
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 Tue Feb 7 14:31:58 2012

This archive was generated by hypermail 2.1.8 : Thu Feb 09 2012 - 13:33:26 MST