Skip to content
Snippets Groups Projects
Commit 48449958 authored by Lene Wasskog's avatar Lene Wasskog
Browse files

feat: Include year as env variable, update year references in script

parent ed3d2910
Branches
No related tags found
1 merge request!1Include year in .env, update references in script
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
...@@ -31,6 +31,7 @@ load_dotenv() ...@@ -31,6 +31,7 @@ load_dotenv()
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read("PSILARTEMP.cfg") config.read("PSILARTEMP.cfg")
year = os.getenv("YEAR")
weatherdata_path = os.getenv("WEATHER_DATA_DIR") weatherdata_path = os.getenv("WEATHER_DATA_DIR")
tmp_path = "tmp/" tmp_path = "tmp/"
out_path = os.getenv("DATA_DIR") out_path = os.getenv("DATA_DIR")
...@@ -42,7 +43,7 @@ local_timezone = pytz.timezone("Europe/Oslo") ...@@ -42,7 +43,7 @@ local_timezone = pytz.timezone("Europe/Oslo")
# Calculate cumulated degree days above 5 degrees after 1st of April # Calculate cumulated degree days above 5 degrees after 1st of April
# Remove all values before April 1st # Remove all values before April 1st
subprocess.run( subprocess.run(
f"cdo -selname,TM -seldate,2023-04-01T00:00:00,2023-12-31T00:00:00 {weatherdata_path}met_1_0km_nordic-2023.nc {tmp_path}TM_from_april.nc", 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",
shell=True, shell=True,
) )
# Subtracting 5 deg C from all cells # Subtracting 5 deg C from all cells
......
# Use this as an example to create your own .env file # Use this as an example to create your own .env file
# Year to run for
YEAR=2024
# Where your application resides # Where your application resides
HOME_DIR=/home/foo/ HOME_DIR=/home/foo/
# Path to the weather data # Path to the weather data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment