From b625c0c1d0f3f306c3f04a2abb0c2727226f048e Mon Sep 17 00:00:00 2001 From: Nils Hempelmann Date: Tue, 18 Jun 2024 17:27:09 +0200 Subject: [PATCH] drought process is starting --- .eggs/README.txt | 6 ++++ albatross/climdiv_data.py | 2 +- albatross/processes/wps_drought.py | 54 +++++++++++++++++------------- environment.yml | 2 ++ 4 files changed, 40 insertions(+), 24 deletions(-) create mode 100644 .eggs/README.txt diff --git a/.eggs/README.txt b/.eggs/README.txt new file mode 100644 index 0000000..5d01668 --- /dev/null +++ b/.eggs/README.txt @@ -0,0 +1,6 @@ +This directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins. + +This directory caches those eggs to prevent repeated downloads. + +However, it is safe to delete this directory. + diff --git a/albatross/climdiv_data.py b/albatross/climdiv_data.py index 861eb51..cf8f84a 100755 --- a/albatross/climdiv_data.py +++ b/albatross/climdiv_data.py @@ -4,7 +4,7 @@ """ import os -from atmos_ocean_data import * +from albatross.atmos_ocean_data import * from os import environ as EV def get_data(kwgroups): diff --git a/albatross/processes/wps_drought.py b/albatross/processes/wps_drought.py index 0d497af..2c64fbe 100644 --- a/albatross/processes/wps_drought.py +++ b/albatross/processes/wps_drought.py @@ -1,9 +1,31 @@ -from pywps import Process, LiteralInput, LiteralOutput +from pywps import Process, LiteralInput, LiteralOutput, ComplexOutput +from pywps import FORMATS, Format from pywps.app.Common import Metadata +# general +import pandas as pd +from matplotlib import cm, pyplot as plt +import matplotlib as mpl +import numpy as np +import pydap.client +import mpl_toolkits +import csv +import math + +# drought specific functions +from albatross.climdiv_data import * +from albatross.simpleNIPA import * +import albatross.atmos_ocean_data +# from albatross.atmos_ocean_data import * +from albatross.utils import sstMap +from albatross.utils import * + + import logging LOGGER = logging.getLogger("PYWPS") +FORMAT_PNG = Format("image/png", extension=".png", encoding="base64") + class Drought(Process): """A process to forecast precipitation.""" @@ -14,10 +36,10 @@ def __init__(self): # keywords=['name', 'firstname'], default = 'https://raw.githubusercontent.com/mxgiuliani00/CSI/master/NIPA/DATA/APGD_prcpComo.txt', data_type='string'), - LiteralInput('sst', 'Monthly global sea surface temperature file', - abstract='??? netcdf file', - # keywords=['name', 'firstname'], - data_type='string'), + # LiteralInput('sst', 'Monthly global sea surface temperature file', + # abstract='text file of Sea surface temperature', + # # keywords=['name', 'firstname'], + # data_type='string'), # LiteralInput('gph', 'Monthly global geopotential height file', # abstract='??? netcdf file', # # keywords=['name', 'firstname'], @@ -34,15 +56,18 @@ def __init__(self): LiteralInput('start_year', 'Start Year', abstract='2020', # keywords=['name', 'firstname'], + default = '2020', data_type='string'), LiteralInput('end_year', 'End Year', abstract='2022', + default = '2022', # keywords=['name', 'firstname'], data_type='string'), LiteralInput('bbox', 'Bounding Box', abstract='bbox or other geometries', # keywords=['name', 'firstname'], - data_type='string') + data_type='string', + default = '20,30,40,50',) ] outputs = [ # LiteralOutput('negative_list', 'Negative List ...', @@ -91,23 +116,6 @@ def _handler(request, response): ### original code https://github.com/mxgiuliani00/CSI/blob/master/NIPA/run_nipa.py LOGGER.info("start processing") - # general - import pandas as pd - from matplotlib import cm, pyplot as plt - import matplotlib as mpl - import numpy as np - import pydap.client - import mpl_toolkits - import csv - import math - - # drought specific functions - from climdiv_data import * - from simpleNIPA import * - from atmos_ocean_data import * - from utils import sstMap - from utils import * - ########################### LOGGER.info("Select the input-output files") diff --git a/environment.yml b/environment.yml index e5e9520..3fbca91 100644 --- a/environment.yml +++ b/environment.yml @@ -9,5 +9,7 @@ dependencies: - jinja2 - click - psutil +- pandas +- matplotlib # tests - pytest