Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] i.sentinel3.import: New addon to import Sentinel-3 data #612

Draft
wants to merge 11 commits into
base: grass7
Choose a base branch
from
4 changes: 4 additions & 0 deletions src/imagery/i.sentinel/i.sentinel.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ <h2>DESCRIPTION</h2>
<a href="https://scihub.copernicus.eu/">Copernicus Open Access Hub</a></dd>
<dt><a href="i.sentinel.import.html">i.sentinel.import</a></dt>
<dd>imports already downloaded Sentinel products into GRASS GIS mapset</dd>
<dt><a href="i.sentinel3.import.html">i.sentinel3.import</a></dt>
<dd>imports already downloaded Sentinel-3 products into GRASS GIS mapset</dd>
<dt><a href="i.sentinel.preproc.html">i.sentinel.preproc</a></dt>
<dd>imports and performs atmospheric correction on Sentinel-2 images</dd>
<dt><a href="i.sentinel.mask.html">i.sentinel.mask</a></dt>
Expand All @@ -56,6 +58,8 @@ <h2>AUTHORS</h2>
Roberta Fagandini, GSoC 2018 student, Italy
<p>
Anika Weinmann, Guido Riembauer, Markus Neteler, <a href="https://www.mundialis.de/">mundialis</a>, Germany
<p>
Stefan Blumentrath, <a href="https://www.nina.no/">NINA</a>, Norway

<!--
<p>
Expand Down
7 changes: 7 additions & 0 deletions src/imagery/i.sentinel/i.sentinel3.import/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MODULE_TOPDIR = ../..

PGM = i.sentinel3.import

include $(MODULE_TOPDIR)/include/Make/Script.make

default: script
137 changes: 137 additions & 0 deletions src/imagery/i.sentinel/i.sentinel3.import/i.sentinel3.import.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<h2>DESCRIPTION</h2>

The <em>i.sentinel3.import</em> module allows importing Copernicus Sentinel-3 products
downloaded by the <em><a href="i.sentinel.download.html">i.sentinel.download</a></em>
module.

<p>
By default <em>i.sentinel3.import</em> imports all Sentinel-3 scene files found
in the <b>input</b> directory. The number of scene files can be optionally
reduced by the <b>pattern</b> option or filtered by modification time using the
<b>modified_after</b> and/or <b>modified_before</b> option. In the <b>pattern</b>
option, a regular expression for filtering the file names should be given, e.g.
"0179_076_100_0900_LN2" for importing only specific tiles.
<p>
The <em>Sentinel-3</em> products are provided in different formats. Not all of
them are currently directly supported by GDAL. Some, like the e.g. the LST products
consist of several netCDF4 files, where geometry and image information are stored in
different files. Therefore, a GRASS GIS specific import routine has been implemented
for those formats. This routine imports the data pixel-wise after transforming them
from WGS84 into the projection of the current LOCATION. <em>r.in.xyz</em> is then
used to read the coordinates into a GRASS GIS raster map.
Thus, the <em>the user has to set the computational region extent and
resolution appropriately, to import the data of interest in the correct resolution</em>.

<p>
By default, ancillary data and quality flag data are imported as well - as artificial
bands. Import of those additional data layers can be deactivated using the <b>ancillary_bands</b>
and <b>quality_bands</b> option.

<p>
For each imported band both scene and band specific metadata are written into the map history
(<em><a href="https://grass.osgeo.org/grass-stable/manuals/r.support.html">r.support</a></em>).
In addition, the scene name is stored as <em>source1</em> and the imported or linked file name as
<em>source2</em>. Also, sensing time is written into the timestamp of the
map. After import, the metadata can be retrieved with <em>r.info -e</em>
as shown below.


<h2>NOTES</h2>

<p>
Currently, only import of SL_2_LST__ products from Sentinel-3 SLSTR sensor are supported.
<p>
By means of the <b>register_file</b> option <em>i.sentinel3.import</em> allows
creating a file which can be used to register imported imagery data
into a space-time raster dateset (STRDS) with
<em><a href="https://grass.osgeo.org/grass-stable/manuals/t.register.html">t.register</a></em>.
See example below.

<p>
<h3>Metadata storage</h3>

By using the <b>-j</b> flag the band metadata are additionally stored
in JSON format (in the current mapset under <tt>cell_misc</tt>).


<h2>EXAMPLES</h2>

<h3>List Sentinel bands</h3>

At first, print the list of raster files to be imported with <b>-p</b> flag. For
each file also product content is printed:

<div class="code"><pre>
i.sentinel3.import -p input=./data/ nprocs=4 modified_before="2021-09-09" \
product=LST basename=S3_LST

...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "data"? Are the quotes necessary there? Also, maybe put some of the resulting printed info as example and not only the ... ;)

</pre></div>

<h3>Import Sentinel-3 data</h3>
Import all Sentinel-3 data found in <i>data</i> directory and store metadata
as JSON files within the GRASS GIS database directory:
<div class="code"><pre>
i.sentinel3.import -a -c -j input=./data/ nprocs=4 modified_before="2021-09-09" \
product=LST basename=S3_LST
</pre></div>


<h3>Register imported Sentinel-3 data into STRDS</h3>

<div class="code"><pre>
i.sentinel3.import -a -c -j input=./data/ register_output=./data/reg.txt nprocs=4 \
modified_before="2021-09-09" product=LST basename=S3_LST

# register imported data into existing STRDS
t.register input=Sentinel_3 file=data/reg.txt
</pre></div>

A register file typically contains two columns: imported raster map
name and timestamp separated by <tt>|</tt>. In the case of current
development version of GRASS GIS which supports band references concept
(see <em><a href="https://grass.osgeo.org/grass-devel/manuals/g.bands.html">g.bands</a></em> module for details) a
register file is extended by a third column containg band reference
information, see the examples below.

<div class="code"><pre>
# register file produced by stable GRASS GIS 7.8 version
S3_imp_surface_temperature_20210907T205026|2021-09-07T20:50:26.285902+00:00|2021-09-07T20:53:25.977846+00:00
S3_imp_surface_temperature_standard_error_20210907T205026|2021-09-07T20:50:26.285902+00:00|2021-09-07T20:53:25.977846+00:00
S3_imp_confidence_20210907T205026|2021-09-07T20:50:26.285902+00:00|2021-09-07T20:53:25.977846+00:00
...
# register file produced by development GRASS GIS 7.9 version
S3_imp_surface_temperature_20210907T205026|2021-09-07T20:50:26.285902+00:00|2021-09-07T20:53:25.977846+00:00|S3_surface_temperature
S3_imp_surface_temperature_standard_error_20210907T205026|2021-09-07T20:50:26.285902+00:00|2021-09-07T20:53:25.977846+00:00|S3_surface_temperature_standard_error
S3_imp_confidence_20210907T205026|2021-09-07T20:50:26.285902+00:00|2021-09-07T20:53:25.977846+00:00|S3_confidence
</pre></div>

<h2>REQUIREMENTS</h2>
The following Python libraries are required
<ul>
<li>GDAL (install through system software management)</li>
<li>numpy</li>
<li>netcdf4</li>
<li>cf-units (for unit conversion)</li>
</ul>

<h2>SEE ALSO</h2>

<em>
<a href="i.sentinel.html">Overview of i.sentinel toolset</a>
</em>
<p>
<em>
<a href="i.sentinel.download.html">i.sentinel.download</a>,
<a href="https://grass.osgeo.org/grass-stable/manuals/r.in.xyz.html">r.in.xyz</a>,
<a href="https://grass.osgeo.org/grass-stable/manuals/t.register.html">t.register</a>
</em>

<h2>AUTHOR</h2>

Stefan Blumentrath, <a href="https://www.nina.no/">NINA</a>, Norway

<!--
<p>
<i>Last changed: $Date$</i>
-->
Loading
Loading