Re: annual mean and contour

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 07 2012 - 14:04:41 MST

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
Received on Tue Feb 7 14:04:52 2012

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