<div dir="auto"><div><div dir="auto"><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mié., 27 ene. 2021 11:33,  <<a href="mailto:nik@nikosalexandris.net" rel="noreferrer noreferrer" target="_blank">nik@nikosalexandris.net</a>> escribió:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Thank you Vero.</p>
<p>Consider the following time series [1, 2, 2, 6, 3, 3, 4, 4, 3, 2, 2, 1] <- evolution of a pixel in time.</p>
<p>Say this is always the same pixel indexed at [0, 0] in each of 12 raster maps registered in a GRASS GIS STRDS.</p>
<p>Median filtering pixel-wise in time, only, with a temporal window=3, would then be doing:</p>
<p>1st pixel would be replaced by the median of [0, 1, 2]</p>
<p>2nd pixel would be replaced by then median of [1, 2, 2]</p>
<p>3rd pixel would be replaced by the median of [2, 2, 6]</p>
<p>4th pixel would be replaved by the median of [2, 6, 3]</p>
<p>etc.</p>
<p></p></div></blockquote></div></div><div dir="auto"><span style="font-family:sans-serif"><br></span></div><div dir="auto"><span style="font-family:sans-serif">Got it, it's more like a rolling median what you need. </span><div dir="auto" style="font-family:sans-serif"><br></div><div dir="auto" style="font-family:sans-serif">Have you tried r.series.filter? From the manual page, it seems that's exactly what it does if you set method=median and winsize=3 (given that winsize is in time)</div><div dir="auto" style="font-family:sans-serif"><br></div><div dir="auto" style="font-family:sans-serif">Otherwise, we can think harder on how to do that with t.rast.algebra and the neighborhood modifier only moving in time. But, you should explore how to expose the median function from r.mapcalc first, since it's not available in t.rast.algebra yet</div><div dir="auto" style="font-family:sans-serif"><br></div></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Doing a spatial median over a 2D (sub)window of each raster map in a GRASS GIS STRDS is not wanted here.  I hope this is more clear now.</p></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto"></div><div dir="auto">This is not what I suggested in the previous email either. Both r.series and t.rast.series will estimate the median per pixel in time (either for the whole series or the time period you want). Would it be possible then with so e sort of special for cycle?</div><div dir="auto"><br></div><div dir="auto">Best,</div><div dir="auto">Vero</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Nikos</p>
<p><br></p>
<div id="m_4621636606632894565m_6151262008917739002m_6078635334476354780signature">---<br>
<div style="margin:0;padding:0;font-family:monospace"> </div>
</div>
<p><br></p>
<p id="m_4621636606632894565m_6151262008917739002m_6078635334476354780reply-intro">On 2021-01-27 16:04, Veronica Andreo wrote:</p>
<blockquote type="cite" style="padding:0 0.4em;border-left:#1010ff 2px solid;margin:0">
<div id="m_4621636606632894565m_6151262008917739002m_6078635334476354780replybody1">
<div dir="ltr">
<div dir="auto">What exactly do you mean by median-filtering in time only, Nikos? Get the median and then filtering out all pixels above/below that value? If that's the case, then maybe some of the examples here <a href="https://grasswiki.osgeo.org/wiki/Temporal_data_processing#Spatio-temporal_algebra_with_STRDS" rel="noopener noreferrer noreferrer noreferrer noreferrer" target="_blank">https://grasswiki.osgeo.org/wiki/Temporal_data_processing#Spatio-temporal_algebra_with_STRDS</a> might be of help
<div dir="auto"> </div>
<div>Basically, you first estimate the median of the series (or the period you are interested in) either with r.series or t.rast.series and then use t.rast.mapcalc or t.rast.algebra to get only pixels below/above that value represented pixelwise in the median map. It can also be a single value of course.</div>
<div> </div>
<div>Does that make sense?</div>
<div> </div>
<div>best, </div>
<div>Vero</div>
<div dir="auto"> </div>
</div>
</div>
<br>
<div>
<div dir="ltr">El mié., 27 ene. 2021 08:44, <<a href="mailto:nik@nikosalexandris.net" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">nik@nikosalexandris.net</a>> escribió:</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid #cccccc;padding-left:1ex">I am trying to median-filter time series in time and not in space.<br><br>Not sure `r.series.filter` is the right tool.<br>I skimmed through the manual, the paper and the source code. Yet I am <br>asking for a confirmation.<br>Its (odd integer) parameter `winsize=` implies a moving window (of size <br>winsize^2).<br>Does this rather filter images, of a time series, in space?<br>Or does the `winsize` here refer to the length of a moving temporal <br>window?<br><br>Then, there is `r.series.lwr`.<br>Can I use the tool with `order=0` and `delta=1` (or `order=3` and <br>`delta=1`)<br>and perform a moving average filtering in time?<br>It's not median. Still I'd like to see a filtering in time-only effect.<br><br>And, now I recall `r.hants`.<br>Is there a way to use it for filtering-out only lows and highs (`-l` and <br>`-h` respectively) pixel-wise in time, without interpolating nor <br>extrapolating?<br><br>Else, I guess there should be a way to build a 'custom' filter using <br>`t.rast.algebra` using its temporal neighborhood modifier.<br>It's convenient if one the tools above does already median-filtering in <br>time-only.<br><br>Kind regards, Nikos<br>_______________________________________________<br>grass-user mailing list<br><a href="mailto:grass-user@lists.osgeo.org" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">grass-user@lists.osgeo.org</a><br><a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noopener noreferrer noreferrer noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a></blockquote>
</div>
</div>
</blockquote>
</div>
</blockquote></div>
</div></div>