Re: The Dimensions don't match

From: Guilherme Martins <jgmsantos_at_nyahnyahspammersnyahnyah>
Date: Thu Aug 29 2013 - 09:02:25 MDT

When I try the solutions (a) and (b) you give me, I get:

warning:VarVarWrite: rhs has no dimension name or coordinate variable,
deleting name of lhs dimension number (0) and destroying coordinate var,
 use "(/../)" if this is not desired outcome
warning:["Execute.c":8128]:Execute: Error occurred at or near line 58 in
file fig.ncl

and

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 56 in file
fig.ncl

Guilherme.

2013/8/29 Dennis Shea <shea@ucar.edu>

> 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<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 <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<http://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<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<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 <http://code.zmaw.de/projects/cdo>)" ;
>>
>>
>>
>>
>> ______________________________**_________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/**mailman/listinfo/ncl-talk<http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>
>>

-- 
*Guilherme Martins*
https://sites.google.com/site/jgmsantos/

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Aug 29 09:03:24 2013

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