Skip to content
Snippets Groups Projects
Commit 63005819 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Merge branch 'main' into release

parents 2010fd02 dfeb4b8e
Branches
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ config = configparser.ConfigParser()
config.read("PSILARTEMP.cfg")
year = os.getenv("YEAR")
recurring_start_date = os.getenv("RECURRING_START_DATE")
weatherdata_path = os.getenv("WEATHER_DATA_DIR")
tmp_path = "tmp/"
out_path = os.getenv("DATA_DIR")
......@@ -39,11 +40,17 @@ out_path = os.getenv("DATA_DIR")
# TODO: Put timezone out in .env
local_timezone = pytz.timezone("Europe/Oslo")
# If we are before the recurring start date, exit nicely
start_time = datetime.strptime(f"{year}-{recurring_start_date}","%Y-%m-%d")
if datetime.now() <= start_time:
print(f"Today is before the configured start time of {start_time}. Exiting.")
exit(0)
# """
# Calculate cumulated degree days above 5 degrees after 1st of April
# Remove all values before April 1st
subprocess.run(
f"cdo -selname,TM -seldate,{year}-04-01T00:00:00,{year}-12-31T00:00:00 {weatherdata_path}met_1_0km_nordic-{year}.nc {tmp_path}TM_from_april.nc",
f"cdo -selname,TM -seldate,{year}-{recurring_start_date}T00:00:00,{year}-12-31T00:00:00 {weatherdata_path}met_1_0km_nordic-{year}.nc {tmp_path}TM_from_april.nc",
shell=True,
)
# Subtracting 5 deg C from all cells
......
......@@ -2,6 +2,8 @@
# Year to run for
YEAR=2024
# Recurring start date (MM-DD)
RECURRING_START_DATE=04-01
# Where your application resides
HOME_DIR=/home/foo/
# Path to the weather data
......
......@@ -45,7 +45,7 @@ WEB
<p>
Kartet viser beregnet <a href=\"https://www.vips-landbruk.no/forecasts/models/PSILARTEMP/\" target=\"new\">svermetidspunkt
for gulrotflue 1. generasjon</a>. Varslene beregnes i rutenett a 1x1km med akkumulerte
<span itemprop=\"DD\">døgngrader</span> basert på reanalyserte data og værvarsler fra
<span itemprop=\"DD\">døgngrader</span> basert på reanalyserte data og værprognoser fra
Meteorologisk institutt. Varslene oppdateres en gang per døgn. Visning av varsler startes
1. april og skrus av 1. oktober. Modellen for svermetidspunkt for gulrotflue beregnes også
med data fra værstasjoner, hvor mer detaljerte beregninger kan hentes opp via visningen i kartet på VIPS-forsida.
......@@ -59,11 +59,11 @@ WEB
"wms_abstract.en" "
<p>The warning system model &laquo;Carrot rust fly temperature&raquo; is based on a Finnish temperature-based model (Markkula <em>et al</em>, 1998; Tiilikkala &amp; Ojanen, 1999; Markkula <em>et al</em>, 2000). The model determines the start of the flight period for the 1st and 2nd generation of carrot rust fly based on accumuleted degree-days (day-degrees) over a base temperature of 5,0 &deg;C. VIPS uses the model for the 1st generation only.</p>
<p>Standard air temperature (temperature measured 2 m above ground) is used in the model. <span itemprop=\"DD\">Degree-days</span> are defined for this model as the sum of the difference between a base temperature of 5,0 &deg;C and the mean temperature for all days with a temperature &gt;5,0 &deg;C, in other words (daily mean temperature &ndash; 5,0 &deg;C) from 1 March (beginning when the ground has thawed).</p>
<p>< href=\"https://www.vips-landbruk.no/forecasts/models/PSILARTEMP/\" target=\"new\">Complete model description</a></p>
<p><a href=\"https://www.vips-landbruk.no/forecasts/models/PSILARTEMP/\" target=\"new\">Complete model description</a></p>
"
"wms_enable_request" "*"
"wms_title.en" "Carrot rust fly (Psila rosae) temperature model"
"wms_title.nb" "Gulrotflue svermetidspunktmodell"
"wms_title.nb" "Gulrotflue svermetid 1. generasjon"
"wms_getfeatureinfo_formatlist" "text/plain,text/html,text/xml"
"wms_accessconstraints" "none"
"wms_addresstype" ""
......
......@@ -53,8 +53,8 @@ cd $APP_PATH
# Create and activate the virtual environment
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install --upgrade pip
pip install -r $REQUIREMENTS
python3 -m pip install -q --upgrade pip
pip install -q -r $REQUIREMENTS
# Run the model
echo "==== `date`: Running model" &>> "$LOG_FILE"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment