Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a45375a
Add empty ENSO notebook for collaboration
tennlee Jul 1, 2025
c6636a8
Create an empty tutorial ENSO_Forecast.ipynb (#137)
sana-ccrc Jul 2, 2025
3a00dff
Merge branch 'develop' into enso_example_development
tennlee Jul 3, 2025
4eb2480
Update ENSO_Forecast.ipynb, add the initial structure for the tutoria…
sana-ccrc Jul 7, 2025
9f45bd9
Update the introduction and added references and a reference section.
sana-ccrc Jul 10, 2025
88b8d4c
Add example of connecting to ERA5 and extracting a bounding box regio…
tennlee Jul 10, 2025
7288f1f
Merge pull request #1 from tennlee/sanaa_enso
sana-ccrc Jul 14, 2025
f67c401
Merge remote-tracking branch 'origin/develop' into enso_example_devel…
sana-ccrc Jul 14, 2025
5304a8c
Add a script that calculates nino3.4 index to ENSO_Forecast.ipynb and…
sana-ccrc Jul 14, 2025
b3e4b96
Demonstrate the use of the pipeline for:
tennlee Jul 18, 2025
6db6620
Update the introduction and added references and a reference section.…
sana-ccrc Jul 19, 2025
d4b20e8
changes made to ENSO_Forecast and ENSO_Pipeline:
sana-ccrc Jul 20, 2025
2d9d8fa
Merged with origin/enso_example_development, kept local changes for E…
sana-ccrc Jul 20, 2025
91a5b09
Added background and preprocessed data; ready for XGBoost training
sana-ccrc Jul 29, 2025
fb57cb9
Added a column with the monthly climatology for nino3.4 for compariso…
sana-ccrc Aug 1, 2025
427197d
Update ENSO_Forecast.ipynb
sana-ccrc Aug 7, 2025
8b9b5cd
Add inline comments in ENSO pipeline for review
tennlee Aug 11, 2025
2a9ecb2
Add gridded MLP notebook
tennlee Aug 13, 2025
ce9b1d5
Tidy up ENSO_Forecast.ipynb: fix layout and remove unused cells
sana-ccrc Aug 14, 2025
cb986b5
Add ENSO Tutorial folder with notebooks
sana-ccrc Aug 15, 2025
26fd647
Update ENSO_Forecast notebook
sana-ccrc Aug 15, 2025
4837238
Now that the tutorials have been moved into a dedicated folder and ti…
tennlee Aug 15, 2025
4537ae6
Create tutorials for ENSO prediction
tennlee Aug 15, 2025
d07080e
Merge branch 'develop' into enso_example_development
tennlee Aug 15, 2025
643faa1
Black code formatting
tennlee Aug 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion notebooks/tutorial/CNN-Model-Training.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8364,7 +8364,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.2"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
120 changes: 120 additions & 0 deletions notebooks/tutorial/ENSO Tutorial/1 Tech Test.ipynb

Large diffs are not rendered by default.

2,087 changes: 2,087 additions & 0 deletions notebooks/tutorial/ENSO Tutorial/ENSO Gridded MLP.ipynb

Large diffs are not rendered by default.

2,397 changes: 2,397 additions & 0 deletions notebooks/tutorial/ENSO Tutorial/ENSO_Forecast.ipynb

Large diffs are not rendered by default.

1,081 changes: 1,081 additions & 0 deletions notebooks/tutorial/ENSO Tutorial/ENSO_Pipeline.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion notebooks/tutorial/MLX-Demo-Custom-Arch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.2"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ def get_config(mf: bool = False):

if isinstance(location, (tuple, list)):
try:
return xr.open_mfdataset(filter_files(location),
decode_timedelta=True, # TODO: should we raise a warning? It seems to be required for almost all our data.
**get_config(True))
return xr.open_mfdataset(
filter_files(location),
decode_timedelta=True, # TODO: should we raise a warning? It seems to be required for almost all our data.
**get_config(True),
)

except xr.MergeError as e:
if not soft_fail:
Expand Down
4 changes: 2 additions & 2 deletions packages/pipeline/src/pyearthtools/pipeline/_save_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@


def save_pipeline(
pipeline: "pyearthtools.pipeline.Pipeline",
path: Optional[Union[str, Path]] = None) -> Union[None, str]:
pipeline: "pyearthtools.pipeline.Pipeline", path: Optional[Union[str, Path]] = None
) -> Union[None, str]:
"""
Save `Pipeline`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,12 @@ def __init__(
merge_kwargs: Optional[dict[str, Any]] = None,
delta_unit: Optional[str] = None,
):
"""
Args:
samples: number of samples to fetch (negative for n-back, positive for n-forward)
delta_unit: e.g. "month" or "hour"
concat: whether to contact or merge
"""
super().__init__(samples, merge_function=merge_function, concat=concat, merge_kwargs=merge_kwargs)

def map_to_tuple(mod):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,34 @@ def denormalise(self, sample):
class Deviation(xarrayNormalisation):
"""Deviation Normalisation"""

def __init__(self, mean: FILE, deviation: FILE):
def __init__(
self, mean: FILE | xr.Dataset | xr.DataArray | float, deviation: FILE | xr.Dataset | xr.DataArray | float
):
"""
Each argument take take a Dataset, DataArray, float or file object.

Args:
mean: mean values to subtract
deviation: deviation value to divide by
"""
super().__init__()
self.record_initialisation()
self.mean = self.open_file(mean)
self.deviation = self.open_file(deviation)

if isinstance(mean, xr.Dataset):
self.mean = mean
if isinstance(mean, xr.DataArray):
self.mean = mean
elif isinstance(mean, float):
self.mean = mean
else:
self.mean = self.open_file(mean)

if isinstance(deviation, xr.Dataset):
self.deviation = deviation
elif isinstance(deviation, float):
self.deviation = deviation
else:
self.deviation = self.open_file(deviation)

def normalise(self, sample):
return (sample - self.mean) / self.deviation
Expand Down
2 changes: 1 addition & 1 deletion packages/pipeline/tests/pipeline/test_save_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

from pyearthtools.pipeline import controller
from pyearthtools.pipeline._save_pipeline import save_pipeline
from pyearthtools.pipeline._save_pipeline import load_pipeline


def test_save_and_load_pipeline():

p = controller.Pipeline()
Expand Down