Re: Do loop overwriting

From: Paula Doubrawa Moreira <pmoreira_at_nyahnyahspammersnyahnyah>
Date: Thu Jul 29 2010 - 12:29:05 MDT

I got it. Sorry, everyone. It usually takes asking to realize ourselves what
the issue is.

I was re-creating the array every loop. I took the *new* statement off the
loop and it's working fine.

2010/7/29 Paula Doubrawa Moreira <pmoreira@alaska.edu>

> I have a time loop (shown below) that reads variables from 2 different
> files and subtracts them.
>
> I want to store this subtraction in a newly created array (arr) whose
> leftmost dimension will account for each of the loops and the other two
> dimensions will be the 2 dimensions of the original variables (x1 and x2).
>
> So basically arr(0,:,:) will be the subtraction values of the first loop;
> arr(1,:,:) will be the same for the second loop; and so
> on.
>
> But each time a new loop comes about, it stores the right values in the
> right place, but overwrites the ones stored in the previous loop, replacing
> them with the value assigned as _FillValue. Is there a way to "save" what
> has been stored in the previous loops and avoid this overwriting?
>
> Thanks a lot!!!
>
> *do nt1=1,10
> nt2=6*nt1
>
> x1 = wrf_user_getvar(f1,"slp",nt1)
> ** x2 = wrf_user_getvar(f2,"slp",nt2) *
> *
> y = x2-x1
>
> arr = new( (/10, 100, 100/), "float" )
> arr(nt1-1,:,:) = y
>
> end do*
>
> --
> *Paula Doubrawa Moreira**
> *Graduate Student - Research Assistant
> International Arctic Research Center
> University of Alaska Fairbanks
>

-- 
*Paula Doubrawa Moreira**
*Graduate Student - Research Assistant
International Arctic Research Center
University of Alaska Fairbanks

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jul 29 12:29:11 2010

This archive was generated by hypermail 2.1.8 : Fri Jul 30 2010 - 13:45:56 MDT