Update climate zones tutorial for new GWS - #28
Update climate zones tutorial for new GWS#28Stephen Haddad (stevehadd) wants to merge 12 commits into
Conversation
…his branch. changes will be added in a separate PR.
There was a problem hiding this comment.
Pull request overview
Updates the climate zones tutorial materials for the new JASMIN GWS environment, including new data paths and an example of running the PyTorch training workflow via Slurm batch jobs.
Changes:
- Updated JASMIN data root in the tutorial config and refreshed notebook outputs/metadata after re-running.
- Refactored the scikit-learn training pipeline into a CLI-friendly, modular Python script.
- Added a PyTorch training script plus Slurm
sbatchhelper scripts to run training on the GPU partition.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| util/submit_train_climate_zones.sh | Adds a local wrapper to submit the climate-zones torch training job via sbatch and route logs to a user directory. |
| util/run_train_climate_zones.sh | Adds the Slurm batch script that activates an environment and runs the PyTorch training entrypoint. |
| src/ai4c_hack/ClimateZones_TrainingPipeline.py | Refactors the training pipeline into a structured CLI module with clear stages (load/split/train/eval). |
| src/ai4c_hack/ClimateZones_Training_Torch.py | Introduces a standalone PyTorch tabular training script with saving of model + metrics. |
| notebooks/config.json | Updates the configured JASMIN default data directory to the new GWS location. |
| notebooks/ClimateZones_TrainingPipeline.ipynb | Refreshes notebook outputs to reflect the new paths and re-executed cells. |
| notebooks/ClimateZones_Training_Torch.ipynb | Updates notebook metadata (kernel/python version) after re-run. |
| notebooks/ClimateZones_DataPrep.ipynb | Updates notebook metadata (kernel/python version) after re-run. |
| notebooks/ClimateZones_DataExploration.ipynb | Refreshes path outputs and execution counts for the new data location. |
Suppressed comments (1)
util/run_train_climate_zones.sh:18
- Typo in comment: "doe" → "does".
# uncomment if the mlflow directory doe not exist
# mkdir -p ${MLFLOW_DIR}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 11 changed files in this pull request and generated no new comments.
Suppressed comments (5)
util/submit_train_climate_zones.sh:24
- The log path messages and the
sbatchinvocation look incorrect: the second line printsstdoutagain (should bestderr), paths are unquoted, and Slurm’s--exportoption should be passed with=(and usually includeALL) soUSER_DIRis actually available inside the job.
echo "writing logs to:"
echo "stdout ${STD_OUT_PATH}"
echo "stderr ${STD_ERR_PATH}"
sbatch -o "${STD_OUT_PATH}" -e "${STD_ERR_PATH}" --export=ALL,USER_DIR util/run_train_climate_zones.sh
util/run_train_climate_zones.sh:9
- The Slurm job name (
era5_ae_train_ai4c) doesn’t match what this script runs (climate zones PyTorch training). This will makesqueue/log searching confusing when multiple jobs are running.
#SBATCH --job-name=climatezones_train_torch
util/submit_train_climate_zones.sh:15
- This script hard-codes the repo location (
~/prog/ai4c_hackathon/). That makes the helper unusable for users who clone the repo elsewhere. It’s more robust tocdto the repo root relative to the script location.
cd ~/prog/ai4c_hackathon/
util/run_train_climate_zones.sh:17
- Typo in comment: “doe” → “does”.
# uncomment if the mlflow directory doe not exist
util/run_train_climate_zones.sh:23
- This script hard-codes the repo path (
$HOME/prog/ai4c_hackathon). If users follow a different clone location, the job will fail atcd. Consider resolving the repo root relative to the script path, similar to the submit helper.
export AI4C_REPO=$HOME/prog/ai4c_hackathon
cd ${AI4C_REPO}
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 11 changed files in this pull request and generated no new comments.
Suppressed comments (6)
util/submit_train_climate_zones.sh:24
sbatchis invoked with a relative script path (util/run_train_climate_zones.sh), which depends on the current working directory. Use an absolute path based on the submit script's directory to avoid failures when run from another location.
sbatch -o "${STD_OUT_PATH}" -e "${STD_ERR_PATH}" --export=ALL,USER_DIR util/run_train_climate_zones.sh
util/run_train_climate_zones.sh:23
- The job script hard-codes the repo path (
$HOME/prog/ai4c_hackathon). This will fail when the repo is elsewhere (or when the submit script runs from a different checkout). Resolve the repo root relative to this script instead.
export AI4C_REPO=$HOME/prog/ai4c_hackathon
cd ${AI4C_REPO}
util/submit_train_climate_zones.sh:14
- The script hard-codes the repo location via
cd ~/prog/ai4c_hackathon/, which will break if the repository is checked out elsewhere. Derive the repo root from the script location instead so the submit helper is portable.
This issue also appears on line 24 of the same file.
cd ~/prog/ai4c_hackathon/
util/run_train_climate_zones.sh:17
- Typo in comment: "doe" → "does".
This issue also appears on line 22 of the same file.
# uncomment if the mlflow directory doe not exist
src/ai4c_hack/ClimateZones_TrainingPipeline.py:20
osis imported but never used, which adds noise and can trip linters. Remove the unused import.
import argparse
import datetime
import json
import os
import pathlib
from typing import Any
src/ai4c_hack/ClimateZones_Training_Torch.py:13
osis imported but never used, which adds noise and can trip linters. Remove the unused import.
import argparse
import json
import os
import pathlib
from dataclasses import dataclass
from typing import Any
THis PR updates the climate zones tutorial for the new JASMIN GWS. Updates include: