This YAML file will be passed to the --envpth
argument to be able to download MODIS/VIIRS/Sentinel-2 data. This file needs to be located inside the mounted volume store in order for the internal processes to access the credentials.
--envpth /data/<credential>.yml
To build the image from this directory:
docker build -t <tagname> .
To run the Docker image use the following schema:
docker run --rm -v <local store>:/data <tagname> <extra_commands>
ARG | VALUES | TYPE |
---|---|---|
envpth | Linux path | string |
date | YYYY.MM.DD | string |
sat | modis / viirs / sentinel | string |
typ | watersheds / basins | string |
days | 1 / 5 / 8 | int |
OPTION | CAUSE |
---|---|
--rm | Removes container once it finishes running |
-v | Mount volume to Docker container |
To list out commands available:
The default CMD is "--help" to list out the available commands.
docker run --rm -v <mount_point>:/data <tag_name>
Why is there an authentication error when downloading MODIS or VIIRS data?
docker run --rm -v <mount_point>:/data <tag_name> daily-pipeline --envpth /data/<creds.yml> --date <target_date: YYYY.MM.DD>
daily-pipeline
kicks off the entire process chain that will include performing the following per satellite (MODIS/VIIRS):
Builds necessary supporting files and directories in order for the process pipeline to properly manage file I/O.
docker run --rm -v <mount_point>:/data <tag_name> build
High Level Directory Structure:
MODIS requires 5 or 8 days in order to build a composite of valid data. Option to download one day is possible. VIIRS will download a single day as it is a cloud-gap-filled product.
docker run --rm -v <mount_point>:/data <tag_name> download --envpth /data/<creds.yml> --sat <modis/viirs> --date <YYYY.MM.DD> --days <1/5/8>
Output:
modis-terra/<product>/<date>/.
MODIS requires 5 or 8 days in order to build a composite of valid data. Default value is 5 days.
docker run --rm -v <mount_point>:/data <tag_name> process --sat <modis/viirs> --date <YYYY.MM.DD> --days <1/5/8>
Output:
<watershed/basin>/<name>/<satellite>/<date>/.
Analyze each watershed and basin to calculate the snow coverage based on the NDSI value.
docker run --rm -v <mount_point>:/data <tag_name> run-analysis --typ <watersheds/basins> -sat <modis/viirs> --date <YYYY.MM.DD>
Output:
analysis/analysis.db
Convert the SQLITE3 database into a CSV
docker run --rm -v <mount_point>:/data <tag_name> dbtocsv
Output:
analysis/analysis.csv
Build the colour-ramp GTiff and KML versions of the watersheds/basins.
docker run --rm -v <mount_point>:/data <tag_name> build-kml --date <YYYY.MM.DD> --typ <watersheds/basins> --sat <modis/viirs>
Output :
<watersheds/basins>/<name>/<satellite>/<date>/.
kml/<date>/
Compose built KML files into a heirarchal KML
docker run --rm -v <mount_point>:/data <tag_name> compose-kmls --date <YYYY.MM.DD> --sat <modis/viirs>
ZIP KMLs into a ZIP file
docker run --rm -v <mount_point>:/data <tag_name> zip-kmls
KNOWN ISSUE: ZIP file is larger than original KMLs -- deprecated
Plot all watersheds and basins into PNG plots with mapped colour bar.
docker run --rm -v <mount_point>:/data <tag_name> plot --date <YYYY.MM.DD> --sat <modis/viirs>
Manually clean up files and directories.
TARGET | CAUSE |
---|---|
all | Non-vital directories in /data |
intermediate | Intermediate files in intermediate_\[tif/kml\] |
output | Output files in output_tif |
downloads | Raw granules in modis-terra/ |
watersheds | All files/dirs in watersheds/ |
basins | All files/dirs in basins/ |
docker run --rm -v <mount_point>:/data <tag_name> clean --target <target>
To build the image from this directory:
docker build -t <tagname> .
To run the Docker image use the following schema:
docker run --rm -it -v <local store>:/data <tagname> <extra_commands>
It is necessary to run the docker container in interactive mode (by including the -it
option when calling docker run
) as the Sentinel-2 process requires user interaction.
Call the Sentinel-2 pipeline
docker run --rm -it -v <mount point>:/data <tag name> process-sentinel --creds /data/<creds.yml> --lat <latitude> --lng <longtitude> --date <YYYY.MM.DD>
The pipeline will return a date ordered list of 10
OPTIONAL ARGS | VALUES | DEFAULT |
---|---|---|
--rgb | true / false | false |
--max-allowable-cloud | int | 50 |
--force-download | true / false | false |
--day-tolerance | int | 50 |
Outputs are logged to a log file in /data/log/
.
--rgb true
: Creates a RGB output GTiff of the selected tile--max-allowable-cloud <int>
: Max percentage of cloud cover that is allowable in the query. Default is 50%.--force-download true
: Deletes existing downloads in target directory--day-tolerance <int>
: Number of days to look back from target date with given cloud expections. Default is 50 days.Using default arguments to demonstrate expected output.
docker run --rm -it -v <mount point>:/data <tag name> process-sentinel --creds /data/sat.yml --lat 49.12 --lng -126.5 --date 2021.03.18
0 : DATE: 2021-03-17 || CLOUD%: 45.588648
1 : DATE: 2021-03-14 || CLOUD%: 17.49127
2 : DATE: 2021-03-07 || CLOUD%: 39.499657
3 : DATE: 2021-02-05 || CLOUD%: 16.117952
4 : DATE: 2021-01-31 || CLOUD%: 23.281466
5 : DATE: 2021-01-28 || CLOUD%: 2.606739
Pick which product to download and process [0-5/n]:
Calling with high cloud tolerance and demonstrate upper limit of selection and typical output.
docker run --rm -it -v <mount point>:/data <tag name> process-sentinel --creds /data/sat.yml --lat 49.73 --lng -126.5 --date 2021.03.18 --rgb true --max-allowable-cloud 90
0 : DATE: 2021-03-17 || CLOUD%: 32.746968
1 : DATE: 2021-03-14 || CLOUD%: 87.006531
2 : DATE: 2021-03-09 || CLOUD%: 45.446411
3 : DATE: 2021-03-07 || CLOUD%: 74.669036
4 : DATE: 2021-02-25 || CLOUD%: 84.000973
5 : DATE: 2021-02-22 || CLOUD%: 79.523277
6 : DATE: 2021-02-17 || CLOUD%: 56.401063
7 : DATE: 2021-02-15 || CLOUD%: 74.093911
8 : DATE: 2021-02-10 || CLOUD%: 32.880395
9 : DATE: 2021-02-07 || CLOUD%: 75.293885
Pick which product to download and process [0-9/n]: 0
Downloading: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.09G/1.09G [03:30<00:00, 5.19MB/s]MD5 checksumming: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.09G/1.09G [00:04<00:00, 231MB/s]
0
Notice the clouds and water are masked out form the analysis.
Calling with low cloud tolerance to demonstrate limited selection.
docker run --rm -it -v <mount point>:/data <tag name> process-sentinel --creds /data/sat.yml --lat 49.12 --lng -126.5 --date 2021.03.18 --max-allowable-cloud 20 --max-allowable-cloud 20
0 : DATE: 2021-03-14 || CLOUD%: 17.49127
1 : DATE: 2021-02-05 || CLOUD%: 16.117952
2 : DATE: 2021-01-28 || CLOUD%: 2.606739
Pick which product to download and process [0-2/n]: