Skip to content

Commit a33f3b0

Browse files
Landsat dataset updated
New datasets include 250m resolution for 2005 and 2010 and 30m resolution for 2020. Documentation updated accordingly (#29)
1 parent c240adc commit a33f3b0

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

landsat/README.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,29 @@ And the structure of the files is as following:
1212

1313
```console
1414
/project/rpp-kshook/Model_Output/Landsat/
15-
├── land_change_2010v2_2015v2_30m_tif.zip
15+
├── land_change_2010v2_2015v2_30m_tif.zip
16+
├── land_cover_2005v3_250m_tif.zip
17+
├── land_cover_2010v2_250m_tif.zip
1618
├── land_cover_2010v2_30m_tif.zip
1719
├── land_cover_2015v2_30m_tif.zip
20+
├── land_cover_2020_30m_tif.zip
1821
└── dl-landcover.sh
1922
```
2023

2124
## Spatial and Temporal Extents
2225

23-
The spatial extent of this dataset (so far only `NALCMS` that is a land cover dataset) covers longitudes from approximately `-180` to `-50` degress and latitudes from approximately `+14` to `+84` degress. This dataset is available for 2010 and 2015. Furthermore, one static dataset variable is also included demonstrating the gains and losses of various land covers between 2010 and 2015. Please see the list of variables for more information.
26+
The spatial extent of this dataset (so far only `NALCMS` that is a land cover dataset) covers longitudes from approximately `-180` to `-50` degress and latitudes from approximately `+14` to `+84` degress. This dataset is available for 2005 and 2020. Furthermore, one static dataset variable is also included demonstrating the gains and losses of various land covers between 2010 and 2015. Please see the list of variables for more information.
27+
28+
| :point_up: | The 250m resolution datasets for 2005 and 2010 are not *Landsat* products, but *MODIS*. However, as a temporary measure, these two datasets are included in the `landsat` workflow in `gistool`.|
29+
|---------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
2430

2531
## Dataset Variables
2632
This variables of this dataset are detailed in the table below:
2733

28-
|# |Variable Name (used in `gistool`) |Description |Comments |
29-
|-------|---------------------------------------|-----------------------------------------------|---------------|
30-
|1 |land-cover |Land cover classes for 2010 and 2015 |[2010 dataset info](http://www.cec.org/north-american-environmental-atlas/land-cover-2010-landsat-30m/) and [2015 dataset info](http://www.cec.org/north-american-environmental-atlas/land-cover-30m-2015-landsat-and-rapideye/)|
31-
|2 |land-cover-change |Land cover change (between 2010 and 2015) |[2010-2015 difference info](http://www.cec.org/north-american-environmental-atlas/land-cover-change-30m-2010-2015-landsat/)|
34+
|# |Variable Name (used in `gistool`) |Description |Comments |
35+
|-------|---------------------------------------|------------------------------------------------|---------------|
36+
|1 |land-cover |Land cover classes for 2005, 2010, 2015 and 2020|[2005 dataset info](http://www.cec.org/north-american-environmental-atlas/land-cover-2005-modis-250m/), [2010-30m dataset info](http://www.cec.org/north-american-environmental-atlas/land-cover-2010-landsat-30m/), [2010-250m dataset info](http://www.cec.org/north-american-environmental-atlas/land-cover-2010-modis-250m/), [2015 dataset info](http://www.cec.org/north-american-environmental-atlas/land-cover-30m-2015-landsat-and-rapideye/), [2020 dataset info](http://www.cec.org/north-american-environmental-atlas/land-cover-30m-2020/)|
37+
|2 |land-cover-change |Land cover change (between 2010 and 2015) |[2010-2015 difference info](http://www.cec.org/north-american-environmental-atlas/land-cover-change-30m-2010-2015-landsat/)|
3238

3339

3440
# Other relevant information

landsat/landsat.sh

+17-13
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ renvPackagePath="${renvCache}/renv_0.16.0.tar.gz" # renv_0.16.0 source path
117117
# Necessary Global Variables
118118
# ==========================
119119
# the structure of the landcover file names is as following:
120-
# * land_cover_%YYYYv2_30m_tif.zip,
120+
# * land_cover_%YYYYv2_30m_tif.zip, or
121+
# * land_cover_%YYYY_30m_tif.zip,
121122
# and the structure of the landcover change file name is as following:
122123
# * land_change_2010v2_2015v2_30m_tif.zip
123124
#
@@ -130,13 +131,12 @@ renvPackagePath="${renvCache}/renv_0.16.0.tar.gz" # renv_0.16.0 source path
130131
# be equal to 'land_cover_change'
131132

132133
# valid years when landsat landcover data are available
133-
validYears=(2010 2015) # update as new data becomes available
134+
validYears=(2005 2010 2015 2020) # update as new data becomes available
134135

135-
# constant prefix and suffix for landcover's nomeclature
136+
# constant prefix landcover's nomeclature
136137
landcoverPrefix="land_cover_"
137-
landcoverSuffix="v2_30m_tif.zip"
138138

139-
# constant prefix and suffix for landcoverchange's nomenclature
139+
# constant name for landcoverchange's
140140
landcoverchangeFile="land_change_2010v2_2015v2_30m_tif.zip"
141141

142142

@@ -294,12 +294,9 @@ for var in "${variables[@]}"; do
294294
exit 1;
295295
fi
296296
# extract the entered years and populate $files array
297-
for y in ${validYears[@]}; do
297+
for y in "${validYears[@]}"; do
298298
if [[ "$y" -ge "${startDate}" ]] && [[ "$y" -le "${endDate}" ]]; then
299-
files+=("${landcoverPrefix}${y}${landcoverSuffix}")
300-
else
301-
echo "$(logDate)$(basename $0): ERROR! Years out of range"
302-
exit 1;
299+
files+=("${landcoverPrefix}${y}")
303300
fi
304301
done
305302
;;
@@ -328,11 +325,18 @@ if [[ ${#files[@]} == 0 ]]; then
328325
exit 1;
329326
fi
330327

328+
# empty array for complete file names
329+
filesComplete=()
330+
# populating filesComplete array
331+
for f in "${files[@]}"; do
332+
filesComplete+=($(ls -d ${geotiffDir}/${f}* | xargs -n 1 basename))
333+
done
334+
331335
# extracting the .zip files
332336
echo "$(logDate)$(basename $0): Extracting Landsat .zip files..."
333-
for file in "${files[@]}"; do
337+
for zipFile in "${filesComplete[@]}"; do
334338
# IMPORTANT: 7z is needed as a dependency
335-
7z e -y -bsp0 -bso0 "${geotiffDir}/${file}" -o${cache} *.tif -r
339+
7z e -y -bsp0 -bso0 "${geotiffDir}/${zipFile}"* -o${cache} *.tif -r
336340
done
337341

338342
# list *.tif (not .tiff as per files' names)
@@ -370,7 +374,7 @@ if [[ -n "$shapefile" ]] && [[ -n $stats ]]; then
370374
tempInstallPath="$cache/r-packages"
371375
mkdir -p "$tempInstallPath"
372376
export R_LIBS_USER="$tempInstallPath"
373-
377+
374378
# extract given stats for each variable
375379
for tif in "${tiffs[@]}"; do
376380
IFS='.' read -ra fileName <<< "$tif"

0 commit comments

Comments
 (0)