Skip to content
Snippets Groups Projects
Commit 32454b09 authored by Bianca Wentzel's avatar Bianca Wentzel
Browse files

Changed time period to start and end date

parent 41654f4d
No related branches found
No related tags found
2 merge requests!3Generalization,!2Plugin template
Pipeline #92151 canceled
......@@ -26,7 +26,8 @@ from evaluation_system.api.parameters import (
File,
SolrField,
String,
Bool
Bool,
Date
)
import freva
......@@ -130,10 +131,15 @@ class PET(plugin.PluginAbstract):
mandatory=True,
help="Select a file containing surface altitude data"
),
String(
name="time_period",
Date(
name="start_date",
mandatory=True,
help="Insert start date you want to select (YYYY-MM-DD)"
),
Date(
name="end_date",
mandatory=True,
help="Insert the time period you want to select (dates separated by a comma in format: YYYY-MM-DD,YYYY-MM-DD).\nLeave empty to use all available time steps."
help="Insert end date you want to select (YYYY-MM-DD)"
),
String(
name="region",
......@@ -175,10 +181,7 @@ class PET(plugin.PluginAbstract):
search_args = {key: config_dict[key] for key in search_keys}
search_args["time_frequency"] = 'day'
if config_dict["time_period"]:
start_date, end_date = config_dict["time_period"].split(",")
search_args["time"] = start_date + " to " + end_date
search_args["time"] = config_dict["start_date"] + " to " + config_dict["end_date"]
file_dict = {}
for variable in variables:
......
......@@ -39,10 +39,9 @@ REALM=$(jq '.realm' $1 | sed 's/\"//g')
ENSEMBLE=$(jq '.ensemble' $1 | sed 's/\"//g')
### ANALYSIS VALUES
TIME_PERIOD=$(jq '.time_period' $1 | sed 's/\"//g') # time period
# todoo: test if time-period matches needed format
START_DATE=$(echo ${TIME_PERIOD} | cut -d',' -f 1 ) # start date
END_DATE=$(echo ${TIME_PERIOD} | cut -d',' -f 2) # end date
START_DATE=$(jq '.start_date' $1 | sed 's/\"//g') # start date
END_DATE=$(jq '.end_date' $1 | sed 's/\"//g') # end date
START_YEAR=$(cut -c 1-4 <<< ${START_DATE}) # start year
END_YEAR=$(cut -c 1-4 <<< ${END_DATE}) # end year
REGION=$(jq '.region' $1 | sed 's/\"//g') # region (W,E,S,N)
......@@ -87,7 +86,8 @@ echo ''
echo 'Experiment Parameters'
echo '---------------------'
echo 'TIME_PERIOD: '${TIME_PERIOD}
echo 'STAR DATE: '${START_DATE}
echo 'END DATE: '${END_DATE}
echo 'REGION: '${REGION}
echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
echo ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment