-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (31 loc) · 1.55 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
ENVIRONMENT_NAME ?= e3sm-v2-fme
RUN_KEY ?= 42yrs-batch_size8-max_epochs50-lr3e-4-run4
REFERENCE_KEY ?= 42-years-training-set-reference
NOTEBOOKS = daily-precip-pdf daily-precip-zonal-mean-spectrum precip-biases toa-lw-sw-biases wheeler-kiladis
# recommended to deactivate current conda environment before running this
create_environment:
conda create -n $(ENVIRONMENT_NAME) python=3.8 pip cartopy
conda run -n $(ENVIRONMENT_NAME) pip install -r notebooks/requirements.txt
create_jupyter_kernel: create_environment
conda run -n $(ENVIRONMENT_NAME) python -m ipykernel install --user \
--name $(ENVIRONMENT_NAME) --display-name "Python [conda:${ENVIRONMENT_NAME}]" \
--env PATH /global/common/software/nersc/pm-2023q2/sw/texlive/2022/bin/x86_64-linux:\${PATH}
.PHONY: run_notebooks
# use run_notebook_figures to run the notebook that generates the manuscript figures
run_notebook_%:
conda env config vars set -n $(ENVIRONMENT_NAME) \
RUN_KEY=$(RUN_KEY) REFERENCE_KEY=$(REFERENCE_KEY)
conda run -n $(ENVIRONMENT_NAME) jupyter nbconvert \
--to notebook --execute --inplace \
--ExecutePreprocessor.timeout=-1 \
--ExecutePreprocessor.kernel_name=$(ENVIRONMENT_NAME) \
--ExecutePreprocessor.allow_errors=True \
--ExecutePreprocessor.record_timing=True \
--ExecutePreprocessor.store_widget_state=True \
--ExecutePreprocessor.iopub_timeout=120 \
--ExecutePreprocessor.interrupt_on_timeout=True \
--output-dir=notebooks \
--output=$*.ipynb \
notebooks/$*.ipynb
# all notebooks other than figures.ipynb
run_notebooks_%: $(addprefix run_notebook_, $(NOTEBOOKS))