Skip to content

Commit

Permalink
use intake to get era5 catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
cehbrecht committed Oct 12, 2023
1 parent 73a9c1a commit 61f24ee
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
5 changes: 5 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@ dependencies:
- jinja2
- click
- psutil
- intake
- intake-esm
- pydantic<2
- requests
- aiohttp
# tests
- pytest
24 changes: 23 additions & 1 deletion shearwater/processes/wps_cyclone.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from pywps.app.Common import Metadata
from datetime import datetime

import intake

import logging
LOGGER = logging.getLogger("PYWPS")

Expand Down Expand Up @@ -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

0 comments on commit 61f24ee

Please sign in to comment.