<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi Ben,<br>
      <br>
      Depends on what kind of analysis you are doing. If you are doing
      some kind of time series analysis, I would suggest you interpolate
      the missing values (taking in consideration the acquisition dates)
      and then smooth the output using e.g. a running mean. Even if you
      get a mask from USGS, that is still a generic estimation and will
      contain artifacts. Might also be useful to filter out very small
      values (a typical empirical threshold is -0.3) if you are not
      interested in water bodies. Still, note that not every
      cloud/shadow has a low NDVI.<br>
      <br>
      If you are interested, I implemented a function for RS data
      interpolation. You can install rsMove and use the intime()
      function. You should install it from my gitHub (see <a
        href="https://github.com/RRemelgado/rsMove">here</a>) because I
      still haven't submitted an update to CRAN. intime() It's a c++
      that performs a linear, time sensitive interpolation. This means
      that for, each observation, it will check what are the closest
      time steps in relation to the date(s) you want to have NDVI values
      for (in the past and in the future) and used them to interpolate
      the missing value, assuming that the time different (in days) is
      smallerĀ  than a predefined temporal buffer. A temporal buffer is
      required because, if the gaps are too big, you will likely
      over-generalize the NDVI curve and thus miss a lot of important,
      seasonal changes. The function is also called by imgInt() - which
      applies it to raster objects - but I'm still working on it. So I
      suggest you use getValues() to extract the data as a matrix before
      applying the function. You can then set it back with setValues()
      and the original raster stack. It will build a new stack with the
      interpolated values.<br>
      <br>
      If you really want to build mosaics, I can propose you another
      function from the same package called rsComposite(). It builds
      composites for the nearest date (if you want something for a
      specific year) or composites that are phenology dependent (if your
      landscape doesn't change much over the years , it uses multi-year
      data to build a composite around a specific day of the year).
      After, you can maybe use a spatial smoothing (e.g. using the
      median with the focal() function of the raster package) to deal
      with outliers.<br>
      <br>
      Best,<br>
      Ruben</p>
    <div class="moz-cite-prefix">On 04/12/2018 18:19, Ben Carlson wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAEEm8-O=qbgzd4q2_OX317ukBgb1Yje3Vi2e7J8Py1+D9JzCkA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">Hello,
            <div><br>
            </div>
            <div>I'm working with landsat 8 collection 1 surface
              collection data. I'd like to mask out clouds, with the
              goal of generating NDVI so that I can examine how animal
              movements respond to this variable.</div>
            <div><br>
            </div>
            <div>In the product guide for L8 SR data (page 22), it is
              recommended that "clear" conditions correspond to pixel_qa
              values of 322, 386, 834, 898, and 1346.</div>
            <div><br>
            </div>
            <div><a
href="https://landsat.usgs.gov/sites/default/files/documents/lasrc_product_guide.pdf"
                moz-do-not-send="true">https://landsat.usgs.gov/sites/default/files/documents/lasrc_product_guide.pdf</a><br>
            </div>
            <div><br>
            </div>
            <div>I've implemented this recommendation as a cloud mask
              and based on visual inspection it looks fine. However, I'm
              wondering if there are other, better recommendations based
              on my intended use of the data.</div>
            <div><br>
            </div>
            <div>Note: In case this affects the answer, I'm also
              mosaicing multiple landsat scenes in order to fill in
              blank areas due to clouds.</div>
            <div><br>
            </div>
            <div>Thank you!</div>
            <div><br>
            </div>
            <div>Ben</div>
            <div><br>
            </div>
            <div><br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
RS-ecology mailing list
<a class="moz-txt-link-abbreviated" href="mailto:RS-ecology@lists.uni-wuerzburg.de">RS-ecology@lists.uni-wuerzburg.de</a>
<a class="moz-txt-link-freetext" href="https://lists.uni-wuerzburg.de/mailman/listinfo/rs-ecology">https://lists.uni-wuerzburg.de/mailman/listinfo/rs-ecology</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Ruben Remelgado, M.Sc.

Department of Remote Sensing
Institute of Geography and Geology
University of Wuerzburg
Oswald-Kuelpe-Weg 86
97074 Wuerzburg, Germany

Phone - +49 (0) 931 31-83562
Email - <a class="moz-txt-link-abbreviated" href="mailto:ruben.remelgado@uni-wuerzburg.de">ruben.remelgado@uni-wuerzburg.de</a>
Url - <a class="moz-txt-link-freetext" href="https://www.geographie.uni-wuerzburg.de/fernerkundung/personen/remelgado_ruben_msc/">https://www.geographie.uni-wuerzburg.de/fernerkundung/personen/remelgado_ruben_msc/</a></pre>
  </body>
</html>