[ncl-talk] Help in saving values in looping

Andreas Chrysanthou eeac at leeds.ac.uk
Mon Jun 5 09:48:45 MDT 2017


Hi NCL users,


I created a loop for calculating a linear trend sensitivity for different start and end dates.

My timeseries span over 1980-2010 and I want to calculate the linear trend of the timeseries for when the start - end date are more than >= 9years.

(1980-1989, 1980-1990, 1980-1991,..., 1980-2010

1981-1990, 1981-1991, ..., 1981-2010

...

...

...

2000-2009, 2001-2010

2001-2010)


I’ve created the loops that calculate those values but I need to save them in an array as 4 different columns (start_date, end_date,trend_slope,reg_coeff)
My aim is to plot those as a a contour box plot with x axis the start date and y axis the end date, and the calculated (i’m gonna filter out those values with some criteria) trend values based on a colormap.

Can you help me in order to save the values to that new array so I can plot it?

A snippet of the code follows:

do i=1980,2001,1
   do j=1989,2010,1
        ntimes=ispan(i,j,1)
if (j-i .ge. 9 ) then
        test_rc=regline_stats(ntimes,value_test({i:j}))
        print(test_rc)
        start_date=i
        end_date=j
        trend_slope=test_rc at b*10  ; prints slope of the linear trend for the selected range of years
        reg_coeff=test_rc at b95         ; prints 2.5% and 97.5% regression coefficient confidence intervals
else print(“this age range has not been selected, since its less than 9 years")
    end if
      delete(ntimes)
end do
end do

Cheers,
Andreas









Andreas


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170605/dc454593/attachment.html 


More information about the ncl-talk mailing list