From ad9183a0cfcf73b055b05fabe90dfeec29103fba Mon Sep 17 00:00:00 2001 From: Yang Date: Tue, 12 Sep 2023 15:38:47 +0200 Subject: [PATCH] dataset info land cover --- README.md | 1 + docs/available_datasets.md | 5 ++++ src/zampy/datasets/catalog.py | 2 ++ src/zampy/datasets/land_cover.py | 45 ++++++++++++++++++++++++++++++++ src/zampy/reference/variables.py | 2 ++ 5 files changed, 55 insertions(+) create mode 100644 src/zampy/datasets/land_cover.py diff --git a/README.md b/README.md index 7f9c930..f714470 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ To download the following datasets, users need access to CDS via cdsapi: - ERA5 - ERA5 land - LAI +- land cover First, you need to be a registered user on *CDS* via the [registration page](https://cds.climate.copernicus.eu/user/register?destination=%2F%23!%2Fhome). diff --git a/docs/available_datasets.md b/docs/available_datasets.md index 5b40124..bf47da7 100644 --- a/docs/available_datasets.md +++ b/docs/available_datasets.md @@ -39,3 +39,8 @@ You can add these yourself by creating a pull request, or open an issue to reque Note: model level is set to "60" and all steps are included for downloading. For more information, see [their webpage](https://ads.atmosphere.copernicus.eu/cdsapp#!/dataset/cams-global-ghg-reanalysis-egg4). + +=== "Land cover classification gridded maps" + - `land_cover` + + For more information, see [their webpage](https://cds.climate.copernicus.eu/cdsapp#!/dataset/satellite-land-cover). diff --git a/src/zampy/datasets/catalog.py b/src/zampy/datasets/catalog.py index 579835d..cf869c4 100644 --- a/src/zampy/datasets/catalog.py +++ b/src/zampy/datasets/catalog.py @@ -4,6 +4,7 @@ from zampy.datasets.era5 import ERA5 from zampy.datasets.era5 import ERA5Land from zampy.datasets.eth_canopy_height import EthCanopyHeight +from zampy.datasets.land_cover import LandCover from zampy.datasets.prism_dem import PrismDEM30 from zampy.datasets.prism_dem import PrismDEM90 @@ -17,4 +18,5 @@ "eth_canopy_height": EthCanopyHeight, "prism_dem_30": PrismDEM30, "prism_dem_90": PrismDEM90, + "land_cover": LandCover, } diff --git a/src/zampy/datasets/land_cover.py b/src/zampy/datasets/land_cover.py new file mode 100644 index 0000000..5a3c9b0 --- /dev/null +++ b/src/zampy/datasets/land_cover.py @@ -0,0 +1,45 @@ +"""Land cover classification dataset.""" + +import numpy as np +from zampy.datasets.dataset_protocol import SpatialBounds +from zampy.datasets.dataset_protocol import TimeBounds +from zampy.datasets.dataset_protocol import Variable +from zampy.reference.variables import VARIABLE_REFERENCE_LOOKUP +from zampy.reference.variables import unit_registry + + +## Ignore missing class/method docstrings: they are implemented in the Dataset class. +# ruff: noqa: D102 + + +class LandCover: # noqa: D101 + """Land cover classification gridded maps.""" + name = "land-cover" + time_bounds = TimeBounds(np.datetime64("1992-01-01"), np.datetime64("2020-12-31")) + spatial_bounds = SpatialBounds(90, 180, -90, -180) + crs = "EPSG:4326" + + raw_variables = [ + Variable(name="lccs_class", unit=unit_registry.dimensionless), + ] + variable_names = ["land_cover"] + variables = [VARIABLE_REFERENCE_LOOKUP[var] for var in variable_names] + + license = "ESA CCI licence; licence-to-use-copernicus-products; VITO licence" + + bib = """ + @article{buchhorn2020copernicus, + title={Copernicus global land cover layers—collection 2}, + author={Buchhorn, Marcel and Lesiv, Myroslava and Tsendbazar, Nandin-Erdene and Herold, Martin and Bertels, Luc and Smets, Bruno}, + journal={Remote Sensing}, + volume={12}, + number={6}, + pages={1044}, + year={2020}, + publisher={MDPI} + } + """ + + data_url = "https://cds.climate.copernicus.eu/cdsapp#!/dataset/satellite-land-cover?tab=overview" + + cds_dataset = "satellite-land-cover" diff --git a/src/zampy/reference/variables.py b/src/zampy/reference/variables.py index e84bb78..fd1fca6 100644 --- a/src/zampy/reference/variables.py +++ b/src/zampy/reference/variables.py @@ -17,6 +17,7 @@ def unit_registration() -> UnitRegistry: "kilogram_per_square_meter_second = kilogram/(meter**2*second)" ) unit_registry.define("milimeter_per_second = watt/meter**2") + unit_registry.define("dimensionless = []") return unit_registry @@ -53,6 +54,7 @@ def unit_registration() -> UnitRegistry: Variable("latitude", unit=unit_registry.degree_north), Variable("longitude", unit=unit_registry.degree_east), Variable("elevation", unit=unit_registry.meter), + Variable("land_cover", unit=unit_registry.dimensionless), ) VARIABLE_REFERENCE_LOOKUP = {var.name: var for var in VARIABLE_REFERENCE}