[ncl-talk] Detecting local_minima of a time series with a specified length (local_min_1d)

Lyndz olagueralyndonmark429 at gmail.com
Mon Feb 5 20:09:08 MST 2018


Dear NCL experts,

I am trying to locate the local minima in a time series (1D) but with
additional condition that it has at least 2 decreasing adjacent
points(before or after the local minima).

Here's an example

   * x = (/35.91,22.43,15.84,6.62,4.71,9.67,12.25,2.01,30.25,85.64/)*

To detect the local minima I used the following commands:


*qmin=local_min_1d(x,False,-0.25,0)*
*    print(qmin)*

This gives the following:

*     Variable: qmin *
*    Type: float  *
*    Total Size: 8 bytes*
*            2 values*
*    Number of Dimensions: 1*
*    Dimensions and sizes: [2]*
*    Coordinates: *
*    (0) 4.71*
*    (1) 2.01*

The answer to my problem above should be the (0) 4.71 since the 2.01 is an
abrupt decrease.

Here's another example:

    * y = (/14.52,20.50,22.43,3.18,9.39,10.95,65.38,40.45,5.89,16.75/)*

*qmin=local_min_1d(y,False,-0.25,0)*
   *  print(qmin)*

*    Variable: qmin*
*    Type: float*
*    Total Size: 8 bytes*
*            2 values*
*    Number of Dimensions: 1*
*    Dimensions and sizes: [2]*
*    Coordinates: *
*    (0) 3.18*
*    (1) 5.89*

The answer here should be the (0) 3.18. The second one is also an abrupt
decrease.

Is there an efficient way to implement this in NCL? I will be applying this
for many csv files.


I'll appreciate any suggestion.

Sincerely,

Lyndz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180206/9f6360af/attachment.html>


More information about the ncl-talk mailing list