Skip to content

Commit

Permalink
Copernicus land cover data (#335)
Browse files Browse the repository at this point in the history
* feat(data): copernicus layer

* semver(data): v1.0.0

* doc(data): links to dataset

* doc(data): use Copernicus example

* doc(data): new layer

* doc(data): typo

* feat(data): copernicus lc forest type

* doc: link

Closes #327
  • Loading branch information
tpoisot authored Dec 6, 2024
1 parent 7612b97 commit aceb728
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 14 deletions.
2 changes: 1 addition & 1 deletion SimpleSDMDatasets/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SimpleSDMDatasets"
uuid = "2c7d61d0-5c73-410d-85b2-d2e7fbbdcefa"
authors = ["Timothée Poisot <[email protected]>"]
version = "0.2.3"
version = "1.0.0"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
5 changes: 4 additions & 1 deletion SimpleSDMDatasets/src/SimpleSDMDatasets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export MammalRichness, BirdRichness, AmphibianRichness

include("types/providers.jl")
export RasterProvider
export WorldClim2, EarthEnv, CHELSA1, CHELSA2, BiodiversityMapping, PaleoClim
export WorldClim2, EarthEnv, CHELSA1, CHELSA2, BiodiversityMapping, PaleoClim, Copernicus

include("types/futures.jl")
export FutureScenario, FutureModel
Expand Down Expand Up @@ -75,6 +75,9 @@ include("providers/BiodiversityMapping/biodiversitymapping.jl")

include("providers/PaleoClim/bioclim.jl")

include("providers/Copernicus/copernicus.jl")
include("providers/Copernicus/landcover.jl")

# Key checker
include("keychecker.jl")

Expand Down
15 changes: 15 additions & 0 deletions SimpleSDMDatasets/src/providers/Copernicus/copernicus.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
provides(::Type{Copernicus}, ::Type{LandCover}) = true

url(::Type{Copernicus}) = "https://land.copernicus.eu/en/products/global-dynamic-land-cover"
blurb(::Type{Copernicus}) = md"""
The Global Dynamic Land Cover product offers annual global land cover maps and
cover fraction layers, providing a detailed view of land cover at three
classification levels. It uses modern data analysis techniques to ensure
temporal consistency and accuracy, with the latest version achieving 80%
accuracy at class level 1 on each continent. The product also includes
continuous field layers, or "fraction maps", that provide proportional estimates
for vegetation and ground cover for the land cover types. These features make it
a versatile tool for a wide range of applications, including forest monitoring,
rangeland management, crop monitoring, biodiversity conservation, climate
modelling, and urban planning.
"""
67 changes: 67 additions & 0 deletions SimpleSDMDatasets/src/providers/Copernicus/landcover.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
url(::RasterData{Copernicus, LandCover}) = "https://zenodo.org/records/3939050"

blurb(::RasterData{Copernicus, LandCover}) = md"""
Near real time epoch 2019 from the Collection 3 of annual, global 100m land
cover maps.
Produced by the global component of the Copernicus Land Service, derived from
PROBA-V satellite observations and ancillary datasets.
:::details Citation
Marcel Buchhorn, Bruno Smets, Luc Bertels, Bert De Roo, Myroslava Lesiv,
Nandin-Erdene Tsendbazar, Martin Herold, & Steffen Fritz. (2020). Copernicus
Global Land Service: Land Cover 100m: collection 3: epoch 2019: Globe (V3.0.1)
[Data set]. Zenodo. https://doi.org/10.5281/zenodo.3939050
:::
"""

# Update the layers
layers(::RasterData{Copernicus, LandCover}) = [
"Bare",
"Built-up",
"Crops",
"Grass",
"Moss and lichen",
"Permanent water",
"Seasonal water",
"Shrubs",
"Snow",
"Trees",
"Classification",
"Forest type"
]

function __copernify(str)
varnames = Dict(
"Bare" => "Bare-CoverFraction-layer",
"Built-up" => "BuiltUp-CoverFraction-layer",
"Crops" => "Crops-CoverFraction-layer",
"Grass" => "Grass-CoverFraction-layer",
"Moss and Lichen" => "MossLichen-CoverFraction-layer",
"Permanent water" => "PermanentWater-CoverFraction-layer",
"Seasonal water" => "SeasonalWater-CoverFraction-layer",
"Shrubs" => "Shrub-CoverFraction-layer",
"Snow" => "Snow-CoverFraction-layer",
"Trees" => "Tree-CoverFraction-layer",
"Classification" => "Discrete-Classification-map",
"Forest type" => "Forest-Type-layer",
)

return varnames[str]
end

function source(
data::RasterData{Copernicus, LandCover};
layer = "Classification",
)
var_code = __copernify(layer)
dlurl = "https://zenodo.org/records/3939050/files/PROBAV_LC100_global_v3.0.1_2019-nrt_$(var_code)_EPSG-4326.tif?download=1"
return (
url = dlurl,
filename = lowercase("PROBAV_LC100_global_v3.0.1_2019-nrt_$(var_code)_EPSG-4326.tif"),
outdir = destination(data),
)
end
9 changes: 8 additions & 1 deletion SimpleSDMDatasets/src/types/providers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,11 @@ struct BiodiversityMapping <: RasterProvider end
Paleoclimate data from http://www.paleoclim.org/ - see this website for citation information
"""
struct PaleoClim <: RasterProvider end
struct PaleoClim <: RasterProvider end

"""
Copernicus
Produced by the global component of the Copernicus Land Service, derived from PROBA-V satellite observations and ancillary datasets -- see https://land.copernicus.eu/en/products/global-dynamic-land-cover
"""
struct Copernicus <: RasterProvider end
9 changes: 5 additions & 4 deletions docs/src/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ export default defineConfig({
{
text: 'Datasets',
items: [
{ text: "BiodiversityMapping", link: "/datasets/BiodiversityMapping" },
{ text: "CHELSA 1", link: "/datasets/CHELSA1" },
{ text: "CHELSA 2", link: "/datasets/CHELSA2" },
{ text: "WorldClim 2", link: "/datasets/WorldClim2" },
{ text: "PaleoClim", link: "/datasets/PaleoClim" },
{ text: "Copernicus", link: "/datasets/Copernicus" },
{ text: "EarthEnv", link: "/datasets/EarthEnv" },
{ text: "BiodiversityMapping", link: "/datasets/BiodiversityMapping" },
{ text: "PaleoClim", link: "/datasets/PaleoClim" },
{ text: "WorldClim 2", link: "/datasets/WorldClim2" },
]
},
{
Expand Down Expand Up @@ -96,7 +97,7 @@ export default defineConfig({
{text: "... list provided layers?", link: "/howto/list-provided-layers/"},
{text: "... do arithmetic on layers?", link: "/howto/layer-arithmetic/"},
{text: "... mask a layer?", link: "/howto/mask-layer/"},
{text: "... mask with polygons", link: "/howto/mask-polygons/"},
{text: "... mask with polygons?", link: "/howto/mask-polygons/"},
{text: "... read part of a layer?", link: "/howto/read-part-layer/"},
{text: "... get the bounding box for an object?", link: "/howto/get-boundingbox/"},
{text: "... calculate statistics on layers?", link: "/howto/layer-statistics/"},
Expand Down
9 changes: 5 additions & 4 deletions docs/src/howto/get-boundingbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CairoMakie.activate!(; type = "png", px_per_unit = 2) #hide
# The `boundingbox` method accepts most types that `SpeciesDistributionToolkit`
# knows about, and returns a tuple:

occ = occurrences("hasCoordinate" => true, "country" => "BR", "limit" => 300)
occ = occurrences("hasCoordinate" => true, "country" => "CH", "limit" => 300)
SpeciesDistributionToolkit.boundingbox(occ)

# We can also specify a padding (in degrees) that is added to the bounding box:
Expand All @@ -24,11 +24,12 @@ SpeciesDistributionToolkit.boundingbox(occ; padding = 1.0)
#
# :::

# This is useful to restrict the part of a layer that is loaded:
# This is useful to restrict the part of a layer that is loaded, here one of the
# fractional layers from the copernicus landcover dataset:

L = SDMLayer(
RasterData(CHELSA1, BioClim);
layer = 1,
RasterData(Copernicus, LandCover);
layer = "Crops",
SpeciesDistributionToolkit.boundingbox(occ; padding = 0.5)...,
)

Expand Down
2 changes: 1 addition & 1 deletion docs/src/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ distribution modeling and biodiversity research, for the
This package is now used in pipelines in [BON in a
Box](https://boninabox.geobon.org/index), [GEOBON](https://geobon.org/)'s
project to automate the calculation and representation of the post-2020 [GBF
indicators](https://www.cbd.int/gbf).
indicators](https://www.cbd.int/gbf). See the [BON in a Box tool page](https://boninabox.geobon.org/tool-detail?id=236).

:::

Expand Down
4 changes: 2 additions & 2 deletions docs/src/reference/datasets/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

<!-- Added, Changed, Deprecated, Removed, Fixed -->
## `v1.0.0`

## [Unreleased]
- **added** support for the [Copernicus Global Land Service](https://zenodo.org/records/3939050) landcover data

2 comments on commit aceb728

@tpoisot
Copy link
Member Author

@tpoisot tpoisot commented on aceb728 Dec 6, 2024

Choose a reason for hiding this comment

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

@JuliaRegistrator register() subdir=SimpleSDMDatasets

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/120832

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a SimpleSDMDatasets-v1.0.0 -m "<description of version>" aceb7289291f214f20560f5255a2cdb01a31721d
git push origin SimpleSDMDatasets-v1.0.0

Please sign in to comment.