Re: The Dimensions don't match

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Aug 29 2013 - 08:22:43 MDT

I can guess at the reason for the message in

   index = mod( get1Dindex(var,max_var),12 ) + 1 ; line 59

My guess is that for each previous lat/lon iteration, there was only
one value returned: IE, dimsizes(index)=1
Your code implicitly assumes this.

However, the failure occurred when there were *two or more* location in
variable 'var' that matched 'max_var'.

NCL is a 'strongly typed language', by default, it will not
allow a variable of (say) size 2 to overwrite a variable of size 1.
That is what the "fatal:Dimension sizes on right hand side
of assignment do not match dimension sizes of left hand side"
message means.

In the above 'index' is the left hand side and is size 1,
the return from right hand side was (say) size 2.

There are two solutions:
   (a) at the end of each loop use: delete(index)
   (b) if you have 6.1.2, you can use the "new reassignment operator"
          http://www.ncl.ucar.edu/current_release.shtml

         index := mod( get1Dindex(var,max_var),12 ) + 1

================

However, in your code, you are assuming only one value matched. Hence,
you must make a decision.

solution (a)
         index = mod( get1Dindex(var,max_var),12 ) + 1
         tempo(lat,lon) = index(0) ; always pick the 1st max

         delete(index)

solution (b)
         index := mod( get1Dindex(var,max_var),12 ) + 1
         tempo(lat,lon) = index(0) ; always pick the 1st max

Good luck

On 8/28/13 8:26 PM, Guilherme Martins wrote:
> Hi all,
>
> When I run my script (in attach) I get
>
> fatal:Dimension sizes on right hand side of assignment do not match
> dimension sizes of left hand side
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 1465 in
> file $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl
>
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 59 in file
> max.ncl
>
> The script begin run, but later some points lat/lon it stop and return
> error.
>
> It's very strange because I use the same script to other dataset and I
> don't have problems.
>
> Could anyone help me?
>
> My files are in attach.
>
> Thanks,
>
> Guilherme
>
> Ncdump -h result:
>
> netcdf cmap {
> dimensions:
> lon = 144 ;
> lat = 72 ;
> time = UNLIMITED ; // (24 currently)
> variables:
> float lon(lon) ;
> lon:standard_name = "longitude" ;
> lon:long_name = "Longitude" ;
> lon:units = "degrees_east" ;
> lon:axis = "X" ;
> float lat(lat) ;
> lat:standard_name = "latitude" ;
> lat:long_name = "Latitude" ;
> lat:units = "degrees_north" ;
> lat:axis = "Y" ;
> double time(time) ;
> time:standard_name = "time" ;
> time:long_name = "Time" ;
> time:units = "hours since 1-01-01 00:00:00" ;
> time:calendar = "standard" ;
> float precip(time, lat, lon) ;
> precip:long_name = "Average Monthly Rate of Precipitation" ;
> precip:units = "mm/day" ;
> precip:_FillValue = -9.96921e+36f ;
> precip:missing_value = -9.96921e+36f ;
> precip:actual_range = 0.f, 56.54f ;
> precip:precision = 2s ;
> precip:least_significant_digit = 2s ;
> precip:var_desc = "Precipitation" ;
> precip:dataset = "CPC Merged Analysis of Precipitation Enhanced" ;
> precip:level_desc = "Surface" ;
> precip:statistic = "Mean" ;
> precip:parent_stat = "Mean" ;
>
> // global attributes:
> :CDI = "Climate Data Interface version 1.6.1 (
> http://code.zmaw.de/projects/cdi)" ;
> :Conventions = "COARDS" ;
> :history = "Wed Aug 28 23:11:55 2013: cdo selyear,1980/1981
> cmap.mensal.1979.2010.nc cmap.nc\n",
> "Wed Aug 28 21:43:40 2013: cdo selyear,1979/2010
> cmap_precip.mon.mean_enhanced_montlhy.nc cmap.nc\n",
> "Created by CAS 09/2012 using version 1201 from NCEP" ;
> :source = "ftp ftp.cpc.ncep.noaa.gov precip/cmap/monthly" ;
> :title = "CPC Merged Analysis of Precipitation (includes NCEP Reanalysis)"
> ;
> :platform = "Analyses" ;
> :documentation = "http://www.esrl.noaa.gov/psd/data/gridded/data.cmap.html"
> ;
> :version = "V1201" ;
> :references = "http://www.esrl.noaa.gov/psd/data/gridded/data.cmap.html" ;
> :CDO = "Climate Data Operators version 1.6.1 (
> http://code.zmaw.de/projects/cdo)" ;
>
>
>
>
> _______________________________________________
> 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 Thu Aug 29 08:22:43 2013

This archive was generated by hypermail 2.1.8 : Fri Aug 30 2013 - 14:04:57 MDT