Hi Debasish,
In your values below, you have "6" as the maximum for "2,6,4,7,3,6".
Shouldn't this be "7"?
Anyway, try the attached script. It uses "ind" to get the indices of
the missing values, and then
uses this information to determine what consecutive non-missing
values you have.
--Mary
On Jan 13, 2010, at 7:36 AM, debasish@gi.alaska.edu wrote:
> Hello,
>
> I may post similar problem before. In present problem, I would like to
> calculate average of the maximum value of consecutive events instead
> of number of consecutive events.
>
> I mentioned a example below:
>
> example
> I have a time series of few values with missing value=-999
>
> x=(/
> 1,-999,-999,-999,3,4,5,6,7,1,3,-999,-999,-999,4,5,7,8,-999,-999,-999,-
> 999,4,4,5,7,-999,-999,-999,2,1,10,-999,-999,-999,2,6,4,7,3,6,-999,-999
> ,-999/)
>
> Step1: I need to convert x to another time series x1 where only 3 to 6
> consecutive value appears and rest of them will be missing (x1 will
> same dimension of x)
>
> x1=
> (/-999,-999,-999,-999,-999,-999,-999,-999,-999,-999,-999,-999,-999,-99
> 9,4,5,7,8,-999,-999,-999,-999,4,4,5,7,-999,-999,-999,2,1,10,-999,-999,
> -999,2,6,4,7,3,6,-999,-999,-999/)
>
> Step2: I need to calculate the maximum of each event with 3 to 6
> consecutive value from x1
> There is four events with 3 to 6 consecutive in x1
> 4,5,7,8
> 4,4,5,7
> 2,1,10
> 2,6,4,7,3,6
> so maximum values of these four events 8, 7, 10, 6
>
> Step3: I need to calculate the average (8+7+10+6)/4
>
> Any help for solving above mentioned steps in NCL will be appreciated.
>
> Thanks
>
> Debasish
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> _______________________________________________
> 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
This archive was generated by hypermail 2.1.8 : Fri Jan 15 2010 - 13:51:45 MST