From 61f24ee9b299941f0490e2d0d0e06aa3c4a55fb6 Mon Sep 17 00:00:00 2001 From: Pingu Carsti Date: Thu, 12 Oct 2023 16:37:15 +0200 Subject: [PATCH] use intake to get era5 catalog --- environment.yml | 5 +++++ shearwater/processes/wps_cyclone.py | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index dd8d389..c8189f8 100644 --- a/environment.yml +++ b/environment.yml @@ -9,5 +9,10 @@ dependencies: - jinja2 - click - psutil +- intake +- intake-esm +- pydantic<2 +- requests +- aiohttp # tests - pytest diff --git a/shearwater/processes/wps_cyclone.py b/shearwater/processes/wps_cyclone.py index 59f6312..3a0e3f3 100644 --- a/shearwater/processes/wps_cyclone.py +++ b/shearwater/processes/wps_cyclone.py @@ -2,6 +2,8 @@ from pywps.app.Common import Metadata from datetime import datetime +import intake + import logging LOGGER = logging.getLogger("PYWPS") @@ -52,6 +54,26 @@ def __init__(self): @staticmethod def _handler(request, response): LOGGER.info("running cyclone ...") - response.outputs['output'].data = 'netcdf ' + request.inputs['model'][0].data + + master_catalog=intake.open_catalog(["https://gitlab.dkrz.de/data-infrastructure-services/intake-esm/-/raw/master/esm-collections/cloud-access/dkrz_catalog.yaml"]) + # master_catalog = intake.open_catalog('/pool/data/Catalogs/dkrz_catalog.yaml') + era5_catalog = master_catalog['dkrz_era5_disk'] + + query = { + 'era_id': 'ET', + 'level_type':'surface', + 'table_id': 128, + #'frequency':'hourly', + 'code':34, + 'dataType': 'an', + 'validation_date': '2023-06-27', + } + + my_catalog = era5_catalog.search(**query) + # my_catalog.df + + era_path = my_catalog.df['uri'].iloc[0] + + response.outputs['output'].data = f'netcdf {era_path}' response.outputs['output_csv'].data = 'csv ' + request.inputs['model'][0].data return response