Re: dimension reduction trouble

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue, 5 Feb 2008 17:14:38 -0700 (MST)

Erik,

In order to set one subset of a variable equal to a subset of a
another variable, the subsetted variables have to be exactly the same
size (the same dimensionality).

I'm guessing that if you do a printVarSummary on these two subsets,
they will be different:

   printVarSummary(FNLv925(ifil,:,:))
   printVarSummary(b->VV(0,4,:,:))

For example, if you have a 3D array (x) that is 4 x 2 x 3, and another
4D array (y) that is dimensioned 2 x 3 x 2 x 3, then you can do this:

     x(0,:,:) = y(0,0,:,:)
or
     x(1,:,:) = y(0,2,:,:)

etc.

However, you could not do something like this:

     x(:,0,:) = y(0,0,:,:)

because "x(:,0,:)" is dimensioned 4 x 3, and y(0,0,:,:) is dimensioned
2 x 3.

Please check the two subsets that you are trying to set equal to each
other, and make sure they are indeed the same dimensionality.

--Mary

On Tue, 5 Feb 2008, Erik Noble wrote:

> Hello.
>
>
> I am getting an error because I am trying to read a 4d variable into a
> pre-assigned 3D array.
>
> do ifil = 0, (numFILES-1)/4 ; BIG FILES LOOP ; NEW file loop
> b = addfile(FILES(ifil*4+2)+".nc","r")
> FNLv925(ifil,:,:) = b->VV(0,4,:,:)
>
> In following the NCL basic tutorial, I see that reading-in a 4D
> variable in such a way "should" reduce its dimensions, right?
>
> What function will "squeeze" the 4D variable? Also, where is this
> covered in the introduction to NCL, so that I can review it?
>
> Sincerely,
> Erik
>
> Here is my error:
>
> Erik_at_noble:/Volumes/Data_and_Models/ncl_scripts:ncl test_script2.ncl
> Copyright (C) 1995-2007 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 5.0.0
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
>
> export: Command not found.
> export: Command not found.
> export: Command not found.
> export: Command not found.
> export: Command not found.
> export: Command not found.
> export: Command not found.
> export: Command not found.
> export: Command not found.
> export: Command not found.
> export: Command not found.
> export: Command not found.
> export: Command not found.
> export: Command not found.
> export: Command not found.
> export: Command not found.
> Bad : modifier in $ ($).
> fatal:Dimension size mismatch on subscript #1, left-hand and
> right-hand side dimensions do not match
> fatal:Execute: Error occurred at or near line 66 in file test_script2.ncl
>
> Erik_at_noble:/Volumes/Data_and_Models/ncl_scripts:
>
> My Code is attached.
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 05 2008 - 17:14:38 MST

This archive was generated by hypermail 2.2.0 : Tue Feb 05 2008 - 17:17:22 MST