[ncl-talk] Sequences of values

Dennis Shea shea at ucar.edu
Fri Mar 23 16:17:10 MDT 2018


Sorry, I'm I am not looking at any code.

   tcrit = 30.

   f  = addfile(...)
  T = f->T                  ; (time,lat,lon)


[1] "setting values below the threshold to _FillValue" is simple.

https://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml

   Tcrit = where(T.ge.tcrit, T, T at _FillValue)
   copy_VarMeta(T, Tcrit)
===========
[2] You do not need to do [1]

Maybe you could use the following function:

=========
http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_numrun_n.shtml
****Look at the examples****
=========

  T10= where(T.ge.tcrit,1, 0)
  T10 at long_name = "Exceed=1; No=0"
  copy_VarCoords(T, T10)
  printVarSummary(T10)

 r0 = *dim_numrun_n* (T10, *0*, 0)  ; (ntim,nlat,mlon)
 r1 = *dim_numrun_n* (T10, *1*, 0)
 copy_VarCoords(T, r0)
 copy_VarCoords(T, r1)

;---Pick one grid point to see what is happening

  LAT = ..
  LON = ..
  print(T(:,{LAT},{LON})+"  "+Tcrit(:,{LAT},{LON})+"  "+T10(:,{LAT},{LON}) \
                        +"  "r0(:,{LAT},{LON})+"   "+r1(:,{LAT},{LON})



On Fri, Mar 23, 2018 at 3:29 PM, Kiswendsida Hyacinthe GUIGMA <
karongseba at gmail.com> wrote:

> Dear NCL users,
> I have 3D (time,lat,lon) array of temperature from which I would like to
> keep only sequences (consecutive days) exceeding a certain threshold.  This
> consist concretely in setting values below the threshold to _FillValue.
> The length of sequence is set to 4. So far,  have been able  to set to
> _FillValu only individual days that exceed the threshold. Then I would be
> pleased if you could provide me with a method to also set to _FillValue
> values that are not into sequences of at least 04 days.
>
> Please find attached my data and my code.
>
> Regards
>
>
> -----------------------------
> GUIGMA
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180323/3c0f3658/attachment.html>


More information about the ncl-talk mailing list