[ncl-talk] Error: dimension sizes of left and right hand side do not match

Rick Brownrigg brownrig at ucar.edu
Wed Oct 23 13:43:08 MDT 2019


Hi (offline for a moment):

I can not see the problem either. I note that the lines in question are in
a doubly-nested loop. Does this error occur on the very first attempt at
writing a netcdf?  Each time through the loop(s), you are reassigning the
filevariable ncdf -- I'm wondering if the "previous" file is not getting
closed or perhaps the var ncdf retains some stale information?  Perhaps
just before the end of the "if (netCDF1) " statement, place a delete(ncdf),
which somewhat counterintuitively, will close the file.

Rick

On Wed, Oct 23, 2019 at 1:03 PM Toni Klemm via ncl-talk <ncl-talk at ucar.edu>
wrote:

> Hello NCL Community,
>
> I am perplexed by what seems to be a very simple error in my script
> (attached). I am analyzing gridded data for the U.S. Great Plains region
> and have divided the region into 6 parts, Northern, Central, and Southern
> Plains as well as each of them into east and west.
>
> After analyzing the data I am assembling everything to save in an output
> file, but for some reason this line in my code
>
> ncdf->lat_2 = lat_2
>
> gets this error message and the program crashes:
>
> Dimension sizes of left hand side do not match right hand side
>
> “lat_2” is the latitude dimension associated with the Central Plains data.
>
> “lat_1” three lines above it does not get an error, but when I comment
> lat_2 out, then lat_3, three lines down, gets the same error.
>
> I looked very carefully and changed the script in a number of ways, but I
> cannot find the reason for this error. lat_1 is longer than lat_2 and lat_3
> (see below), but that shouldn’t be the reason.
>
> I did a printVarSummary on all three, but it didn’t give me any clues:
>
> Variable: lat_1
> Type: float
> Total Size: 676 bytes
>             169 values
> Number of Dimensions: 1
> Dimensions and sizes: [lat | 169]
> Coordinates:
>             lat: [42..49]
> Number Of Attributes: 2
>   long_name : latitude
>   units : degrees_north
>
> Variable: lat_2
> Type: float
> Total Size: 580 bytes
>             145 values
> Number of Dimensions: 1
> Dimensions and sizes: [lat | 145]
> Coordinates:
>             lat: [36..42]
> Number Of Attributes: 2
>   long_name : latitude
>   units : degrees_north
>
> Variable: lat_3
> Type: float
> Total Size: 580 bytes
>             145 values
> Number of Dimensions: 1
> Dimensions and sizes: [lat | 145]
> Coordinates:
>             lat: [30..36]
> Number Of Attributes: 2
>   long_name : latitude
>   units : degrees_north
>
> Does anyone have a suggestion? I appreciate your help!
>
> Tank you very much,
> Toni
>
>
>
> *Toni Klemm, Ph.D.*Postdoctoral Research Associate
> Department of Ecosystem Science and Management
> College of Agriculture and Life Sciences
> Texas A&M University, College Station, TX
> www.toni-klemm.de | @toniklemm <http://www.twitter.com/toniklemm>
> Editorial Board member, Early Career Climate Forum
> <http://www.eccforum.org>
>
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191023/09598f3d/attachment.html>


More information about the ncl-talk mailing list