Re: several center dates

From: Alan Brammer <abrammer_at_nyahnyahspammersnyahnyah>
Date: Tue Aug 20 2013 - 14:46:35 MDT

Rather than reading in all times in an array like that example, the way I do it (there may be a better way) is to just loop through the times.
This is only the bare bones and will need adapting also metadata for the new outputs will need to be checked and assigned.

no_of_lag_days = 11
lag = 5 ; days. if time units are hours (etc) change accordingly.
no_center_dates = dimsizes( center_dates ); 25 or however many you have.
nlat = dimsizes(f->lat)
nlon = dimsizes(f->lon)

all_times = new( ( /no_of_lag_days, no_center_dates, nlat, nlon/), float)

do t=0,no_center_dates-1
all_times(:,t,:,:) = f->q({center_dates(t)-lag:center_dates(t)+lag}, :, : ) ; this presumes daily time units so will give +_5 days change accordingly
end do

composite_lag = dim_avg_n_Wrap(all_times, 1) ; average over the center days

Composite lag will now have your composite lag days as the 0th dimension with lat/lon as the 1st and 2nd.

Good luck.
Alan.

##############################
Alan Brammer,
PhD Student,

Department of Atmospheric and Environmental Sciences,
University at Albany, State University of New York, Albany, NY, 12222
abrammer@albany.edu
##############################

On Aug 15, 2013, at 9:54 AM, Xi Chang <xi.chang01@gmail.com> wrote:

> Dear NCL users,
>
> I look at this thread for my analysis around the center date:
> http://www.ncl.ucar.edu/Support/talk_archives/2010/1711.html
>
> However there is not solution for the case of several center dates, for example, how is the way to deal with if i have 25 center dates and I want to make lag-composite around these center dates?
>
> Any hints will be really appreciated.
>
> Xi.
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Aug 20 14:46:59 2013

This archive was generated by hypermail 2.1.8 : Wed Aug 21 2013 - 13:54:15 MDT