Skip to content

Commit 8a5b6db

Browse files
committed
Create output directory for data files in multiple scripts, fix other slurm issues
1 parent 53eca56 commit 8a5b6db

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

code/get_forecast_data.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ if(length(all_forecasts) > 0) {
179179
cat("Sample data:\n")
180180
print(head(final_data, 3))
181181

182+
# Ensure output directory exists
183+
dir.create("data/output", recursive = TRUE, showWarnings = FALSE)
184+
182185
# Save the data
183186
output_file = paste0("data/output/municipal_forecasts_", Sys.Date(), ".csv")
184187
write.csv(final_data, output_file, row.names = FALSE)

priority_municipal_data.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
# filepath: /Users/palmer/research/weather-data-collector-spain/priority_municipal_data.sh
32
#SBATCH --job-name=municipal-priority
43
#SBATCH --partition=ceab
54
#SBATCH --nodes=1
@@ -10,9 +9,7 @@
109
#SBATCH --mail-type=BEGIN,END,FAIL
1110
1211
#SBATCH --output=logs/municipal_priority_%j.out
13-
#SBATCH --error=logs/municipal_priority_%j.err filepath: /Users/palmer/research/weather-data-collector-spain/priority_municipal_data.sh
14-
#SBATCH --job-name=municipal-priority
15-
#SBATCH --partition=standard
12+
#SBATCH --error=logs/municipal_priority_%j.err
1613
#SBATCH --nodes=1
1714
#SBATCH --ntasks=1
1815
#SBATCH --cpus-per-task=1
@@ -48,6 +45,9 @@ cd ~/research/weather-data-collector-spain
4845
# Create logs directory
4946
mkdir -p logs
5047

48+
# Create output directory
49+
mkdir -p data/output
50+
5151
# Activate renv
5252
R --slave --no-restore --file=- <<EOF
5353
renv::activate()

priority_municipal_forecast.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
# filepath: /Users/palmer/research/weather-data-collector-spain/priority_municipal_forecast.sh
32
#SBATCH --job-name=municipal-forecast-priority
43
#SBATCH --partition=ceab
54
#SBATCH --nodes=1
@@ -37,6 +36,9 @@ cd ~/research/weather-data-collector-spain
3736
# Create logs directory
3837
mkdir -p logs
3938

39+
# Create output directory
40+
mkdir -p data/output
41+
4042
# Initialize status reporting
4143
JOB_NAME="municipal-forecast-priority"
4244
STATUS_SCRIPT="./scripts/update_weather_status.sh"

update_historical_weather.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
# filepath: /Users/palmer/research/weather-data-collector-spain/update_historical_weather.sh
32
#SBATCH --job-name=historical-weather
43
#SBATCH --partition=ceab
54
#SBATCH --nodes=1
@@ -37,6 +36,9 @@ cd ~/research/weather-data-collector-spain
3736
# Create logs directory
3837
mkdir -p logs
3938

39+
# Create output directory
40+
mkdir -p data/output
41+
4042
# Activate renv
4143
R --slave --no-restore --file=- <<EOF
4244
renv::activate()

update_weather.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
# filepath: /Users/palmer/research/weather-data-collector-spain/update_weather.sh
32
#SBATCH --job-name=weather-collect
43
#SBATCH --partition=ceab
54
#SBATCH --nodes=1
@@ -38,6 +37,9 @@ cd ~/research/weather-data-collector-spain
3837
# Create logs directory if it doesn't exist
3938
mkdir -p logs
4039

40+
# Create output directory if it doesn't exist
41+
mkdir -p data/output
42+
4143
# Initialize status reporting
4244
JOB_NAME="weather-data-collector"
4345
STATUS_SCRIPT="./scripts/update_weather_status.sh"

0 commit comments

Comments
 (0)