<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi Micha,</p>
    <p><br>
    </p>
    <p>Thank you for your email. Your script is very interesting, but I
      think I cannot use it because:</p>
    <p>1- you make a sum of your viewshed list, and each viewshed value
      is 0 or 1 (hidden or visible). But my problem is with viewshed
      values from 0 upto 250 (for each viewshed this is the hidden
      height from a viewpoint). So make a sum has no sens.<br>
    </p>
    <p>2- you search the pourcent of visible terrain from all
      viewpoints, and I want find pourcent of viewpoints able to see
      terrain (actually to not see the maximum hidden height above
      terrain)</p>
    <p>Tell me if I'm wrong...<br>
    </p>
    <p><br>
    </p>
    <p>I wrote a script with garray.array() which read the value for
      each specific x,y cell coordinates from all viewshed rasters,
      create a list of data, sort that list, and get the shifted min
      (according to my tolerance, for example 80% of 100 viewpoints get
      the twentieth smallest value). In that way Each cell of my output
      raster give the hidden height from 80% of my viewpoints. The
      script is working, but I believe that adding this function in
      r.series could be useful.</p>
    <p><br>
    </p>
    <p>Cheers,</p>
    <p>Frank<br>
    </p>
    <br>
    <div class="moz-cite-prefix">Le 15/02/2019 à 15:52, Micha Silver a
      écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:4abf6bc9-4b6e-614f-8d28-50b81107e3cf@gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
      <p>Hello Frank:</p>
      <p><br>
      </p>
      <div class="moz-cite-prefix">On 2/7/19 3:16 PM, Frank David wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:837a3cc6-e041-e01b-14c4-b6f9b1ca9b8d@geophom.fr">
        <meta http-equiv="Content-Type" content="text/html;
          charset=utf-8">
        <p>I forgot one thing to well understand my wish. Each viewshed
          raster is a r.series (250-sum) of 250 r.viewshed with 2m
          target and 0 upto 250m terrain height. So each raster gives
          the hidden height of a building (250m max) anywhere on the
          region from a specific point of view. The purpose is to get
          the area of hidden wind turbine from roads for a specific wind
          turbine height.</p>
        <p>Cheers,</p>
        <p>Frank</p>
      </blockquote>
      <p><br>
      </p>
      <p>A friend and I were working on an idea some months ago that
        might be of interest. Not the same as your project but the
        method I used is similar.</p>
      <p><br>
      </p>
      <p>The search and rescue teams here are interested to see what
        areas were actually visible after they finish searching along a
        certain route, and what areas were not seen at all. I used the
        same approach as you, creating a series of overlapping
        r.viewshed intermediate rasters. </p>
      <p><br>
      </p>
      <p>After seeing your post, I have added new input parameters for
        minimum and maximum values of overlap. The user can enter
        percents of minimum or maximum viewshed overlaps. Suppose I put
        in 20 as the minimum, then only those pixels with at least 20%
        of the total number of viewsheds will be shown. Similarly, if I
        enter 80 as the maximum, then only those pixels with less than
        80% of the maximum number of viewsheds will appear in the final
        raster. <br>
      </p>
      <p><br>
      </p>
      <p>If you are on Gitlab, you can clone the files: No documentation
        yet :-(</p>
      <p><a class="moz-txt-link-freetext"
          href="https://gitlab.com/tsvibar/route_viewshed"
          moz-do-not-send="true">https://gitlab.com/tsvibar/route_viewshed</a></p>
      <p><br>
      </p>
      <p>If you do adopt any of this script, I'd appreciate to hear of
        any bugs or suggestions for improvement. If the script raises
        any interest, I'll add it to the Addons.</p>
      <p><br>
      </p>
      <p>Regards,</p>
      <p>Micha<br>
      </p>
      <p><br>
      </p>
      <blockquote type="cite"
        cite="mid:837a3cc6-e041-e01b-14c4-b6f9b1ca9b8d@geophom.fr">
        <p> </p>
        <div class="moz-cite-prefix">Le 07/02/2019 à 12:48, Frank David
          a écrit :<br>
        </div>
        <blockquote type="cite"
          cite="mid:ddec21d7-fbef-8a36-4f6f-a0f4a923814f@geophom.fr">
          <meta http-equiv="Content-Type" content="text/html;
            charset=utf-8">
          <p>Hi,</p>
          <p>Thanks for your reply. I can have numerous raster (several
            hundreds). I want to find a minimum but with a tolerance,
            it's why I want to be able to shift the value. In fact I
            want to sort the value of my all input raster for each x,y
            cell and get the second or third, or any position in the
            sorted list, to build my output raster. My application is to
            get the area not visible from a road (I did 1600 viewshed
            raster from the roads every 250m). I want a tolerance in
            order that one point of view (top of hill) does not reduce
            too much the hidden area. To do so, a fixed number of my
            point of view (20%) does not reduce the hidden area. The
            result is the area is hidden from 80% of the road.<br>
          </p>
          <p>I already wrote a python script that read all rasters for
            each x,y cell and make a array(), sort the array values, and
            build a raster. It works on reasonable number of cell, but
            seems to fails with large number of cells. I'm not a
            programmer !<br>
          </p>
          <p>I wondered if this kind of treatment exists already in
            Grass. <br>
          </p>
          <p>If somebody wants to hemps me to develop this, I could be
            nice. But I think it could be an improvement of r.series
            function.</p>
          <p>Sorry for my bad english, I hope you have understand my
            wishes !<br>
          </p>
          <p>Cheers</p>
          <p>Frank<br>
          </p>
          <div class="moz-cite-prefix">Le 07/02/2019 à 12:04, Veronica
            Andreo a écrit :<br>
          </div>
          <blockquote type="cite"
cite="mid:CAAMki4FmyaxJo-NX_V177iBxnAsFkbOcfB-gbM-4r3UM0sjXvw@mail.gmail.com">
            <meta http-equiv="content-type" content="text/html;
              charset=utf-8">
            <div dir="auto">Hi Ken,
              <div dir="auto"><br>
              </div>
              <div dir="auto">There isn't any build-in function for that
                in grass, afaik. Depending on how long is your series,
                you could shift the map list you use in each run and
                then use r.univar on each output from r.series to get
                the minimum and by comparison, get the second minimum of
                the series of maps (a scalar). </div>
              <div dir="auto"><br>
              </div>
              <div dir="auto">However, if what you need is a map of
                second minimums per pixel, I believe that might require
                some programming for a new function... Do you know any
                other software which has this function? Maybe, if
                there's such thing in Python for example, it could be
                recycled or used with grass maps in a script... Dunno,
                just thinking out loud</div>
              <div dir="auto"><br>
              </div>
              <div dir="auto">best,</div>
              <div dir="auto">Vero</div>
            </div>
            <br>
            <div class="gmail_quote">
              <div dir="ltr">El jue., 7 feb. 2019 07:16, Ken Mankoff
                <<a href="mailto:mankoff@gmail.com" target="_blank"
                  rel="noreferrer" moz-do-not-send="true">mankoff@gmail.com</a>>
                escribió:<br>
              </div>
              <blockquote class="gmail_quote" style="margin:0 0 0
                .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi
                Frank,<br>
                <br>
                On 2019-02-07 at 08:27 +0100, Frank David <<a
                  href="mailto:frank.david@geophom.fr" rel="noreferrer
                  noreferrer" target="_blank" moz-do-not-send="true">frank.david@geophom.fr</a>><br>
                wrote...<br>
                > I try to find how to get the shifted minimum value
                of a series of<br>
                > raster map. I want to shift by one, or more, the
                "minimum" value found<br>
                > on each cell to get the "almost minimum" of the
                series. Is there an<br>
                > available function/method to do that ?<br>
                <br>
                I don't think I fully understand what you want. Are you
                working with strds? You mention "series". If I wanted to
                get the second-minimum of a single raster, I would use
                r.stats with the "-1" flag, sort, and search for the 2nd
                (or 2nd-to-last).<br>
                <br>
                  -k.<br>
                <br>
                _______________________________________________<br>
                grass-user mailing list<br>
                <a href="mailto:grass-user@lists.osgeo.org"
                  rel="noreferrer noreferrer" target="_blank"
                  moz-do-not-send="true">grass-user@lists.osgeo.org</a><br>
                <a
                  href="https://lists.osgeo.org/mailman/listinfo/grass-user"
                  rel="noreferrer noreferrer noreferrer" target="_blank"
                  moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/grass-user</a></blockquote>
            </div>
          </blockquote>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <pre class="moz-quote-pre" wrap="">_______________________________________________
grass-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org" moz-do-not-send="true">grass-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/grass-user" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/grass-user</a></pre>
        </blockquote>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <pre class="moz-quote-pre" wrap="">_______________________________________________
grass-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org" moz-do-not-send="true">grass-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/grass-user" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/grass-user</a></pre>
      </blockquote>
      <pre class="moz-signature" cols="72">-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918</pre>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      <style>
div#signature {font-size:10px;color:#666;margin:10px 0}
span#geophom {font-size:11px;color:#A1CD1A}
div#important {font-size:10px;color:#CB110B;font-style:italic}
</style>
      <div id="signature"> <span id="geophom"><b>Geophom</b></span><br>
        327 rue de Vieille Cour 44521 OUDON<br>
        Tel +33(0)2 85 52 02 59 - Port +33(0)6 04 47 91 06<br>
        <a class="moz-txt-link-abbreviated" href="http://www.geophom.fr">www.geophom.fr</a><br>
      </div>
    </div>
  </body>
</html>