From af8c7f11d940929fc173be1d0325807f4f914d87 Mon Sep 17 00:00:00 2001 From: MarcusStrobl Date: Wed, 3 Apr 2024 16:00:33 +0200 Subject: [PATCH] create input directory --- processes/tool_vforwater_loader.py | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/processes/tool_vforwater_loader.py b/processes/tool_vforwater_loader.py index f85dd66..23c47ed 100644 --- a/processes/tool_vforwater_loader.py +++ b/processes/tool_vforwater_loader.py @@ -181,20 +181,12 @@ def execute(self, data): # logging.info(f"Available images are: {images}") # collect inputs - # try: # TODO: improve check of inputs timeseries_ids = data.get('timeseries_ids', []) # path/name to numpy.ndarray raster_ids = data.get('raster_ids', []) # path/name to numpy.ndarray start_date = data.get('start_date', '') # path/name to numpy.ndarray end_date = data.get('end_date', '') # integer reference_area = data.get('reference_area', []) - # except Exception as e: - # logging.debug(f"Problem with data.get(): {e}") - # logging.debug(f"timeseries_ids worked: {timeseries_ids}") - # logging.debug(f"raster_ids worked: {raster_ids}") - # logging.debug(f"start_date worked: {start_date}") - # logging.debug(f"end_date worked: {end_date}") - # logging.debug(f"reference_area worked: {reference_area} => data.get() seems to work!") user = data.get('user', "NO_USER") @@ -209,18 +201,7 @@ def execute(self, data): if len(dataset_ids) == 0: logging.info('The input data is not complete.') # raise ProcessorExecuteError('Cannot process without required datasets') - return json.dumps( - {'warning': 'Running this tool makes no sense without a timeseries or areal dataset.'}) - # if len(timeseries_ids) > 0 and len(raster_ids) > 0: - # dataset_ids = timeseries_ids.extend(raster_ids) - # elif len(raster_ids) > 0: - # dataset_ids = raster_ids - # elif len(timeseries_ids) > 0: - # dataset_ids = timeseries_ids - # else: - # logging.info('The input data is not complete.') - # # raise ProcessorExecuteError('Cannot process without required datasets') - # return json.dumps({'warning': 'Running this tool makes no sense without a timeseries or areal dataset.'}) + return json.dumps({'warning': 'Running this tool makes no sense without timeseries or areal dataset.'}) except Exception as e: logging.debug(f"Problem while concatenate data: {e}") @@ -253,6 +234,10 @@ def execute(self, data): host_path_in = f'/home/geoapi/in/{user}/{path}' # was in_dir host_path_out = f'/home/geoapi/out/{user}/{path}' # was out_dir + if not os.path.exists(host_path_in): + os.makedirs(host_path_in) + logging.debug(f'Created input directory at: {host_path_in}') + if not os.path.exists(host_path_out): os.makedirs(host_path_out) logging.debug(f'Created output directory at: {host_path_out}')