From 79b2c5edec379809f8fb3c9c268e7dc02cdff899 Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Tue, 23 Apr 2024 09:18:08 +0200 Subject: [PATCH 1/2] Improved payload conversion --- hda/utils.py | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/hda/utils.py b/hda/utils.py index e247f6b..538f208 100644 --- a/hda/utils.py +++ b/hda/utils.py @@ -2,6 +2,41 @@ logger = logging.getLogger(__name__) +DATASET_MAPPING = { + "EO:CLMS:DAT:CGLS_DAILY10_LST_DC_GLOBAL_V1": "EO:CLMS:DAT:CLMS_GLOBAL_LST_5KM_V1_10DAILY-DAILY-CYCLE_NETCDF", + "EO:CLMS:DAT:CGLS_DAILY10_LST_DC_GLOBAL_V2": "EO:CLMS:DAT:CLMS_GLOBAL_LST_5KM_V2_10DAILY-DAILY-CYCLE_NETCDF", + "EO:CLMS:DAT:CGLS_DAILY10_LST_TCI_GLOBAL_V1": "EO:CLMS:DAT:CLMS_GLOBAL_LST_5KM_V1_10DAILY-TCI_NETCDF", + "EO:CLMS:DAT:CGLS_DAILY10_LST_TCI_GLOBAL_V2": "EO:CLMS:DAT:CLMS_GLOBAL_LST_5KM_V2_10DAILY-TCI_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_ALBH_V1_1KM": "EO:CLMS:DAT:CLMS_GLOBAL_ALBH_1KM_V1_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_ALDH_V1_1KM": "EO:CLMS:DAT:CLMS_GLOBAL_ALDH_1KM_V1_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_DMP300_V1_333M": "EO:CLMS:DAT:CLMS_GLOBAL_DMP_300M_V1_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_DMP_V2_1KM": "EO:CLMS:DAT:CLMS_GLOBAL_DMP_1KM_V2_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_FAPAR300_V1_333M": "EO:CLMS:DAT:CLMS_GLOBAL_FAPAR_300M_V1_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_FAPAR_V1_1KM": "EO:CLMS:DAT:CLMS_GLOBAL_FAPAR_1KM_V1_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_FAPAR_V2_1KM": "EO:CLMS:DAT:CLMS_GLOBAL_FAPAR_1KM_V2_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_FCOVER300_V1_333M": "EO:CLMS:DAT:CLMS_GLOBAL_FCOVER_300M_V1_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_FCOVER_V1_1KM": "EO:CLMS:DAT:CLMS_GLOBAL_FCOVER_1KM_V1_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_FCOVER_V2_1KM": "EO:CLMS:DAT:CLMS_GLOBAL_FCOVER_1KM_V2_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_GDMP300_V1_333M": "EO:CLMS:DAT:CLMS_GLOBAL_GDMP_300M_V1_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_GDMP_V2_1KM": "EO:CLMS:DAT:CLMS_GLOBAL_GDMP_1KM_V2_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_LAI300_V1_333M": "EO:CLMS:DAT:CLMS_GLOBAL_LAI_300M_V1_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_LAI_V1_1KM": "EO:CLMS:DAT:CLMS_GLOBAL_LAI_1KM_V1_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_LAI_V2_1KM": "EO:CLMS:DAT:CLMS_GLOBAL_LAI_1KM_V2_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_NDVI300_V1_333M": "EO:CLMS:DAT:CLMS_GLOBAL_NDVI_300M_V1_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_NDVI300_V2_333M": "EO:CLMS:DAT:CLMS_GLOBAL_NDVI_300M_V2_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_NDVI_V2_1KM": "EO:CLMS:DAT:CLMS_GLOBAL_NDVI_1KM_V2_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_NDVI_V3_1KM": "EO:CLMS:DAT:CLMS_GLOBAL_NDVI_1KM_V3_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_GLOBAL_SWI10_V3_0.1DEGREE": "EO:CLMS:DAT:CLMS_GLOBAL_SWI_12.5KM_V3_10DAILY_NETCDF", + "EO:CLMS:DAT:CGLS_HOURLY_LST_GLOBAL_V1": "EO:CLMS:DAT:CLMS_GLOBAL_LST_5KM_V1_HOURLY_NETCDF", + "EO:CLMS:DAT:CGLS_HOURLY_LST_GLOBAL_V2": "EO:CLMS:DAT:CLMS_GLOBAL_LST_5KM_V2_HOURLY_NETCDF", + "EO:EEA:DAT:VEGETATION_DAILY_SWI_12.5KM_GLOBAL_V3": "EO:CLMS:DAT:CLMS_GLOBAL_SWI_12.5KM_V3_DAILY_NETCDF", + "EO:EEA:DAT:VEGETATION:DAILY_SWI_1KM_EUROPE_V1": "EO:CLMS:DAT:CLMS_GLOBAL_SWI_1KM_V1_DAILY_NETCDF", + "EO:EEA:DAT:ENERGY_TOCR_1KM_GLOBAL_V1": "EO:CLMS:DAT:CLMS_GLOBAL_TOCR_1KM_V1_10DAILY_NETCDF", + "EO:EEA:DAT:VEGETATION:DAILY_SWI_12.5KM_GLOBAL_V3": "EO:CLMS:DAT:CLMS_GLOBAL_SSM_1KM_V1_DAILY_NETCDF", + "EO:ESA:DAT:SENTINEL-1:SAR": "EO:ESA:DAT:SENTINEL-1", + "EO:ESA:DAT:SENTINEL-2:MSI": "EO:ESA:DAT:SENTINEL-2", +} + def convert(query): """Converts a query in HDA v1 format into an HDA v2 one. @@ -19,6 +54,7 @@ def convert(query): ) # Modify the JSON query according to the new structure + dataset_id = DATASET_MAPPING.get(dataset_id, dataset_id) new_query = {"dataset_id": dataset_id} # Check if the original JSON has the "dateRangeSelectValues" field @@ -32,7 +68,7 @@ def convert(query): if dataset_id.startswith("EO:ECMWF:DAT:CAMS_"): new_query["dtstart"] = start new_query["dtend"] = end - elif dataset_id.startswith("EO:CLMS:DAT:CGLS"): + elif dataset_id.startswith("EO:CLMS:DAT:"): new_query["start"] = start new_query["end"] = end elif dataset_id.startswith("EO:MO:DAT:"): From 183e2603eb8feb8cdacc05eac0ee8bc4912ea160 Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Tue, 23 Apr 2024 09:20:29 +0200 Subject: [PATCH 2/2] Version 2.14 --- docs/source/conf.py | 4 ++-- hda/api.py | 5 +---- setup.py | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 7782a74..2f7b681 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -15,8 +15,8 @@ copyright = "2023, ECMWF" author = "ECMWF" -release = "2.13" -version = "2.13" +release = "2.14" +version = "2.14" # -- General configuration diff --git a/hda/api.py b/hda/api.py index 5567d37..7c71233 100644 --- a/hda/api.py +++ b/hda/api.py @@ -320,10 +320,7 @@ def __init__( verify=True, path=None, ): - credentials = { - "user": None, - "password": None - } + credentials = {"user": None, "password": None} dotrc = path or os.environ.get("HDA_RC", os.path.expanduser("~/.hdarc")) diff --git a/setup.py b/setup.py index 23b2be6..89b323e 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def read(fname): return io.open(file_path, encoding="utf-8").read() -version = "2.13" +version = "2.14" setuptools.setup( name="hda",