Skip to content

Commit

Permalink
added drought process ... demo
Browse files Browse the repository at this point in the history
  • Loading branch information
cehbrecht committed Oct 12, 2023
1 parent 7b2df53 commit 7522c38
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
2 changes: 2 additions & 0 deletions albatross/processes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from .wps_say_hello import SayHello
from .wps_drought import Drought

processes = [
SayHello(),
Drought(),
]
79 changes: 79 additions & 0 deletions albatross/processes/wps_drought.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
from pywps import Process, LiteralInput, LiteralOutput, UOM
from pywps.app.Common import Metadata

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


class Drought(Process):
"""A process to forecast precipitation."""
def __init__(self):
inputs = [
LiteralInput('pr', 'Monthly global precipitation file',
abstract='??? netcdf file',
# keywords=['name', 'firstname'],
data_type='string'),
LiteralInput('sst', 'Monthly global sea surface temperature file',
abstract='??? netcdf file',
# keywords=['name', 'firstname'],
data_type='string'),
LiteralInput('gph', 'Monthly global geopotential height file',
abstract='??? netcdf file',
# keywords=['name', 'firstname'],
data_type='string'),
LiteralInput('slp', 'Monthly global sea level pressure file',
abstract='??? netcdf file',
# keywords=['name', 'firstname'],
data_type='string'),
LiteralInput('indicator', 'Indicator ???',
abstract='examples: climate indicator of tele-connection patterns, ???',
# keywords=['name', 'firstname'],
data_type='string'),
LiteralInput('start_year', 'Start Year',
abstract='2020',
# keywords=['name', 'firstname'],
data_type='string'),
LiteralInput('end_year', 'End Year',
abstract='2022',
# keywords=['name', 'firstname'],
data_type='string'),
LiteralInput('bbox', 'Bounding Box',
abstract='bbox or other geometries',
# keywords=['name', 'firstname'],
data_type='string')
]
outputs = [
LiteralOutput('negative_list', 'Negative List ...',
#abstract='negativ list',
# keywords=['output', 'result', 'response'],
data_type='string'),
LiteralOutput('positive_list', 'Postive List ...',
#abstract='negativ list',
# keywords=['output', 'result', 'response'],
data_type='string'),
]

super(Drought, self).__init__(
self._handler,
identifier='drought',
title='A process to forecast precipitation.',
abstract='A process to forecast precipitation...',
# keywords=['hello', 'demo'],
metadata=[
Metadata('PyWPS', 'https://pywps.org/'),
Metadata('Birdhouse', 'http://bird-house.github.io/'),
Metadata('PyWPS Demo', 'https://pywps-demo.readthedocs.io/en/latest/'),
],
version='0.1',
inputs=inputs,
outputs=outputs,
store_supported=True,
status_supported=True
)

@staticmethod
def _handler(request, response):
LOGGER.info("processing")
response.outputs['negative_list'].data = 'PR ' + request.inputs['pr'][0].data
response.outputs['positive_list'].data = 'sst ' + request.inputs['sst'][0].data
return response

0 comments on commit 7522c38

Please sign in to comment.