Fwd: Convert 3-D to 2-D

From: Dave Allured - NOAA Affiliate <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 20 2013 - 17:22:54 MST

---------- Forwarded message ----------
From: Cary Lynch <lynchc6@uw.edu>
Date: Wed, Nov 20, 2013 at 5:20 PM
Subject: Re: Convert 3-D to 2-D
To: Dave Allured - NOAA Affiliate <dave.allured@noaa.gov>

Yes, thank you. I knew it would be something simple and overlooked.

On Wed, Nov 20, 2013 at 3:54 PM, Dave Allured - NOAA Affiliate <
dave.allured@noaa.gov> wrote:

> I think this will do what you want, assuming that the calculation of
> yrmin1 is valid:
>
> year_min = dim_min_n_Wrap (yrmin1, 0)
>
> --Dave
>
>
> On Wed, Nov 20, 2013 at 3:24 PM, Cary Lynch <lynchc6@uw.edu> wrote:
>
>> I am trying to construct a 2-dim, lat/lon variable that contains the
>> year a variable crossed a threshold. I can’t seem to convert the 3-dim
>> (year over threshold, lat, lon) to a 2-dim. This should be simple? Any
>> help would be appreciated.
>>
>> My script is as follows:
>>
>>
>>
>> htas1= o1->tas(:,:,:) ; historic tas for mod 1.
>> tas(time,lat,lon)
>>
>> ftas1 = n1->tas(:,:,:) ; future tas for mod1.
>> Tas(time,lat,lon)
>>
>> ; ‘time’ = 95, ‘lat’ = 192, ‘lon’ = 288
>>
>>
>>
>> min1 = dim_min_n_Wrap(htas1,0)
>>
>> max1 = dim_max_n_Wrap(htas1,0)
>>
>>
>>
>> countmin1 = new((/95,192,288/),float) ; dim(0) = 1 if less
>> than min
>>
>> dummy1 = new((/95,192,288/),float)
>>
>> countmax1 = new((/95,192,288/),float) ; dim(0) = 1 if
>> greater than max
>>
>> dummy2 = new((/95,192,288/),float)
>>
>> dummy = 1
>>
>>
>>
>> do j = 0,94
>>
>> countmin1(j,:,:) = mask(dummy1(j,:,:),(ftas1(j,:,:) .lt. min1),True)
>>
>> countmax1(j,:,:) = mask(dummy2(j,:,:),(ftas1(j,:,:) .gt. max1),True)
>>
>> end do
>>
>>
>>
>> copy_VarMeta(ftas1,countmin1)
>>
>> copy_VarMeta(ftas1,countmax1)
>>
>>
>>
>> yrs1 = new((/95,192,288/),float) ; dim(0) =
>> 2006-2100
>>
>>
>>
>> do k = 0,94
>>
>> yrs1(i,:,:) = 2006+i
>>
>> end do
>>
>>
>>
>> copy_VarMeta(ftas1,yrs1)
>>
>>
>>
>> yrmin1 = mask(yrs1,(countmin1 .lt. 0), False)
>>
>> yrmax1 = mask(yrs1,(countmax1 .lt. 0), False)
>>
>>
>>
>> copy_VarMeta(ftas1,yrmin1)
>>
>> copy_VarMeta(ftas1,yrmax1)
>>
>>
>>
>> ;*******************************
>>
>>
>>
>> This is where I am stuck. Please advise.
>>
>> --
>> Cary Lynch
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>

-- 
Cary Lynch, PhD
Climate Impacts Group
College of the Environment
University of Washington

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Nov 20 17:23:05 2013

This archive was generated by hypermail 2.1.8 : Fri Nov 22 2013 - 09:36:32 MST