<div class="xblock xblock-public_view xblock-public_view-vertical" data-course-id="course-v1:digitalearthafrica+DEA101+2021" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="vertical" data-usage-id="block-v1:digitalearthafrica+DEA101+2021+type@vertical+block@5792cbe7ab9645848f78223a8045e4fc" data-request-token="689b3338881211efa85e837f534d2eba" data-graded="True" data-has-score="False">
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:digitalearthafrica+DEA101+2021+type@html+block@2aa133430e9643acbd76f09e8454e772">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-course-id="course-v1:digitalearthafrica+DEA101+2021" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="html" data-usage-id="block-v1:digitalearthafrica+DEA101+2021+type@html+block@2aa133430e9643acbd76f09e8454e772" data-request-token="689b3338881211efa85e837f534d2eba" data-graded="True" data-has-score="False">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<p style="text-align: left;">In this exercise, we will apply a <strong>cloud mask</strong> to Sentinel-2 data off the coast of Ghana. Cloud masks are important as they remove bad data points from our dataset, so we can form a reliable composite image.</p>
</div>
</div>
</div>
<script type="text/javascript">
(function (require) {
require(['/static/js/dateutil_factory.be68acdff619.js?raw'], function () {
require(['js/dateutil_factory'], function (DateUtilFactory) {
DateUtilFactory.transform('.localized-datetime');
});
});
}).call(this, require || RequireJS.require);
</script>
<script>
function emit_event(message) {
parent.postMessage(message, '*');
}
</script>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-course-id="course-v1:digitalearthafrica+DEA101+2021" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="vertical" data-usage-id="block-v1:digitalearthafrica+DEA101+2021+type@vertical+block@3bd4588de0174e6882f045d17e972926" data-request-token="689b3338881211efa85e837f534d2eba" data-graded="True" data-has-score="False">
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:digitalearthafrica+DEA101+2021+type@html+block@05eac3190eaf4eba9265505eaa9a4583">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-course-id="course-v1:digitalearthafrica+DEA101+2021" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="html" data-usage-id="block-v1:digitalearthafrica+DEA101+2021+type@html+block@05eac3190eaf4eba9265505eaa9a4583" data-request-token="689b3338881211efa85e837f534d2eba" data-graded="True" data-has-score="False">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">Like in the last exercise, we will begin by making a new, blank Jupyter notebook. If you want more detailed instructions on making a new notebook, see <a class="reference internal" href="/courses/course-v1:digitalearthafrica+DEA101+2021/jump_to_id/73546668eb4442338866086926025db1" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer;" target="[object Object]">this section in the exercise on loading data in the Sandbox</a> from the previous session. Otherwise, follow the steps below.</p>
<ol class="arabic simple" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 24px; padding-left: 0px; list-style-position: initial; list-style-image: initial; line-height: 24px; text-align: left;">
<li style="box-sizing: border-box; list-style: decimal; margin-left: 24px; text-align: left;">
<p style="text-align: left; box-sizing: border-box; line-height: 24px; margin: 0px; font-size: 16px;">Navigate to the <strong style="box-sizing: border-box;">Training</strong> folder (or create this folder following the instructions in <a class="reference internal" href="/courses/course-v1:digitalearthafrica+DEA101+2021/jump_to_id/e42d02bfcd4b40f495c69ad733375ee3" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer;" target="[object Object]">Session 1</a>).</p>
</li>
<li style="box-sizing: border-box; list-style: decimal; margin-left: 24px; text-align: left;">
<p style="text-align: left; box-sizing: border-box; line-height: 24px; margin: 0px; font-size: 16px;">Click the <strong style="box-sizing: border-box;">+</strong> button and click <strong style="box-sizing: border-box;">Python 3</strong> under the <strong style="box-sizing: border-box;">Notebook</strong> section.</p>
</li>
<li style="text-align: left; box-sizing: border-box; list-style: decimal; margin-left: 24px;">
<p style="text-align: left; box-sizing: border-box; line-height: 24px; margin: 0px; font-size: 16px;">Rename your file so you know it is from this exercise. We will use this notebook for working with geomedians, so let us call it <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">Geomedian_composite.ipynb</span></code>.</p>
</li>
<li style="text-align: left; box-sizing: border-box; list-style: decimal; margin-left: 24px;">
<p style="text-align: left; box-sizing: border-box; line-height: 24px; margin: 0px; font-size: 16px;">Open the notebook.</p>
</li>
</ol>
</div>
</div>
</div>
<script type="text/javascript">
(function (require) {
require(['/static/js/dateutil_factory.be68acdff619.js?raw'], function () {
require(['js/dateutil_factory'], function (DateUtilFactory) {
DateUtilFactory.transform('.localized-datetime');
});
});
}).call(this, require || RequireJS.require);
</script>
<script>
function emit_event(message) {
parent.postMessage(message, '*');
}
</script>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-course-id="course-v1:digitalearthafrica+DEA101+2021" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="vertical" data-usage-id="block-v1:digitalearthafrica+DEA101+2021+type@vertical+block@2318df7224f4458894e07600146d7ac2" data-request-token="689b3338881211efa85e837f534d2eba" data-graded="True" data-has-score="False">
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:digitalearthafrica+DEA101+2021+type@html+block@942027747339478db1df32a25875a3da">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-course-id="course-v1:digitalearthafrica+DEA101+2021" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="html" data-usage-id="block-v1:digitalearthafrica+DEA101+2021+type@html+block@942027747339478db1df32a25875a3da" data-request-token="689b3338881211efa85e837f534d2eba" data-graded="True" data-has-score="False">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<h3 style="box-sizing: border-box;">Load packages and functions</h3>
<section id="Load-packages-and-functions" style="box-sizing: border-box;">In the first cell, type the following code and then run the cell. Recall that cells can be run by pressing <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">Shift</span> <span class="pre" style="box-sizing: border-box;">+</span> <span class="pre" style="box-sizing: border-box;">Enter</span></code> on your keyboard.<br /><img alt="image1" src="https://learn.digitalearthafrica.org/asset-v1:digitalearthafrica+DEA101+2021+type@asset+block@02_cloud_masking_01_imports.png" style="box-sizing: border-box; border: 0px; vertical-align: middle;" />
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">We used most of these packages and functions in the previous exercise on loading data in the Sandbox. <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">rgb</span></code> is for plotting true-colour images. <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">display_map</span></code> is for visualising the area we have selected.</p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">In this session we introduce two new functions: <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">load_ard</span></code> and <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">xr_geomedian</span></code>. We will use <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">load_ard</span></code> to load data so it is cloud masked, and <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">xr_geomedian</span></code> is used in the next section to compute the geomedian.</p>
</section>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:digitalearthafrica+DEA101+2021+type@html+block@056d817f8d87479aae02e235dd5a21c1">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-course-id="course-v1:digitalearthafrica+DEA101+2021" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="html" data-usage-id="block-v1:digitalearthafrica+DEA101+2021+type@html+block@056d817f8d87479aae02e235dd5a21c1" data-request-token="689b3338881211efa85e837f534d2eba" data-graded="True" data-has-score="False">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<h3 style="text-align: left;">Connect to the datacube</h3>
<p style="text-align: left;">Enter the following code and run the cell to create our <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">dc</span></code> object, which provides access to the datacube.</p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><img alt="image2" src="https://learn.digitalearthafrica.org/asset-v1:digitalearthafrica+DEA101+2021+type@asset+block@02_cloud_masking_02_connect_to_the_datacube.png" style="box-sizing: border-box; border: 0px; vertical-align: middle;" /></p>
<p style="text-align: left;"></p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">Your notebook is now set up. Next, we will load cloud-masked data using <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">load_ard()</span></code>.</p>
</div>
</div>
</div>
<script type="text/javascript">
(function (require) {
require(['/static/js/dateutil_factory.be68acdff619.js?raw'], function () {
require(['js/dateutil_factory'], function (DateUtilFactory) {
DateUtilFactory.transform('.localized-datetime');
});
});
}).call(this, require || RequireJS.require);
</script>
<script>
function emit_event(message) {
parent.postMessage(message, '*');
}
</script>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-course-id="course-v1:digitalearthafrica+DEA101+2021" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="vertical" data-usage-id="block-v1:digitalearthafrica+DEA101+2021+type@vertical+block@5b8e22b654d9403497477138ea634407" data-request-token="689b3338881211efa85e837f534d2eba" data-graded="True" data-has-score="False">
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:digitalearthafrica+DEA101+2021+type@html+block@cc5e30aa0e134195bb1d7f233f9d51bd">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-course-id="course-v1:digitalearthafrica+DEA101+2021" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="html" data-usage-id="block-v1:digitalearthafrica+DEA101+2021+type@html+block@cc5e30aa0e134195bb1d7f233f9d51bd" data-request-token="689b3338881211efa85e837f534d2eba" data-graded="True" data-has-score="False">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<div class="admonition note" style="text-align: left; box-sizing: border-box; -webkit-font-smoothing: antialiased; padding: 12px; line-height: 24px; margin-bottom: 24px; background: #e7f2fa; color: #000000;">
<p class="admonition-title" style="text-align: left; box-sizing: border-box; line-height: 1; margin: -12px -12px 12px; font-size: inherit; font-family: inherit; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: bold; font-stretch: normal; text-rendering: auto; -webkit-font-smoothing: antialiased; color: #ffffff; background: #6ab0de; padding: 6px 12px;">Note</p>
<p style="text-align: left; box-sizing: border-box; line-height: 24px; margin: 0px; font-size: 16px;">If you experience errors when running cells, check out the <a class="reference internal" href="/courses/course-v1:digitalearthafrica+DEA101+2021/jump_to_id/68d83335404e410789ab39f91223e36b" style="box-sizing: border-box; color: #2980b9; text-decoration-line: none; cursor: pointer;" target="[object Object]">troubleshooting code guide</a> from the previous session.</p>
</div>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">Let us take a look at a coastal area in Ghana. Enter the following code and run it to display a map of the area. As before, <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">x</span></code> denotes longitude and <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">y</span></code> denotes latitude.</p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><img alt="Example of display_map input and output." class="no-scaled-link" src="https://learn.digitalearthafrica.org/asset-v1:digitalearthafrica+DEA101+2021+type@asset+block@02_cloud_masking_displaymap.PNG" style="box-sizing: border-box; border: 0px; vertical-align: middle; width: 700px;" /></p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">In the new cell below, enter the following code, and then run it to load Sentinel-2 data. It will generate the output text <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">Using</span> <span class="pre" style="box-sizing: border-box;">pixel</span> <span class="pre" style="box-sizing: border-box;">quality</span> <span class="pre" style="box-sizing: border-box;">parameters</span> <span class="pre" style="box-sizing: border-box;">for</span> <span class="pre" style="box-sizing: border-box;">Sentinel</span> <span class="pre" style="box-sizing: border-box;">2</span> <span class="pre" style="box-sizing: border-box;">...</span></code>. The output text tells us we have loaded 4 timesteps.</p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><img alt="Using load_ard." class="no-scaled-link" src="https://learn.digitalearthafrica.org/asset-v1:digitalearthafrica+DEA101+2021+type@asset+block@02_cloud_masking_loadard.png" style="box-sizing: border-box; border: 0px; vertical-align: middle; width: 700px;" /></p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">Take note of some of the differences between <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">dc.load()</span></code> and <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">load_ard</span></code>.</p>
<ul>
<li><code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">dc=dc</span></code> is a required parameter for <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">load_ard()</span></code>. This links the data search to the datacube connection, which we defined in the notebook setup as <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">dc</span></code>.</li>
<li>The paramter for loading products is <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">products</span></code> (plural) not <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">product</span></code> as it is in <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">dc.load()</span></code>.</li>
<li>Product items must be listed inside square brackets <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">[]</span></code>, which is not required for <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">dc.load()</span></code>.</li>
<li><code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">min_gooddata</span></code> stands for ‘minimum good data’ and discards observations with less than the fractional requisite of good quality pixels.</li>
</ul>
<div class="admonition note" style="box-sizing: border-box; -webkit-font-smoothing: antialiased; padding: 12px; line-height: 24px; margin-bottom: 24px; background: #e7f2fa;">
<p class="admonition-title" style="text-align: left; box-sizing: border-box; line-height: 1; margin: -12px -12px 12px; font-size: inherit; font-family: inherit; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: bold; font-stretch: normal; text-rendering: auto; -webkit-font-smoothing: antialiased; color: #ffffff; background: #6ab0de; padding: 6px 12px;">Note</p>
<p style="text-align: left; box-sizing: border-box; line-height: 24px; margin: 0px; font-size: 16px;"><code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">s2_l2a</span></code> stands for <strong style="box-sizing: border-box;">S</strong>entinel-<strong style="box-sizing: border-box;">2</strong> <strong style="box-sizing: border-box;">L</strong>evel-<strong style="box-sizing: border-box;">2A</strong>. The fourth character is a lower-case alphabet ‘l’. Double-check you have entered the product name correctly to avoid errors.</p>
</div>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">We can use the same <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">rgb</span></code> plotting code as in the last session to show an RGB image of one of the timesteps. Let’s start with the first timestep, which has an <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">index</span></code> of <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">0</span></code>.</p>
<p style="text-align: left; box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px;"><img alt="Plotting an RGB of the first timestep." class="no-scaled-link" src="https://learn.digitalearthafrica.org/asset-v1:digitalearthafrica+DEA101+2021+type@asset+block@02_cloud_masking_cloudmask1.png" style="box-sizing: border-box; border: 0px; vertical-align: middle; width: 700px;" /></p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">This should produce a single RGB image as shown below. What happens if you try changing the <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">index</span></code> number?</p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; text-align: left;"><img alt="Output RGB of the first timestep." class="no-scaled-link" src="https://learn.digitalearthafrica.org/asset-v1:digitalearthafrica+DEA101+2021+type@asset+block@02_cloud_masking_rgbout.PNG" style="box-sizing: border-box; border: 0px; vertical-align: middle; width: 550px;" /></p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">If we want to see RGB images of all the timesteps at once, we can replace the <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">index</span></code> parameter with the <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">col</span></code> parameter. The parameter <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">col</span></code> stands for ‘column’. Specifying <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">col='time'</span></code> creates a row of images for the timesteps.</p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><img alt="Plotting RGBs of all timestep." class="no-scaled-link" src="https://learn.digitalearthafrica.org/asset-v1:digitalearthafrica+DEA101+2021+type@asset+block@02_cloud_masking_cloudmask2.png" style="box-sizing: border-box; border: 0px; vertical-align: middle; width: 700px;" /></p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">The output should look like this.</p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;"><img alt="Output RGBs from col=time." class="no-scaled-link" src="https://learn.digitalearthafrica.org/asset-v1:digitalearthafrica+DEA101+2021+type@asset+block@02_cloud_masking_colout.PNG" style="box-sizing: border-box; border: 0px; vertical-align: middle; width: 800px;" /></p>
</div>
</div>
</div>
<script type="text/javascript">
(function (require) {
require(['/static/js/dateutil_factory.be68acdff619.js?raw'], function () {
require(['js/dateutil_factory'], function (DateUtilFactory) {
DateUtilFactory.transform('.localized-datetime');
});
});
}).call(this, require || RequireJS.require);
</script>
<script>
function emit_event(message) {
parent.postMessage(message, '*');
}
</script>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-course-id="course-v1:digitalearthafrica+DEA101+2021" data-init="VerticalStudentView" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="vertical" data-usage-id="block-v1:digitalearthafrica+DEA101+2021+type@vertical+block@fd5befb970b4492b960b113d63f59488" data-request-token="689b3338881211efa85e837f534d2eba" data-graded="True" data-has-score="False">
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:digitalearthafrica+DEA101+2021+type@html+block@28a42d53d3584da0820f79c9f87e608e">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-course-id="course-v1:digitalearthafrica+DEA101+2021" data-init="XBlockToXModuleShim" data-runtime-class="LmsRuntime" data-runtime-version="1" data-block-type="html" data-usage-id="block-v1:digitalearthafrica+DEA101+2021+type@html+block@28a42d53d3584da0820f79c9f87e608e" data-request-token="689b3338881211efa85e837f534d2eba" data-graded="True" data-has-score="False">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">Good work — you have now loaded data using <code class="docutils literal notranslate" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', Courier, monospace; font-size: 12px; white-space: nowrap; max-width: 100%; background-image: initial; background-color: #ffffff; border: 1px solid #e1e4e5; padding: 2px 5px; color: #e74c3c; overflow-x: auto;"><span class="pre" style="box-sizing: border-box;">load_ard()</span></code>, which has an automatic cloud mask. We can see that the images at different timesteps have different cloud cover, so they have been masked in different places. This is why having data at different timesteps can allow us to create a composite image without any cloud.</p>
<p style="box-sizing: border-box; line-height: 24px; margin: 0px 0px 24px; font-size: 16px; text-align: left;">In the next section, we will use this loaded data to create a geomedian composite.</p>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:digitalearthafrica+DEA101+2021+type@problem+block@8cd96253eee245df9984ec9decd9a9fd">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-course-id="course-v1:digitalearthafrica+DEA101+2021" data-block-type="problem" data-usage-id="block-v1:digitalearthafrica+DEA101+2021+type@problem+block@8cd96253eee245df9984ec9decd9a9fd" data-request-token="689b3338881211efa85e837f534d2eba" data-graded="True" data-has-score="True">
<div class="page-banner"><div class="alert alert-warning"><span class="icon icon-alert fa fa fa-warning" aria-hidden="true"></span><div class="message-content">Knowledge Check: load_ard() is only accessible to enrolled learners. Sign in or register, and enroll in this course to view it.</div></div></div>
</div>
</div>
</div>
<script type="text/javascript">
(function (require) {
require(['/static/js/dateutil_factory.be68acdff619.js?raw'], function () {
require(['js/dateutil_factory'], function (DateUtilFactory) {
DateUtilFactory.transform('.localized-datetime');
});
});
}).call(this, require || RequireJS.require);
</script>
<script>
function emit_event(message) {
parent.postMessage(message, '*');
}
</script>
</div>