Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
spatialthoughts committed Jan 19, 2024
1 parent 1bde2ef commit 0cf40db
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Add one more filter in the script below to select images
// from only one of the satellites - Sentinel-2A - from the
// Sentinel-2 constellation

// Hint1: Use the 'SPACECRAFT_NAME' property
// Hint2: Use the ee.Filter.eq() filter

var geometry = ee.Geometry.Point([77.60412933051538, 12.952912912328241]);
Map.centerObject(geometry, 10);

var s2 = ee.ImageCollection('COPERNICUS/S2_HARMONIZED');

var filtered = s2.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30))
var filtered = s2
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30))
.filter(ee.Filter.date('2019-01-01', '2020-01-01'))
.filter(ee.Filter.bounds(geometry));
// Remove this comment and add a filter here


print(filtered.size());

// Exercise
// Delete the 'geometry' variable
// Add a point at your chosen location
// Change the filter to find images from January 2023

// Note: If you are in a very cloudy region,
// make sure to adjust the CLOUDY_PIXEL_PERCENTAGE
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Add one more filter in the script below to select images
// from only one of the satellites - Sentinel-2A - from the
// Sentinel-2 constellation

// Hint1: Use the 'SPACECRAFT_NAME' property
// Hint2: Use the ee.Filter.eq() filter

var geometry = ee.Geometry.Point([77.60412933051538, 12.952912912328241]);
Map.centerObject(geometry, 10);

var s2 = ee.ImageCollection('COPERNICUS/S2_HARMONIZED');

var filtered = s2.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30))
var filtered = s2
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30))
.filter(ee.Filter.date('2019-01-01', '2020-01-01'))
.filter(ee.Filter.bounds(geometry));
// Remove this comment and add a filter here


print(filtered.size());

// Exercise
// Delete the 'geometry' variable
// Add a point at your chosen location
// Change the filter to find images from January 2023

// Note: If you are in a very cloudy region,
// make sure to adjust the CLOUDY_PIXEL_PERCENTAGE
34 changes: 17 additions & 17 deletions docs/end-to-end-gee.html
Original file line number Diff line number Diff line change
Expand Up @@ -1079,24 +1079,24 @@ <h3>Exercise</h3>
<p><a
href="https://code.earthengine.google.co.in/?scriptPath=users%2Fujavalgandhi%2FEnd-to-End-GEE%3A01-Earth-Engine-Basics%2F03c_Filtering_Image_Collection_(exercise)"
target="_blank">Try in Code Editor ↗</a></p>
<div class="sourceCode" id="cb5"><pre class="sourceCode js"><code class="sourceCode javascript"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a><span class="co">// Add one more filter in the script below to select images</span></span>
<span id="cb5-2"><a href="#cb5-2" tabindex="-1"></a><span class="co">// from only one of the satellites - Sentinel-2A - from the</span></span>
<span id="cb5-3"><a href="#cb5-3" tabindex="-1"></a><span class="co">// Sentinel-2 constellation</span></span>
<div class="sourceCode" id="cb5"><pre class="sourceCode js"><code class="sourceCode javascript"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a><span class="kw">var</span> geometry <span class="op">=</span> ee<span class="op">.</span><span class="at">Geometry</span><span class="op">.</span><span class="fu">Point</span>([<span class="fl">77.60412933051538</span><span class="op">,</span> <span class="fl">12.952912912328241</span>])<span class="op">;</span></span>
<span id="cb5-2"><a href="#cb5-2" tabindex="-1"></a></span>
<span id="cb5-3"><a href="#cb5-3" tabindex="-1"></a><span class="kw">var</span> s2 <span class="op">=</span> ee<span class="op">.</span><span class="fu">ImageCollection</span>(<span class="st">&#39;COPERNICUS/S2_HARMONIZED&#39;</span>)<span class="op">;</span></span>
<span id="cb5-4"><a href="#cb5-4" tabindex="-1"></a></span>
<span id="cb5-5"><a href="#cb5-5" tabindex="-1"></a><span class="co">// Hint1: Use the &#39;SPACECRAFT_NAME&#39; property</span></span>
<span id="cb5-6"><a href="#cb5-6" tabindex="-1"></a><span class="co">// Hint2: Use the ee.Filter.eq() filter</span></span>
<span id="cb5-7"><a href="#cb5-7" tabindex="-1"></a></span>
<span id="cb5-8"><a href="#cb5-8" tabindex="-1"></a><span class="kw">var</span> geometry <span class="op">=</span> ee<span class="op">.</span><span class="at">Geometry</span><span class="op">.</span><span class="fu">Point</span>([<span class="fl">77.60412933051538</span><span class="op">,</span> <span class="fl">12.952912912328241</span>])<span class="op">;</span></span>
<span id="cb5-9"><a href="#cb5-9" tabindex="-1"></a><span class="bu">Map</span><span class="op">.</span><span class="fu">centerObject</span>(geometry<span class="op">,</span> <span class="dv">10</span>)<span class="op">;</span></span>
<span id="cb5-10"><a href="#cb5-10" tabindex="-1"></a></span>
<span id="cb5-11"><a href="#cb5-11" tabindex="-1"></a><span class="kw">var</span> s2 <span class="op">=</span> ee<span class="op">.</span><span class="fu">ImageCollection</span>(<span class="st">&#39;COPERNICUS/S2_HARMONIZED&#39;</span>)<span class="op">;</span></span>
<span id="cb5-12"><a href="#cb5-12" tabindex="-1"></a></span>
<span id="cb5-13"><a href="#cb5-13" tabindex="-1"></a><span class="kw">var</span> filtered <span class="op">=</span> s2<span class="op">.</span><span class="fu">filter</span>(ee<span class="op">.</span><span class="at">Filter</span><span class="op">.</span><span class="fu">lt</span>(<span class="st">&#39;CLOUDY_PIXEL_PERCENTAGE&#39;</span><span class="op">,</span> <span class="dv">30</span>))</span>
<span id="cb5-14"><a href="#cb5-14" tabindex="-1"></a> <span class="op">.</span><span class="fu">filter</span>(ee<span class="op">.</span><span class="at">Filter</span><span class="op">.</span><span class="fu">date</span>(<span class="st">&#39;2019-01-01&#39;</span><span class="op">,</span> <span class="st">&#39;2020-01-01&#39;</span>))</span>
<span id="cb5-15"><a href="#cb5-15" tabindex="-1"></a> <span class="op">.</span><span class="fu">filter</span>(ee<span class="op">.</span><span class="at">Filter</span><span class="op">.</span><span class="fu">bounds</span>(geometry))<span class="op">;</span></span>
<span id="cb5-16"><a href="#cb5-16" tabindex="-1"></a> <span class="co">// Remove this comment and add a filter here</span></span>
<span id="cb5-17"><a href="#cb5-17" tabindex="-1"></a> </span>
<span id="cb5-18"><a href="#cb5-18" tabindex="-1"></a><span class="fu">print</span>(filtered<span class="op">.</span><span class="fu">size</span>())<span class="op">;</span></span></code></pre></div>
<span id="cb5-5"><a href="#cb5-5" tabindex="-1"></a><span class="kw">var</span> filtered <span class="op">=</span> s2</span>
<span id="cb5-6"><a href="#cb5-6" tabindex="-1"></a> <span class="op">.</span><span class="fu">filter</span>(ee<span class="op">.</span><span class="at">Filter</span><span class="op">.</span><span class="fu">lt</span>(<span class="st">&#39;CLOUDY_PIXEL_PERCENTAGE&#39;</span><span class="op">,</span> <span class="dv">30</span>))</span>
<span id="cb5-7"><a href="#cb5-7" tabindex="-1"></a> <span class="op">.</span><span class="fu">filter</span>(ee<span class="op">.</span><span class="at">Filter</span><span class="op">.</span><span class="fu">date</span>(<span class="st">&#39;2019-01-01&#39;</span><span class="op">,</span> <span class="st">&#39;2020-01-01&#39;</span>))</span>
<span id="cb5-8"><a href="#cb5-8" tabindex="-1"></a> <span class="op">.</span><span class="fu">filter</span>(ee<span class="op">.</span><span class="at">Filter</span><span class="op">.</span><span class="fu">bounds</span>(geometry))<span class="op">;</span></span>
<span id="cb5-9"><a href="#cb5-9" tabindex="-1"></a></span>
<span id="cb5-10"><a href="#cb5-10" tabindex="-1"></a><span class="fu">print</span>(filtered<span class="op">.</span><span class="fu">size</span>())<span class="op">;</span></span>
<span id="cb5-11"><a href="#cb5-11" tabindex="-1"></a></span>
<span id="cb5-12"><a href="#cb5-12" tabindex="-1"></a><span class="co">// Exercise</span></span>
<span id="cb5-13"><a href="#cb5-13" tabindex="-1"></a><span class="co">// Delete the &#39;geometry&#39; variable</span></span>
<span id="cb5-14"><a href="#cb5-14" tabindex="-1"></a><span class="co">// Add a point at your chosen location</span></span>
<span id="cb5-15"><a href="#cb5-15" tabindex="-1"></a><span class="co">// Change the filter to find images from January 2023</span></span>
<span id="cb5-16"><a href="#cb5-16" tabindex="-1"></a></span>
<span id="cb5-17"><a href="#cb5-17" tabindex="-1"></a><span class="co">// Note: If you are in a very cloudy region, </span></span>
<span id="cb5-18"><a href="#cb5-18" tabindex="-1"></a><span class="co">// make sure to adjust the CLOUDY_PIXEL_PERCENTAGE</span></span></code></pre></div>
</div>
</div>
<div id="creating-mosaics-and-composites-from-imagecollections"
Expand Down

0 comments on commit 0cf40db

Please sign in to comment.