1+ #! /bin/bash
2+ # filepath: scripts/update_weather.sh
3+
4+ # SBATCH --partition=ceab
5+ # SBATCH --cpus-per-task=1
6+ # SBATCH --mem=8G
7+ # SBATCH --time=06:00:00
8+ # SBATCH --mail-type=BEGIN,END,FAIL
9+ 10+ # SBATCH --job-name=update_weather
11+
12+ # Load required modules
13+ module load GDAL/3.10.0-foss-2024a
14+ module load R/4.4.2-gfbf-2024a
15+
16+ # Change to project directory
17+ cd /home/j.palmer/research/weather-data-collector-spain
18+
19+ cat " === Collecting Three Datasets ==="
20+ cat " Starting: $( date) "
21+
22+ # Dataset 1: Historical daily stations (original AEMET names)
23+ echo " Dataset 1: Historical daily stations..."
24+ srun Rscript scripts/r/get_historical_data.R
25+ if [ $? -eq 0 ]; then
26+ echo " ✅ Historical collection completed"
27+ else
28+ echo " ❌ Historical collection failed"
29+ fi
30+
31+ # Dataset 2: Current daily stations (gap between historical and present)
32+ echo " Dataset 2: Current daily stations..."
33+ srun Rscript scripts/r/aggregate_current_daily_stations.R
34+ if [ $? -eq 0 ]; then
35+ echo " ✅ Current daily collection completed"
36+ else
37+ echo " ❌ Current daily collection failed"
38+ fi
39+
40+ # Dataset 3: Hourly station ongoing
41+ echo " Dataset 3: Hourly station ongoing..."
42+ srun Rscript scripts/r/get_latest_data.R
43+ if [ $? -eq 0 ]; then
44+ echo " ✅ Hourly collection completed"
45+ else
46+ echo " ❌ Hourly collection failed"
47+ fi
48+
49+ # Dataset 4: Municipal forecasts
50+ echo " Dataset 4: Municipal forecasts..."
51+ srun Rscript scripts/r/get_forecast_data_hybrid.R
52+ if [ $? -eq 0 ]; then
53+ echo " ✅ Forecast collection completed"
54+ else
55+ echo " ❌ Forecast collection failed"
56+ fi
57+
58+ echo " === Collection Summary ==="
59+ echo " Completed: $( date) "
60+ ls -la data/output/* .csv.gz
0 commit comments