Skip to content

Commit 7dbe1f8

Browse files
committed
Ex1 is now added too
1 parent 1549d89 commit 7dbe1f8

2 files changed

Lines changed: 48 additions & 3 deletions

File tree

Ex1_Precipitation.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# Exercises precipitation
22
# =====
3+
# ## Tutorial: Interpolate missing values
34
#
4-
# Exercise 1 - Interpolate missing values
5+
# ---
6+
#
7+
# Note: I have used the material by [**Jesús Casado Rodríguez**](https://github.com/casadoj) for this tutorial. If you ever had the time, please check out his [repository](https://github.com/casadoj/Clases.git) for more material.
8+
#
9+
# ---
510
#
611
# The figure shows the location of 11 precipitation gauges in a research
712
# watershed. Measurements are missing at gauge F for a rain storm. Use

Makefile

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Simplified Makefile for jupytext conversions - multiple files
2-
SOURCE_FILES = basics_00.py
2+
SOURCE_FILES = basics_00.py basics_01.py Ex1_Precipitation.py
33

44
# Default target - runs when you just type 'make'
55
.DEFAULT_GOAL := all
@@ -9,6 +9,28 @@ ready/images:
99
mkdir -p ready
1010
cp -r image ready/
1111

12+
# Download and extract MDB boundaries zip file
13+
MDB_boundaries:
14+
@if [ ! -f MDB_boundaries.zip ]; then \
15+
echo "Downloading MDB_boundaries.zip..."; \
16+
curl -L -o MDB_boundaries.zip https://data.gadopt.org/water-course/MDB_boundaries.zip; \
17+
fi
18+
unzip -o MDB_boundaries.zip
19+
20+
# Download rain_day_2025.nc file
21+
rain_day_2025.nc:
22+
@if [ ! -f rain_day_2025.nc ]; then \
23+
echo "Downloading rain_day_2025.nc..."; \
24+
curl -L -o rain_day_2025.nc https://data.gadopt.org/water-course/rain_day_2025.nc; \
25+
fi
26+
27+
# Download RainfallData_Exercise_001.csv file
28+
RainfallData_Exercise_001.csv:
29+
@if [ ! -f RainfallData_Exercise_001.csv ]; then \
30+
echo "Downloading RainfallData_Exercise_001.csv..."; \
31+
curl -L -o RainfallData_Exercise_001.csv https://data.gadopt.org/water-course/RainfallData_Exercise_001.csv; \
32+
fi
33+
1234
# Convert single file to exercise notebook (remove solutions)
1335
exercise-%: ready/images
1436
jupytext --to ipynb -o $(basename $*)_temp.ipynb $*
@@ -27,6 +49,24 @@ solution-%: ready/images
2749
$(basename $*)_temp.ipynb
2850
rm -f $(basename $*)_temp.ipynb
2951

52+
# Special dependency for basics_01.py solution (requires MDB extraction and rain data)
53+
solution-basics_01.py: ready/images MDB_boundaries rain_day_2025.nc
54+
jupytext --to ipynb -o basics_01_temp.ipynb basics_01.py
55+
jupyter nbconvert --to notebook --output=ready/basics_01_solution.ipynb --execute \
56+
--TagRemovePreprocessor.enabled=True \
57+
--TagRemovePreprocessor.remove_cell_tags='["empty-cell"]' \
58+
basics_01_temp.ipynb
59+
rm -f basics_01_temp.ipynb
60+
61+
# Special dependency for Ex1_Precipitation.py solution (requires rainfall data)
62+
solution-Ex1_Precipitation.py: ready/images RainfallData_Exercise_001.csv
63+
jupytext --to ipynb -o Ex1_Precipitation_temp.ipynb Ex1_Precipitation.py
64+
jupyter nbconvert --to notebook --output=ready/Ex1_Precipitation_solution.ipynb --execute \
65+
--TagRemovePreprocessor.enabled=True \
66+
--TagRemovePreprocessor.remove_cell_tags='["empty-cell"]' \
67+
Ex1_Precipitation_temp.ipynb
68+
rm -f Ex1_Precipitation_temp.ipynb
69+
3070
# Generate exercise versions for all files
3171
exercise: $(addprefix exercise-,$(SOURCE_FILES))
3272

@@ -41,4 +81,4 @@ clean:
4181
rm -f *_temp.ipynb *_solution.ipynb
4282
rm -rf ready
4383

44-
.PHONY: exercise solution all clean ready/images
84+
.PHONY: exercise solution all clean ready/images MDB_boundaries rain_day_2025.nc RainfallData_Exercise_001.csv

0 commit comments

Comments
 (0)