Git Product home page Git Product logo

climatelaboratorybook's Introduction

The Climate Laboratory

DOI Deploy Book Link Checker

A hands-on approach to climate physics and climate modeling

By Brian E. J. Rose, University at Albany

About the book

This book is powered by JupyterBook, and aims to be all of the following:

  • self-reproducing (most figures are self-generating in the notebooks)
  • free and open (permissive license, sources and content available through github)
  • interactive (integration with JupyterHub and Binder will allow readers to run and modify code examples)
  • a living document (content will continue to evolve, and collaboration is welcome)

The material is mostly based on lecture notes for ENV 415: Climate Laboratory and ATM 623: Climate Modeling at the University at Albany.

To view the book online, go here. The JupyterBook source and all book content (mostly Jupyter Notebook files) are all in this github repository.

Much of the content is made possible by climlab, an open-source Python toolkit for interactive, process-oriented climate modeling. Brian Rose is the principle developer of climlab as well as the author of this book.

The contents of this book are licensed for free and open consumption under the following license: Creative Commons Attribution 4.0 International (CC BY 4.0)

How to contribute or modify the book

The source repository on github contains everything you need to build your own local version of the book.

From a local clone of the source, set up a self-contained conda environment with

conda env create --file environment.yml
conda activate climlab-courseware

This environment contains all dependencies for both building the book and running all the code in the book.

To build a local copy of the book, do this from the source root

jupyter-book build .

You will then find the built book in _build/html/, which you can open in a web browser e.g. with

open _build/html/index.html

Note that building the book creates the html from the *.md and *.ipynb sources, but does not re-run the notebooks. When building the book, we assume that all notebooks are already up-to-date! (You can change this behavior by modifying the execute_notebooks flag in _config.yml, but beware that some of the notebooks take a very long time to execute.)

Anyone is welcome to suggest edits or improvements by opening pull requests on the github repository. If you are editing any code in a notebook, please make sure you execute the modified notebook cleanly before submitting the PR.

How is the book published

The book is just the rendered html that results from running jupyter-book build. A new build is triggered on GitHub Actions whenever the sources are updated on the github repository, and the successful build is deployed to the gh-pages branch of the repo.

climatelaboratorybook's People

Contributors

brian-rose avatar dependabot[bot] avatar jamesscottbrown avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

climatelaboratorybook's Issues

Should all sensitivity parameters have the same sign convention?

This point was raised over email by @adriantompkins. The sign conventions for feedback parameters are not as consistent across all notes as they could be. And in some notebooks \lambda_0 is defined positive for a negative feedback while other feedbacks are defined positive for positive.

Need to go through and ensure consistency.

Reformat the book source for Sphinx

The jupyter-book toolset has migrated away from Jekyll and now uses Sphinx as the static site generator. I can't build the book with the current version jupyter-book (0.8.3).

Looks like the most recent version of jupyter-book that will build this source is 0.6.5 (released April 28 2020)

pip install jupyter-book==0.6.5

The JupyterHub interaction links are not yet functional

The short-term goal is for students to be able to click on the JupyterHub "interact" buttons and launch a fully functional session on our server.

This is supposed to be powered behind the scenes with nbgitpuller, which will issue silent git commands to keep the students' local copies of the notebooks up to date.

It's not working yet. Once logged into the JupyterHub, clicking on one of the links gives you a

404 : Not Found

error from the JupyterHub.

Favor ARCO datasets where possible

I tried to create a lot of content in this book that pulls from publicly available data, mostly via THREDDS servers. This has worked ok but does suffer from occasional outages. One example is climlab/climlab#177

Besides outages of THREDDS servers (including our own UAlbany-hosted server at http://thredds.atmos.albany.edu:8080/thredds/catalog.html), a bigger problem for interactive classroom use is the fact that THREDDS doesn't scale well to multiple simultaneous users.

A better alternative is cloud-native datasets served via public cloud storage buckets, or "Analysis-Ready, Cloud Optimized" (ARCO) data. A nice example of using ARCO-formatted ERA5 data is this Project Pythia Cookbook

"Advanced" topics need to be better integrated

Several of the "advanced" chapters have redundant material that overlaps with the "regular" notes on that topic, e.g.

The overlaps are relics of the merging of the undergraduate and graduate versions of my lecture notes. Need to smooth out these rough edges.

There are many broken links in the notebooks

This may take a while to clean up. The notebooks have a number of broken "internal" links to other notebooks -- a legacy of the old structure in the ClimateModeling_courseware repository.

Obviously I need to either get rid of the links or update them so they point to something.

climlab does not run well in Binder

The Binder links work fine, except for a fatal flaw. If we try to

import climlab

the Binder kernel hangs forever.

So the Binder links are effectively useless since we import climlab in almost every notebook.

Merging a PR deletes ALL previews

Currently when you merge a PR it triggers a build-and-deploy action that overwrites the entire contents of the gh-pages branch, which effectively deletes the previews not just of the merged PR but also any other previews that are currently open.

We need to preserve previews for open PRs and explicitly delete them upon merge.

I think the way to do the first part is to set keep_files: true in the actions-gh-pages step.

The second part... I already have code in place for this but can't really test it until we fix the first part.

Inconsistent ways of creating annual arrays

In the Orbital notes there are two different methods used to create arrays of days of the year:

days = np.linspace(0, const.days_per_year, 365)

and

days = np.linspace(1.,num,365)/num * const.days_per_year

The second version evenly samples the annual cycle while the first version double-counts day=0. Second version is better, particularly when we’re averaging over the array to take time averages. Make it consistent across the chapter.

Need cover art!

The book needs a nice-looking piece of cover art to greet readers on the landing page

It's currently pretty bleak.

I have some ideas about the graphics but I don't really have the skills to make it look good.

Use of abbreviations like TOA -- add reference table?

A reader brought to my attention the fact that the abbreviation TOA (top of atmosphere) is first used in Chapter 7 but never defined.

Obviously I should define this term where it is first used, but maybe it would also be helpful to include a table of abbreviations in the Postamble.

DOI and citation methods

What's the optimal way to track citations of the book? I'm not sure.

It would be easy to attach DOIs to specific tagged releases. But these DOIs would point to the source repository, not to the book itself.

Need to look around to see how other people are handling this.

The book should have a "development roadmap"

It might be useful for readers and casual visitors to see where this document is headed, especially as there will be a lot of changes over the next few months.

Basically a map of what I expect the book to look like by the end of Spring 2020 semester.

climlab does not import correctly in Google Colab

Hello,

I have just installed climlab on Google Colab with no errors. However, upon import, I receive the following warnings:

/usr/local/lib/python3.9/dist-packages/climlab/radiation/cam3.py:46: UserWarning: Cannot import and initialize compiled Fortran extension, CAM3 module will not be functional.
  warnings.warn('Cannot import and initialize compiled Fortran extension, CAM3 module will not be functional.')
/usr/local/lib/python3.9/dist-packages/climlab/radiation/rrtm/rrtmg_lw.py:19: UserWarning: Cannot import and initialize compiled Fortran extension, RRTMG_LW module will not be functional.
  warnings.warn('Cannot import and initialize compiled Fortran extension, RRTMG_LW module will not be functional.')
/usr/local/lib/python3.9/dist-packages/climlab/radiation/rrtm/rrtmg_sw.py:19: UserWarning: Cannot import and initialize compiled Fortran extension, RRTMG_SW module will not be functional.
  warnings.warn('Cannot import and initialize compiled Fortran extension, RRTMG_SW module will not be functional.')
/usr/local/lib/python3.9/dist-packages/climlab/convection/emanuel_convection.py:14: UserWarning: Cannot import EmanuelConvection fortran extension, this module will not be functional.
  warnings.warn('Cannot import EmanuelConvection fortran extension, this module will not be functional.')

Initializing a model is fine, but when I try to run the model forward in time I get the following error:

NameError                                 Traceback (most recent call last)
[<ipython-input-14-b960f8fe0eca>](https://773tncaih8g-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20230322-060151-RC00_518525591#) in <module>
----> 1 radmodel.step_forward()

6 frames
[/usr/local/lib/python3.9/dist-packages/climlab/process/time_dependent_process.py](https://773tncaih8g-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20230322-060151-RC00_518525591#) in step_forward(self)
    331 
    332         """
--> 333         tenddict = self.compute()
    334         #  Total tendency is applied as an explicit forward timestep
    335         # (already accounting properly for order of operations in compute() )

[/usr/local/lib/python3.9/dist-packages/climlab/process/time_dependent_process.py](https://773tncaih8g-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20230322-060151-RC00_518525591#) in compute(self)
    211         tendencies = {}
    212         ignored = self._compute_type('diagnostic')
--> 213         tendencies['explicit'] = self._compute_type('explicit')
    214         #  Tendencies due to implicit and adjustment processes need to be
    215         #  calculated from a state that is already adjusted after explicit stuff

[/usr/local/lib/python3.9/dist-packages/climlab/process/time_dependent_process.py](https://773tncaih8g-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20230322-060151-RC00_518525591#) in _compute_type(self, proctype)
    259             if self.time['steps'] % step_ratio == 0:
    260                 proc.time['active_now'] = True
--> 261                 tenddict = proc.compute()
    262             else:
    263                 # proc.tendencies is unchanged from last subprocess timestep if we didn't recompute it above

[/usr/local/lib/python3.9/dist-packages/climlab/process/time_dependent_process.py](https://773tncaih8g-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20230322-060151-RC00_518525591#) in compute(self)
    233                 self.tendencies[varname] += tend
    234         # Finally compute my own tendencies, if any
--> 235         self_tend = self._compute()
    236         #  Adjustment processes _compute method returns absolute adjustment
    237         #  Needs to be converted to rate of change

[/usr/local/lib/python3.9/dist-packages/climlab/process/energy_budget.py](https://773tncaih8g-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20230322-060151-RC00_518525591#) in _compute(self)
     70 
     71     def _compute(self):
---> 72         tendencies = self._temperature_tendencies()
     73         return tendencies
     74 

[/usr/local/lib/python3.9/dist-packages/climlab/process/energy_budget.py](https://773tncaih8g-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20230322-060151-RC00_518525591#) in _temperature_tendencies(self)
     58 
     59     def _temperature_tendencies(self):
---> 60         self._compute_heating_rates()
     61         tendencies = {}
     62         for varname, value in self.state.items():

[/usr/local/lib/python3.9/dist-packages/climlab/radiation/rrtm/rrtmg_sw.py](https://773tncaih8g-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20230322-060151-RC00_518525591#) in _compute_heating_rates(self)
    206             #  Call the Monte Carlo Independent Column Approximation (McICA, Pincus et al., JC, 2003)
    207             (cldfmcl, ciwpmcl, clwpmcl, reicmcl, relqmcl, taucmcl,
--> 208             ssacmcl, asmcmcl, fsfcmcl) = _rrtmg_sw.climlab_mcica_subcol_sw(
    209                             ncol, nlay, icld, permuteseed, irng, play,
    210                             cldfrac, ciwp, clwp, reic, relq, tauc, ssac, asmc, fsfc)

NameError: name '_rrtmg_sw' is not defined```


This seems similar to another issue still open here with regards to binder. 

Are there any workarounds? Thank you kindly.

Equation numbers and links

Currently I have

number_equations: true 

in the _config.yml file, so every equation is automatically numbered in each notebook. This is nice, but the text doesn't actually make any use of the numbers.

From the JupyterBook docs, it's possible to use latex-style labels to refer and link to equations.

Adding references and links to numbered equations will improve the text in many places.

Broken links to AGU journals

As discussed in ProjectPythia/cmip6-cookbook#46, the link-checker is failing on all links to AGU journals following a change in their terms of use. The links themselves are fine but they don't play well with the sphinx link checker.

The workaround discussed at the above link is to always use the DOI link (which should be indefinitely persistent and thus not need checking) and then exclude the doi.org pattern from the link-checker.

Glossary and index

JupyterBook these days supports a number of readability and navigation features that I'm not yet using.

It would be great to use the glossary feature for term definitions, and the index feature to make things easier to find.

Hiding messy code cells by default

One of the nice features of JupyterBook is the ability to hide cells in the rendered html, but provide a button to reveal if the user wants to see it:
https://jupyterbook.org/features/hiding.html

This is exactly the right feature to make some of the more "narrative" parts of my notes easier to read while preserving the full reproducibility.

Need to go through and implement this in lots of places (and mostly include a brief tutorial on it in the preamble).

References section

The book has a References section that has just said "under construction" since the beginning.

JupyterBook docs for adding references and citations is here. I should probably get moving on this.

Lots of missing images

Since the move to sphinx-based JupyterBook, seems that many figures are no longer rendering properly. Probably an incompatible image format issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.