Skip to content

Commit 7e2d749

Browse files
committed
Updating Notebooks:
- fixed reading config_impedance.yaml (after manual edits, was still reading dummy file with non-edited values) in the 4th Notebook - minor fixes in the documentation of other Notebooks - added sample of config impedance file
1 parent 19391ff commit 7e2d749

File tree

9 files changed

+930
-101
lines changed

9 files changed

+930
-101
lines changed

.gitignore

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,21 @@ cwl/
4848
.virtual_documents/
4949

5050
# ignore some too large files
51-
data/input/vector/osm_merged_2023.gpkg
52-
data/input/vector/osm_merged_2022.gpkg
51+
src/data/input/vector/osm_merged_2023.gpkg
52+
src/data/input/vector/osm_merged_2022.gpkg
5353

5454
# Byte-compiled / optimized / DLL files
5555
pycache/
5656
*.py[cod]
5757
*$py.class
58+
__pycache__/
59+
60+
# output and intermediate data
61+
src/data/output/*
62+
**/*_pa.tif
63+
src/data/input/affinity
64+
src/data/input/protected_areas
65+
src/data/input/vector
5866

5967
# Distribution / packaging
6068
.Python
@@ -113,9 +121,6 @@ coverage.xml
113121
.pytest_cache/
114122
cover/
115123

116-
# exclude from nested directory
117-
1_protected_areas/.ipynb_checkpoints/
118-
1_protected_areas/cache/
119124

120125
# Translations
121126
*.mo

readme.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,33 +49,34 @@ Each Notebook is also supplied by the timing code to test performance.
4949

5050
As a rule of thumb, it is recommended to use input land-use/land-cover (LULC) datasets of reasonable extents, covering areas similar to Catalonia, Spain or Northern England (69 925 km<sup>2</sup> and 20 650 km<sup>2</sup>, respectively) to avoid issues related to API throttling.
5151

52-
**ATTENTION: before running the Notebook, make sure that:**
53-
1. You have at least one land-use/land-cover dataset in GeoTIFF format [here](data/input/lulc), which filename ends with a year, for example `lulc_esa_2017.tif`. You have also specified the impedance dataset filename in the [configuration file](config/config.yaml) in `lulc` key.
52+
**ATTENTION: before running the Notebooks, make sure that:**
53+
1. You have at least one land-use/land-cover dataset in GeoTIFF format [here](src/data/input/lulc), which filename ends with a year, for example `lulc_esa_2017.tif`. You have also specified the impedance dataset filename in the [configuration file](src/config/config.yaml) in `lulc` key.
5454

5555

56-
2. You have a corresponding landscape impedance/resistance dataset in GeoTIFF format [here](data/input/impedance), which filename ends with year, for example `impedance_lulc_esa_2017.tif`. You have also put the filename of impedance dataset to the [configuration file](config/config.yaml) in `impedance_tif` key.
56+
2. You have a corresponding landscape impedance/resistance dataset in GeoTIFF format [here](src/data/input/impedance), which filename ends with year, for example `impedance_lulc_esa_2017.tif`. You have also put the filename of impedance dataset to the [configuration file](src/config/config.yaml) in `impedance_tif` key.
5757

5858

59-
3. You also have a table [here](data/input/impedance) that maps all LULC categories from the 1st input with the values from the 2nd input. Do not rename columns as it might break some parts of Notebooks. \
59+
3. You also have a table [here](src/data/input/impedance) that maps all LULC categories from the 1st input with the values from the 2nd input. Do not rename columns as it might break some parts of Notebooks. \
6060
You should have five columns:
6161
| lulc | impedance | type | edge_effect | vector_refine |
6262
|------|-----------|--------|-------------|---------------|
6363
| 1 | 100 | roads | 1 | 1 |
6464
| 2 | 5 | forest | 0 | 0 |
65+
6566
- `lulc` points out the LULC category from the input LULC raster file
6667
- `impedance` defines the value of landscape impedance for this LULC category, derived from expert knowledge or found out by users from bibliography.
6768
- `type` is what this LULC category describes.
6869
- `edge_effect` is a boolean parameter - if 1 (`True`), this LULC category will be considered a 'biodiversity stressor' in the [4th Notebook](src/4_impedance.ipynb). If 0 (`False`), it won't be considered a stressor, so it won't update the initial impedance dataset.
6970
- `vector_refine` is a boolean parameter - if 1 (`True`), this LULC category will be enriched with vector data from OpenStreetMap. If 0 (`False`), it will be just saved from the input LULC raster file, if not overwritten by overlaying features from fetched data.
7071

71-
You have also put the filename of impedance dataset to the [configuration file](config/config.yaml) in `impedance` key.
72+
You have also put the filename of impedance dataset to the [configuration file](src/config/config.yaml) in `impedance` key.
7273

7374

7475
4. You have defined which LULC categories roads, railways and water features from vector data matches. For example, road and railways are described by the LULC=7 in the sample input dataset, and LULC=1 for water features. \
75-
Check `lulc_codes` in the [configuration file](config/config.yaml).
76+
Check `lulc_codes` in the [configuration file](src/config/config.yaml).
7677

7778

78-
5. You've received Protected Planet API token and put it to the [configuration file](config/config.yaml) in `token` key. You will only need it to run the [First Notebook](src/1_pas.ipynb) though.
79+
5. You've received Protected Planet API token and put it to the [configuration file](src/config/config.yaml) in `token` key. You will only need it to run the [First Notebook](src/1_pas.ipynb) though.
7980

8081

8182
**NOTEBOOK DESCRIPTIONS**
@@ -88,12 +89,21 @@ This workflow describes the enrichment of LULC data with protected areas. It pro
8889

8990
**Attention!** you need to obtain first personal credentials for Protected Planet API. Granting access to the API is not automatic and reviewed by the Protected Planet team.
9091

92+
Outputs from this Notebook are saved in the input directory, as they can be used as input in the next Notebooks:
93+
- [enriched LULC dataset](src/data/input/lulc) with `pa` suffix in the filename, GeoTIFF
94+
- [enriched landscape impedance dataset](src/data/input/impedance) with `pa` suffix in the filename, GeoTIFF
95+
- [landscape affinity dataset](src/data/input/affinity) with `pa` suffix in the filename, GeoTIFF
96+
97+
9198
2. [**Second Notebook**](src/2_vector.ipynb) extracts and cleans up data from OpenStreetMap (OSM) database at various timestamps. \
92-
This block uses [Overpass Turbo API](https://wiki.openstreetmap.org/wiki/Overpass_API) applied to fetch specific types of OSM features, including human-built infrastructure (roads and railways) and mostly natural features (inland waters - waterways and water bodies). Compared to the v.1.0.0, we have also excluded bridges and tunnels from Overpass Turbo API queries as they do not act as ecological barriers between habitats.
99+
This block uses [Overpass Turbo API](https://wiki.openstreetmap.org/wiki/Overpass_API) applied to fetch specific types of OSM features, including human-built infrastructure (roads and railways) and mostly natural features (inland waters - waterways and water bodies). Compared to the v.1.0.0, we have also excluded bridges and tunnels from Overpass Turbo API queries as they do not act as ecological barriers between habitats. \
100+
This block will provide user with OSM vector data by each year specified in the configuration file.
93101

94102
This block has multiple limitations, which can be explored in the Notebook, but the most important is timeline - OSM data through Overpass Turbo API are available from the earlier 2010s, which might lack a significant number of features compared to the current timestamp.
95103

96-
This block will provide user with OSM vector data by each year specified in the configuration file.
104+
Outputs from this Notebook are saved to the following paths:
105+
- [merged OSM features by year](src/data/input/vector), GPKG
106+
- [intermediate OSM features](src/data/output/osm_data), JSON, which might be deleted by user later on to clean up directory
97107

98108
3. [**Third Notebook**](src/3_enrichment.ipynb)
99109

@@ -104,7 +114,11 @@ Currently, this workflow has been successfully applied to enrich [MUCSC maps of
104114
Three types of input data are used:
105115
1. Raster land-use/land-cover (LULC) data, GeoTIFF format. ***MANDATORY***
106116
2. Vector data (GPKG) to enrich and refine LULC data (currently, roads, railways, water bodies and waterways are processed) derived either from OSM or user-specified data. ***MANDATORY***
107-
3. Tabular (CSV) data mapping LULC types to their specifications: (1) whether concrete LULC type should be refined by vector data or not (***MANDATORY***) and (2) whether negative "edge effect" of concrete LULC type should be considered, for instance, roads affect suitability of habitats alongside roads (***OPTIONAL***). This reclassification table is being used in the [first block](1_pas.ipynb) of the Data4Land tool.
117+
3. Tabular (CSV) data mapping LULC types to their specifications: (1) whether concrete LULC type should be refined by vector data or not (***MANDATORY***) and (2) whether negative "edge effect" of concrete LULC type should be considered, for instance, roads affect suitability of habitats alongside roads (***OPTIONAL***). This reclassification table is being used in the [first block](src/1_pas.ipynb) of the Data4Land tool.
118+
119+
Outputs from this Notebook are saved here:
120+
- [enriched LULC dataset](src/data/output) with `upd` suffix, GeoTIFF
121+
- [rasterised categories of OSM features](src/data/output), GeoTIFF
108122

109123
4. [**Third Notebook**](src/4_impedance.ipynb)
110124

0 commit comments

Comments
 (0)