From 2cd4a8732f8b72657ede2db2709a42d79e8f6afe Mon Sep 17 00:00:00 2001 From: Romina Piunno Date: Mon, 19 Aug 2024 10:54:54 -0700 Subject: [PATCH 1/7] Create OOP_intro.md --- book/tutorials/nb-to-package/OOP_intro.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 book/tutorials/nb-to-package/OOP_intro.md diff --git a/book/tutorials/nb-to-package/OOP_intro.md b/book/tutorials/nb-to-package/OOP_intro.md new file mode 100644 index 0000000..bf60578 --- /dev/null +++ b/book/tutorials/nb-to-package/OOP_intro.md @@ -0,0 +1,13 @@ +# Intro to Object Oriented Programming (OOP) + +In this tutorial, we'll be learning how to structure object-oriented code +to take full advantage of this programming paradigm. + +Follow along with the slides [`here`](./OOP.pdf)! + +We'll be using UCAR's ['Very Simple Climate Model'](https://scied.ucar.edu/interactive/simple-climate-model) as an example. + +Go ahead and preview the code we'll write together +- [`climate_model.py`](./climate_model.py) +- [`co2_emissions.py`](./co2_emissions.py) +- Some sample data: [`SSP_CO2emissions.csv`](./SSP_CO2emissions.csv) From 4f98c85151d06488343ac1686111e2b026baf777 Mon Sep 17 00:00:00 2001 From: Romina Piunno Date: Mon, 19 Aug 2024 10:57:46 -0700 Subject: [PATCH 2/7] Update _toc.yml include OOP_intro.md --- book/_toc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/book/_toc.yml b/book/_toc.yml index 6f7333b..2125e28 100644 --- a/book/_toc.yml +++ b/book/_toc.yml @@ -24,6 +24,7 @@ parts: - file: tutorials/cryocloud_demo/CryoCloud_demo.ipynb - file: tutorials/nb-to-package/index sections: + - file: tutorials/nb-to-package/OOP_intro - file: tutorials/nb-to-package/intro sections: - file: tutorials/nb-to-package/sample.ipynb From e7eb6c0e40eab1f1aee8cff1cf53db3328e51dc7 Mon Sep 17 00:00:00 2001 From: Romina Date: Mon, 19 Aug 2024 13:14:25 -0700 Subject: [PATCH 3/7] update TOC for OOP py files --- book/_toc.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/book/_toc.yml b/book/_toc.yml index 2125e28..218277f 100644 --- a/book/_toc.yml +++ b/book/_toc.yml @@ -25,6 +25,9 @@ parts: - file: tutorials/nb-to-package/index sections: - file: tutorials/nb-to-package/OOP_intro + sections: + - file: tutorials/nb-to-package/climate_model.py + - file: tutorials/nb-to-package/co2_emissions.py - file: tutorials/nb-to-package/intro sections: - file: tutorials/nb-to-package/sample.ipynb From e4297204a29770c084a581f1c0ac5793f5c9558f Mon Sep 17 00:00:00 2001 From: Romina Piunno Date: Tue, 20 Aug 2024 10:08:11 -0700 Subject: [PATCH 4/7] Update climate_model.py - try adding title --- book/tutorials/nb-to-package/climate_model.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/book/tutorials/nb-to-package/climate_model.py b/book/tutorials/nb-to-package/climate_model.py index f3e9b11..6d2e043 100644 --- a/book/tutorials/nb-to-package/climate_model.py +++ b/book/tutorials/nb-to-package/climate_model.py @@ -1,3 +1,5 @@ +# Very Simpl Climate Model + import numpy as np import matplotlib.pyplot as plt from co2_emissions import Constant_CO2, SSPEmissions From 1fb8323206e7920e4278c6cef28f24452cbe79e7 Mon Sep 17 00:00:00 2001 From: Romina Date: Tue, 20 Aug 2024 10:22:51 -0700 Subject: [PATCH 5/7] inclue title for .py files in toc --- book/_toc.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/book/_toc.yml b/book/_toc.yml index 218277f..0ba15e0 100644 --- a/book/_toc.yml +++ b/book/_toc.yml @@ -27,7 +27,9 @@ parts: - file: tutorials/nb-to-package/OOP_intro sections: - file: tutorials/nb-to-package/climate_model.py + title: Climate Model Example - file: tutorials/nb-to-package/co2_emissions.py + title: CO2 Emissions for VSCM - file: tutorials/nb-to-package/intro sections: - file: tutorials/nb-to-package/sample.ipynb From b1093687a411126519c61bbc7a2955caee214b5d Mon Sep 17 00:00:00 2001 From: Romina Date: Tue, 20 Aug 2024 10:28:54 -0700 Subject: [PATCH 6/7] Try adding title underline --- book/tutorials/nb-to-package/climate_model.py | 1 + 1 file changed, 1 insertion(+) diff --git a/book/tutorials/nb-to-package/climate_model.py b/book/tutorials/nb-to-package/climate_model.py index 6d2e043..41c05bf 100644 --- a/book/tutorials/nb-to-package/climate_model.py +++ b/book/tutorials/nb-to-package/climate_model.py @@ -1,4 +1,5 @@ # Very Simpl Climate Model +########################## import numpy as np import matplotlib.pyplot as plt From c3fee25ca393936e27b4fb523ec3490cc98c07c2 Mon Sep 17 00:00:00 2001 From: Romina Date: Tue, 20 Aug 2024 10:52:17 -0700 Subject: [PATCH 7/7] fix links in toc for OOP tut --- book/_toc.yml | 5 ----- book/tutorials/nb-to-package/OOP_intro.md | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/book/_toc.yml b/book/_toc.yml index 0ba15e0..2125e28 100644 --- a/book/_toc.yml +++ b/book/_toc.yml @@ -25,11 +25,6 @@ parts: - file: tutorials/nb-to-package/index sections: - file: tutorials/nb-to-package/OOP_intro - sections: - - file: tutorials/nb-to-package/climate_model.py - title: Climate Model Example - - file: tutorials/nb-to-package/co2_emissions.py - title: CO2 Emissions for VSCM - file: tutorials/nb-to-package/intro sections: - file: tutorials/nb-to-package/sample.ipynb diff --git a/book/tutorials/nb-to-package/OOP_intro.md b/book/tutorials/nb-to-package/OOP_intro.md index bf60578..23e02da 100644 --- a/book/tutorials/nb-to-package/OOP_intro.md +++ b/book/tutorials/nb-to-package/OOP_intro.md @@ -8,6 +8,6 @@ Follow along with the slides [`here`](./OOP.pdf)! We'll be using UCAR's ['Very Simple Climate Model'](https://scied.ucar.edu/interactive/simple-climate-model) as an example. Go ahead and preview the code we'll write together -- [`climate_model.py`](./climate_model.py) -- [`co2_emissions.py`](./co2_emissions.py) +- {download}`climate_model.py <./climate_model.py>` +- {download}`co2_emissions.py <./co2_emissions.py>` - Some sample data: [`SSP_CO2emissions.csv`](./SSP_CO2emissions.csv)