<!-- Generated by pkgdown: do not edit by hand -->
<!DOCTYPE html>
<html lang="en">
  <head>
  <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Provide URL's for Copernicus Global Land Service datasets — cgls_urls • spatialEco</title>


<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<!-- Bootstrap -->

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous" />

<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script>

<!-- bootstrap-toc -->
<link rel="stylesheet" href="../bootstrap-toc.css">
<script src="../bootstrap-toc.js"></script>

<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous" />

<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script>

<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>

<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script>




<meta property="og:title" content="Provide URL's for Copernicus Global Land Service datasets — cgls_urls" />
<meta property="og:description" content="Returns URL's of a product/version/resolution" />




<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>

<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->



  </head>

  <body data-spy="scroll" data-target="#toc">
    <div class="container template-reference-topic">
      <header>
      <div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <span class="navbar-brand">
        <a class="navbar-link" href="../index.html">spatialEco</a>
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.3-7</span>
      </span>
    </div>

    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
        <li>
  <a href="../index.html">
    <span class="fas fa-home fa-lg"></span>
     
  </a>
</li>
<li>
  <a href="../reference/index.html">Reference</a>
</li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li>
  <a href="https://github.com/jeffreyevans/spatialEco/">
    <span class="fab fa-github fa-lg"></span>
     
  </a>
</li>
      </ul>
      
    </div><!--/.nav-collapse -->
  </div><!--/.container -->
</div><!--/.navbar -->

      

      </header>

<div class="row">
  <div class="col-md-9 contents">
    <div class="page-header">
    <h1>Provide URL's for Copernicus Global Land Service datasets</h1>
    <small class="dont-index">Source: <a href='https://github.com/jeffreyevans/spatialEco/blob/master/R/cgls_urls.R'><code>R/cgls_urls.R</code></a></small>
    <div class="hidden name"><code>cgls_urls.Rd</code></div>
    </div>

    <div class="ref-description">
    <p>Returns URL's of a product/version/resolution</p>
    </div>

    <pre class="usage"><span class='fu'>cgls_urls</span><span class='op'>(</span>
  dates <span class='op'>=</span> <span class='cn'>NULL</span>,
  resolution <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='fl'>1000</span>, <span class='fl'>300</span><span class='op'>)</span>,
  product <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"fapar"</span>, <span class='st'>"fcover"</span>, <span class='st'>"lai"</span>, <span class='st'>"ndvi"</span><span class='op'>)</span>,
  ver <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"newest"</span>, <span class='st'>"v1"</span>, <span class='st'>"v2"</span>, <span class='st'>"v3"</span><span class='op'>)</span>
<span class='op'>)</span></pre>

    <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
    <table class="ref-arguments">
    <colgroup><col class="name" /><col class="desc" /></colgroup>
    <tr>
      <th>dates</th>
      <td><p>Dates to subset default is NULL, returns all products</p></td>
    </tr>
    <tr>
      <th>resolution</th>
      <td><p>The product resolution c("1km", "300m"),</p></td>
    </tr>
    <tr>
      <th>product</th>
      <td><p>Which product to query options are "fapar",</p></td>
    </tr>
    <tr>
      <th>ver</th>
      <td><p>Product version options are "newest", "v1", "v2", "v3"</p></td>
    </tr>
    </table>

    <h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>

    <p>A vector of download URL's for the products</p>
    <h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>

    <p>Provides a query of the ESA's Copernicus Global Land Service global 
The query is performed on the manifest files and return URL's
however, to download data you will need login credentials which,
can be acquired from: http://land.copernicus.eu</p>
<p>If provided, dates need to be in a "YYYY-MM-DD" format. The dates 
are an explicit search string and can contain dates that are not in 
the imagery. As such, the user should generate a daily date string
representing the range of the desired download as not to have to 
guess the available dates. Also note that multiple processing versions
of a given image are retained in the manifest. This means that if you
download a previous processing version, it could be an invalid image.
It is highly recommended that you do not change the default  
ver="newest" argument unless there is a specific reason to.</p>
<p>Available products</p><ul>
<li><p>fapar Fraction of photosynthetically active radiation  
                 absorbed by the vegetation</p></li>
<li><p>fcover Fraction of green vegetation cover</p></li>
<li><p>lai Leaf Area index</p></li>
<li><p>ndvi Normalized Difference Vegetation Index</p></li>
</ul>

<p>Not yet implemented; Soil Water Index, Surface Soil Moisture,
Copernicus product details: http://land.copernicus.eu/global/products/</p>
    <h2 class="hasAnchor" id="author"><a class="anchor" href="#author"></a>Author</h2>

    <p>Jeffrey S. Evans  &lt;jeffrey_evans@tnc.org&gt;</p>

    <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
    <pre class="examples"><div class='input'><span class='co'># Create date string for query</span>
<span class='va'>d</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/seq.html'>seq</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/as.Date.html'>as.Date</a></span><span class='op'>(</span><span class='st'>"2020/05/01"</span><span class='op'>)</span>, <span class='fu'><a href='https://rdrr.io/r/base/as.Date.html'>as.Date</a></span><span class='op'>(</span><span class='st'>"2020-09-01"</span><span class='op'>)</span>, by<span class='op'>=</span><span class='st'>"day"</span><span class='op'>)</span>

<span class='co'># Search for 300m (333m) LAI within specified date range </span>
<span class='va'>all.urls</span> <span class='op'>&lt;-</span> <span class='fu'>cgls_urls</span><span class='op'>(</span>dates <span class='op'>=</span> <span class='va'>d</span>, resolution <span class='op'>=</span> <span class='fl'>300</span>, 
                        product <span class='op'>=</span> <span class='st'>"lai"</span><span class='op'>)</span>    
<span class='co'># Search for 1000m LAI within specified date range  </span>
<span class='va'>all.urls</span> <span class='op'>&lt;-</span> <span class='fu'>cgls_urls</span><span class='op'>(</span>dates <span class='op'>=</span> <span class='va'>d</span>, resolution <span class='op'>=</span> <span class='fl'>1000</span>, 
                        product <span class='op'>=</span> <span class='st'>"lai"</span><span class='op'>)</span>    

<span class='co'># Return all 300m LAI </span>
<span class='va'>lai</span> <span class='op'>&lt;-</span> <span class='fu'>cgls_urls</span><span class='op'>(</span>resolution <span class='op'>=</span> <span class='fl'>300</span>, product <span class='op'>=</span> <span class='st'>"lai"</span><span class='op'>)</span>
    <span class='fu'><a href='https://rdrr.io/pkg/raster/man/headtail.html'>head</a></span><span class='op'>(</span> <span class='fu'><a href='https://rdrr.io/r/base/basename.html'>basename</a></span><span class='op'>(</span><span class='va'>lai</span><span class='op'>)</span> <span class='op'>)</span>
</div><div class='output co'>#&gt; [1] "c_gls_LAI300-RT0_202105200000_GLOBE_OLCI_V1.1.1.nc"
#&gt; [2] "c_gls_LAI300_202006300000_GLOBE_PROBAV_V1.0.1.nc"  
#&gt; [3] "c_gls_LAI300_202006200000_GLOBE_PROBAV_V1.0.1.nc"  
#&gt; [4] "c_gls_LAI300_202006100000_GLOBE_PROBAV_V1.0.1.nc"  
#&gt; [5] "c_gls_LAI300_202005310000_GLOBE_PROBAV_V1.0.1.nc"  
#&gt; [6] "c_gls_LAI300_202005200000_GLOBE_PROBAV_V1.0.1.nc"  </div><div class='input'>

<span class='co'>## Example of downloading URL's</span>
<span class='co'>## You need to define your login credentials to download data</span>
<span class='co'># username = "xxxx"  </span>
<span class='co'># password = "xxxx" </span>
<span class='co'>#     </span>
<span class='co'>#   for(i in 1:length(all.urls)){</span>
<span class='co'>#     if(i &gt; 1){ Sys.sleep(3) }</span>
<span class='co'>#     file.url &lt;- paste0("https://", paste(username, password, sep=":"), "@", </span>
<span class='co'>#                        sub(".*//", "", all.urls[i]))  </span>
<span class='co'>#     download.file(file.url, file.path(getwd(), </span>
<span class='co'>#                 basename(all.urls[i])), mode = 'wb') </span>
<span class='co'>#   }</span>

</div></pre>
  </div>
  <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
    <nav id="toc" data-toggle="toc" class="sticky-top">
      <h2 data-toc-skip>Contents</h2>
    </nav>
  </div>
</div>


      <footer>
      <div class="copyright">
  <p>Developed by Jeffrey S. Evans.</p>
</div>

<div class="pkgdown">
  <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.6.1.</p>
</div>

      </footer>
   </div>

  


  </body>
</html>


