From aceb7289291f214f20560f5255a2cdb01a31721d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poisot?= Date: Fri, 6 Dec 2024 09:51:50 -0500 Subject: [PATCH] Copernicus land cover data (#335) * 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 --- SimpleSDMDatasets/Project.toml | 2 +- SimpleSDMDatasets/src/SimpleSDMDatasets.jl | 5 +- .../src/providers/Copernicus/copernicus.jl | 15 +++++ .../src/providers/Copernicus/landcover.jl | 67 +++++++++++++++++++ SimpleSDMDatasets/src/types/providers.jl | 9 ++- docs/src/.vitepress/config.mts | 9 +-- docs/src/howto/get-boundingbox.jl | 9 +-- docs/src/manual.md | 2 +- docs/src/reference/datasets/CHANGELOG.md | 4 +- 9 files changed, 108 insertions(+), 14 deletions(-) create mode 100644 SimpleSDMDatasets/src/providers/Copernicus/copernicus.jl create mode 100644 SimpleSDMDatasets/src/providers/Copernicus/landcover.jl diff --git a/SimpleSDMDatasets/Project.toml b/SimpleSDMDatasets/Project.toml index 9eac08259..c95c57854 100644 --- a/SimpleSDMDatasets/Project.toml +++ b/SimpleSDMDatasets/Project.toml @@ -1,7 +1,7 @@ name = "SimpleSDMDatasets" uuid = "2c7d61d0-5c73-410d-85b2-d2e7fbbdcefa" authors = ["Timothée Poisot "] -version = "0.2.3" +version = "1.0.0" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/SimpleSDMDatasets/src/SimpleSDMDatasets.jl b/SimpleSDMDatasets/src/SimpleSDMDatasets.jl index d50d388f3..8d4b89f76 100644 --- a/SimpleSDMDatasets/src/SimpleSDMDatasets.jl +++ b/SimpleSDMDatasets/src/SimpleSDMDatasets.jl @@ -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 @@ -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") diff --git a/SimpleSDMDatasets/src/providers/Copernicus/copernicus.jl b/SimpleSDMDatasets/src/providers/Copernicus/copernicus.jl new file mode 100644 index 000000000..307fd1f64 --- /dev/null +++ b/SimpleSDMDatasets/src/providers/Copernicus/copernicus.jl @@ -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. +""" \ No newline at end of file diff --git a/SimpleSDMDatasets/src/providers/Copernicus/landcover.jl b/SimpleSDMDatasets/src/providers/Copernicus/landcover.jl new file mode 100644 index 000000000..d46999764 --- /dev/null +++ b/SimpleSDMDatasets/src/providers/Copernicus/landcover.jl @@ -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 \ No newline at end of file diff --git a/SimpleSDMDatasets/src/types/providers.jl b/SimpleSDMDatasets/src/types/providers.jl index 8b3f368fe..8ebcb9e97 100644 --- a/SimpleSDMDatasets/src/types/providers.jl +++ b/SimpleSDMDatasets/src/types/providers.jl @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/docs/src/.vitepress/config.mts b/docs/src/.vitepress/config.mts index 18b0d66ac..c4d1b7d0c 100644 --- a/docs/src/.vitepress/config.mts +++ b/docs/src/.vitepress/config.mts @@ -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" }, ] }, { @@ -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/"}, diff --git a/docs/src/howto/get-boundingbox.jl b/docs/src/howto/get-boundingbox.jl index 26cbdd943..0f8055b68 100644 --- a/docs/src/howto/get-boundingbox.jl +++ b/docs/src/howto/get-boundingbox.jl @@ -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: @@ -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)..., ) diff --git a/docs/src/manual.md b/docs/src/manual.md index 40ffd91ed..014181677 100644 --- a/docs/src/manual.md +++ b/docs/src/manual.md @@ -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). ::: diff --git a/docs/src/reference/datasets/CHANGELOG.md b/docs/src/reference/datasets/CHANGELOG.md index ac4038582..143e1cd44 100644 --- a/docs/src/reference/datasets/CHANGELOG.md +++ b/docs/src/reference/datasets/CHANGELOG.md @@ -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). - +## `v1.0.0` -## [Unreleased] +- **added** support for the [Copernicus Global Land Service](https://zenodo.org/records/3939050) landcover data