diff --git a/albatross/atmos_ocean_data.py b/albatross/atmos_ocean_data.py index 7ec8728..353971c 100755 --- a/albatross/atmos_ocean_data.py +++ b/albatross/atmos_ocean_data.py @@ -12,12 +12,13 @@ LOGGER = logging.getLogger("PYWPS") + def openDAPsst(version = '3b', debug = False, anomalies = True, **kwargs): """ This function downloads data from the new ERSSTv3b on the IRI data library kwargs should contain: startyr, endyr, startmon, endmon, nbox """ - from utils import int_to_month + from albatross.utils import int_to_month from os.path import isfile from pydap.client import open_url from numpy import arange @@ -57,6 +58,8 @@ def openDAPsst(version = '3b', debug = False, anomalies = True, **kwargs): fp = fp + '_anoms' if anomalies else fp + '_ssts' + print( 'Path for temporary file: %s' % (fp)) + seasonal_var = namedtuple('seasonal_var', ('data','lat','lon')) #if isfile(fp): @@ -221,6 +224,8 @@ def load_clim_file(fp, debug = False): import numpy as np import pandas as pd + print('load_clim_file function with %s' % fp) + #First get the description and years f = open(fp) description = f.readline() diff --git a/albatross/processes/wps_drought.py b/albatross/processes/wps_drought.py index b746e70..bae82a7 100644 --- a/albatross/processes/wps_drought.py +++ b/albatross/processes/wps_drought.py @@ -122,22 +122,26 @@ def _handler(request, response): # sst= request.inputs['sst'][0].data - import shutil - import tempfile - import urllib.request - - with urllib.request.urlopen(request.inputs['indicator'][0].data) as response: - with tempfile.NamedTemporaryFile(delete=False) as tmp_indicator: - shutil.copyfileobj(response, tmp_indicator) - with open(tmp_indicator.name) as index_file: - pass - - with urllib.request.urlopen(request.inputs['pr'][0].data) as response: - with tempfile.NamedTemporaryFile(delete=False) as tmp_pr: - shutil.copyfileobj(response, tmp_pr) - with open(tmp_pr.name) as clim_file: - pass - + # import shutil + # import tempfile + # import urllib.request + + # with urllib.request.urlopen(request.inputs['indicator'][0].data) as response: + # with tempfile.NamedTemporaryFile(delete=False) as tmp_indicator: + # shutil.copyfileobj(response, tmp_indicator) + # with open(tmp_indicator.name) as index_file: + # pass + + # with urllib.request.urlopen(request.inputs['pr'][0].data) as response: + # with tempfile.NamedTemporaryFile(delete=False) as tmp_pr: + # shutil.copyfileobj(response, tmp_pr) + # with open(tmp_pr.name) as clim_file: + # pass + import os + os.getcwd() + + index_file = os.getcwd() + '/DATA/nao.txt' + clim_file = os.getcwd() + '/DATA/APGD_prcpComo.txt' filename = 'testComoNAO' # #### USER INPUT ####