Convert 3-D to 2-D

From: Cary Lynch <lynchc6_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 20 2013 - 15:24:23 MST

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
Received on Wed Nov 20 15:24:36 2013

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