Re: Changing a four dimensional array into a three dimensional array

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 25 2013 - 15:28:12 MDT

Hi Tom,
Whenever you get a "Dimension sizes of left hand side and right hand
side of assignment do not match"
error message, it is usually best to use printVarSummary statements of
the arrays involved to pinpoint why the error is occurring.

In this case, you reordered MSLP2 so that time is the rightmost
dimension, which is completely fine:
MSLP2= MSLP_MAM(lat|:,lon|:,time|:)

However, the ccr metadata setup line is now wrong because ccr(0,:,:) is
selecting the first latitude, not the first timestep:
ccr = MSLP2(0,:,:) ; set up ccr with correct metadata, and overwrite
data in the next line..
printVarSummary(ccr) ; this will show that ccr is an array of nlon x
ntime, when you want it to be nlat x nlon

So, change this:
ccr = MSLP2(0,:,:)
ccr = (/escorc(SipleNa, MSLP2(lat|:,lon|:,time|:))/)

to this:
ccr = MSLP2(:,:,0) ; select 0th time step
ccr = (/escorc(SipleNa, MSLP2)/) ; no need to reorder MSLP2 anymore as
time is already on the right

Hope that helps..
Adam

On 04/25/2013 03:20 PM, Thomas Beers wrote:
> Hello,
>
> Thanks for the help Adam!
>
> I'm still getting the error:
>
> fatal:Dimension sizes of left hand side and right hand side of assignment do not match
> fatal:Execute: Error occurred at or near line 60 in file Correlation3.ncl
>
>
> with the script:
>
>
>
> This error is the reason I thought I had to make a new 3d array and populate it at every lat lon and time with the value from the file "RICE_NA_Correlation_79_11.txt" for the corresponding year.
>
> I think Adam stated I could correlate a 1 D array with a 3 D array though. Am I wrong?
>
> Thanks for your help!
>
> -Tom
>
>
>
>
> Thomas Beers
> Climate Change Institute
> University of Maine
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 25 15:28:21 2013

This archive was generated by hypermail 2.1.8 : Fri Apr 26 2013 - 17:10:25 MDT