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

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 25 2013 - 13:46:49 MDT

Hi Thomas,
escorc allows one input array to be 1-dimensional and the other to be
multi-dimensional as long as the dimension sizes of the rightmost
dimensions of each input array match. Thus, I think all you need to do
is something like this:

MSLP = in1->MSL_GDS0_SFC_123
printVarSummary(MSLP) ; make sure time is in the left-most dimension as month_to_seasonN requires that
MSLP_season=month_to_seasonN(MSLP,(/"MAM"/))
delte(MSLP)

printVarSummary(MSLP_season)
MSLP_MAM = MSLP_season(0,:,:,:) ; grab MAM
delete(MSLP_season)
MSLP_season!0="time" ; rename dimensions
MSLP_season!1="lat"
MSLP_season!2="lon"
......
SipleNa = Siple(:,1)
ccr = MSLP_MAM(0,:,:) ; set up ccr with correct metadata, and overwrite data in the next line..
ccr = (/ escorc(SipleNA, MSLP_MAM(lat|:,lon|:,time|:)) /) ; dimsizes(MSLP_MAM&time) MUST = dimsizes(SipleNA)
printVarSummary(ccr)

Obviously, that is all untested. If you haven't already, I would review
the month_to-seasonN and escorc documentation:
http://www.ncl.ucar.edu/Document/Functions/Contributed/month_to_seasonN.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/escorc.shtml

(As an aside: code-wise "MSLP4(:,:,:)" is the same as "MSLP4".)

If the above doesn't help or if you have further questions, please let
ncl-talk know.
Adam

On 04/25/2013 12:54 PM, Thomas Beers wrote:
> Hello,
>
> I'm having a problem changing a four dimesional array into a three dimensional array. I have pulled out the March April May mean sea level pressure variable for all lat, lon, and time steps, and now I am trying to populate a new 3d array with these values (I'm doing this to correlate with a timeseries that is in a three dimensional array).
>
> Here is the script:
>
>
>
>
> Look at line 62.
>
> Here is one of the files i'm loading to run the script (can't include the ERA-Interim file, it's 250 mb):
>
>
>
>
> and this is the error:
>
> fatal:Dimension size mismatch on subscript #0, left-hand and right-hand side dimensions do not match
> fatal:Execute: Error occurred at or near line 62 in file Correlation2.ncl
>
> Thank you very much for any help in advance!!!!
>
>
> -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 13:47:00 2013

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