climkern
Python package for easily computing climate feedbacks using radiative kernels.
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 8 DOI reference(s) in README -
✓Academic publication links
Links to: wiley.com, zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.7%) to scientific vocabulary
Repository
Python package for easily computing climate feedbacks using radiative kernels.
Basic Info
- Host: GitHub
- Owner: tyfolino
- License: mit
- Language: Python
- Default Branch: dev
- Size: 166 KB
Statistics
- Stars: 19
- Watchers: 3
- Forks: 7
- Open Issues: 3
- Releases: 7
Metadata Files
README.md
ClimKern: a Python package for calculating radiative feedbacks
Overview
The radiative kernel technique outlined in Soden & Held (2006) and Soden et al. (2008) is commonly used to calculate climate feedbacks. The "kernels" refer to datasets containing the radiative sensitivities of TOA (or surface) radiation to changes in fields such as temperature, specific humidity, and surface albedo; they are typically computed using offline radiative transfer calculations.
ClimKern * standardizes the assumptions used in producing radiative feedbacks using kernels * simplifies the calculations by giving users access to functions tailored for climate model and reanalysis output * provides access to a repository of 11 different radiative kernels to quantify interkernel spread
The below information is meant to be a quickstart guide, but all functions and capabilities can be found at ClimKern's documentation site.
Installation
ClimKern is built on the Xarray architecture and requires several other packages for regridding and climate model output compatibility. The easiest method is to create a new conda environment using conda or mamba:
conda create -n ck_env python=3.11 esmpy -c conda-forge
A conda environment is necessary because ESMPy, which is required for regridding kernels, is unavailable via pip.
Next, activate the new environment:
conda activate ck_env
Finally, install ClimKern with pip:
pip install climkern
Once installed, ClimKern requires kernels found on Zenodo. These kernels (and tutorial data) are stored separately because of PyPI size limitations. You can download the kernels easily using the download script included in the package:
python -m climkern download
Note: The kernels & tutorial data are approximately 5 GB.
IMPORTANT: SSL Certificate Errors
It is possible to get an SSL certificate error when trying to run the download script. You may try updating your certificate authorities withpip install --upgrade certifi.If that does not work, you can manually download the
data.zipfile from Zenodo and unzip it in your ClimKern package directory.
Optional:
You can test your installation via pytest.
pip install pytest
pytest -v --pyargs climkern
All three tests should pass.
Basic tutorial
Temperature, water vapor, and surface albedo feedbacks
This brief tutorial will cover the basics of using ClimKern. Please check the documentation for a more complete list of available functions. We start by importing ClimKern and accessing our tutorial data: ```python import climkern as ck
ctrl, pert = ck.tutorialdata("ctrl"), ck.tutorialdata("pert") ```
These datasets have all the necessary variables for computing feedbacks. Let's start with temperature feedbacks.
python
LR, Planck = ck.calc_T_feedbacks(
ctrl.T, ctrl.TS, ctrl.PS, pert.T, pert.TS, pert.PS, pert.TROP_P, kern="GFDL"
)
To produce succinct output, let's use ClimKern's spatial average function. Additionally, we will normalize the feedbacks by global average surface temperature change to convert from Wm-2, the output of ClimKern functions, to the more commonly used units of Wm-2K-1.
```python
compute global average surface temperature change
dTSglobavg = ck.spat_avg(pert.TS - ctrl.TS)
normalize temperature feedbacks by temperature change and take
the annual average
print("The global average lapse rate feedback is {val:.2f} W/m^2/K.".format( val=(ck.spatavg(LR)/dTSglobavg).mean())) print("The global average Planck feedback is {val:.2f} W/m^2/K.".format( val=(ck.spatavg(Planck)/dTSglobavg).mean())) ``` Expected result with the GFDL kernel:
The global average lapse rate feedback is -0.41 W/m^2/K.
The global average Planck feedback is -3.12 W/m^2/K.
The water vapor and surface albedo feedbacks are calculated similarly: ```python qlw,qsw = ck.calcqfeedbacks(ctrl.Q,ctrl.T,ctrl.PS, pert.Q,pert.PS,pert.TROPP, kern="GFDL",method=1) alb = ck.calcalb_feedback(ctrl.FSUS,ctrl.FSDS, pert.FSUS,pert.FSDS, kern="GFDL")
print("The global average water vapor feedback is {val:.2f} W/m^2/K.".format( val=(ck.spatavg(qlw+qsw)/dTSglobavg).mean())) print("The global average surface albedo feedback is {val:.2f} W/m^2/K." .format( val=(ck.spatavg(alb)/dTSglobavg).mean())) ``` Expected result:
The global average water vapor feedback is 1.44 W/m^2/K.
The global average surface albedo feedback is 0.38 W/m^2/K.
Cloud feedbacks
The cloud feedbacks, calculated using Soden et al. (2008) adjustment method, require all-sky and clear-sky versions of other feedbacks and the instantaneous radiative forcing.
First, we need the longwave and shortwave cloud radiative effects, which ClimKern can calculate.
python
dCRE_LW = ck.calc_dCRE_LW(ctrl.FLNT,pert.FLNT,ctrl.FLNTC,pert.FLNTC)
dCRE_SW = ck.calc_dCRE_SW(ctrl.FSNT,pert.FSNT,ctrl.FSNTC,pert.FSNTC)
Let's also read in the tutorial erf.
python
erf = ck.tutorial_data('ERF')
Next, we need the clear-sky versions of the temperature, water vapor, and surface albedo feedbacks.
```python
_cs means clear-sky
LRcs,Planckcs = ck.calcTfeedbacks(ctrl.T,ctrl.TS,ctrl.PS,
pert.T,pert.TS,pert.PS,pert.TROPP,
kern="GFDL",sky="clear-sky")
qlwcs,qswcs = ck.calcqfeedbacks(ctrl.Q,ctrl.T,ctrl.PS,
pert.Q,pert.PS,pert.TROPP,
kern="GFDL",method=1,sky="clear-sky")
albcs = ck.calcalbfeedback(ctrl.FSUS,ctrl.FSDS,
pert.FSUS,pert.FSDS,
kern="GFDL",sky="clear-sky")
At last, we can calculate the longwave and shortwave cloud feedbacks.
python
cldlw = ck.calccloudLW(LR + Planck,LRcs+Planckcs,qlw,qlwcs,dCRELW,
erf.erflwas,erf.erflwcs)
cldsw = ck.calccloudSW(alb,albcs,qsw,qswcs,dCRESW,erf.erfswas,
erf.erfswcs)
print("The global average SW cloud feedback is {val:.2f} W/m^2/K.".format( val=(ck.spatavg(cldsw)/dTSglobavg).mean())) print("The global average LW cloud feedback is {val:.2f} W/m^2/K.".format( val=(ck.spatavg(cldlw)/dTSglobavg).mean())) ``` Expected result:
The global average SW cloud feedback is 0.38 W/m^2/K.
The global average LW cloud feedback is 0.03 W/m^2/K.
Troubleshooting
If you are having issues downloading dependencies with pip, you can also try adding them to your conda environment with conda, i.e.:
conda install xesmf -c conda-forge
If you are having trouble downloading the kernels and tutorial data using the package's download function, you can also download the data directly from the Zenodo repository and put it in the climkern/data directory located wherever your conda/mamba environments are stored.
Other features & coming soon
ClimKern has several other useful features: - Four different methods for calculating water vapor feedbacks. - The ability to calculate the "relative humidity" version of all feedbacks following Held & Shell (2012) and Zelinka et al. (2020). - Functions to calculate stratospheric temperature and water vapor feedbacks.
We are continuously updating the package. Please check out the GitHub issues page for this repository for plans for new features.
Want to help? Get involved!
We deeply appreciate contributions from other scientists and programmers and are happy to attribute credit accordingly. If you wish to contribute, please read our CONTRIBUTING.md for guidelines on how to get started.
tl;dr:
- Work from the dev branch, not main
- Submit a pull request when ready.
📖 How to Cite ClimKern
If you use ClimKern in your work, please cite our paper:
Janoski, T. P., Mitevski, I., Kramer, R. J., Previdi, M., & Polvani, L. M. (2025). ClimKern v1.2: a new Python package and kernel repository for calculating radiative feedbacks. Geoscientific Model Development, 18(10), 3065–3079. https://doi.org/10.5194/gmd-18-3065-2025
BibTeX
```bibtex @article{janoski2025climkern, AUTHOR = {Janoski, T. P. and Mitevski, I. and Kramer, R. J. and Previdi, M. and Polvani, L. M.}, TITLE = {ClimKern v1.2: a new Python package and kernel repository for calculating radiative feedbacks}, JOURNAL = {Geoscientific Model Development}, VOLUME = {18}, YEAR = {2025}, NUMBER = {10}, PAGES = {3065--3079}, URL = {https://gmd.copernicus.org/articles/18/3065/2025/}, DOI = {10.5194/gmd-18-3065-2025} } ```If you are citing the software itself (e.g., for reproducibility), use the citation metadata included in our CITATION.cff file. GitHub also provides downloadable citation formats via the "Cite this repository" button on the right-hand sidebar.
Owner
- Name: Ty Janoski
- Login: tyfolino
- Kind: user
- Location: Columbia University, NY
- Website: tylerjanoski.com
- Repositories: 1
- Profile: https://github.com/tyfolino
Ph.D. student in the Department of Earth and Environmental Sciences of Columbia University. Mainly interested in Arctic amplification in climate models.
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use ClimKern, please cite the software and accompanying paper."
title: "ClimKern"
version: "1.2.0"
doi: "10.5281/zenodo.14743210"
repository-code: https://github.com/tyfolino/climkern
license: MIT
date-released: "2025-01-26"
authors:
- family-names: "Janoski"
given-names: "Tyler P."
affiliation:
- "Dept. of Earth & Environmental Sciences, Columbia University, New York, NY, USA"
- "Lamont-Doherty Earth Observatory, Columbia University, Palisades, NY, USA"
- "NOAA Center for Earth System Science and Remote Sensing Technologies (CESSRST-II), New York, NY, USA"
- "City College of New York, New York, NY, USA"
- "NOAA National Severe Storms Laboratory, Norman, OK, USA"
orcid: "0000-0003-4344-355X"
email: "tyfolino@gmail.com"
- family-names: "Mitevski"
given-names: "Ivan"
affiliation: "Dept. of Geosciences, Princeton University, Princeton, NJ, USA"
orcid: "0000-0001-9172-3236"
contributors:
- family-names: "Wen"
given-names: "Kaitlyn"
affiliation: "Dept. of Computer Science, Princeton University, Princeton, NJ, USA"
preferred-citation:
type: article
title: "ClimKern: A Python package for calculating radiative feedbacks using climate model kernels"
authors:
- family-names: "Janoski"
given-names: "Tyler P."
orcid: "0000-0003-4344-355X"
- family-names: "Mitevski"
given-names: "Ivan"
orcid: "0000-0001-9172-3236"
- family-names: "Kramer"
given-names: "Ryan J."
orcid: "0000-0002-9377-0674"
- family-names: "Previdi"
given-names: "Michael"
orcid: "0000-0001-7701-1849"
- family-names: "Polvani"
given-names: "Lorenzo M."
orcid: "0000-0003-4775-8110"
journal: "Geoscientific Model Development"
volume: "18"
issue: "10"
pages: "3065–3080"
year: 2025
doi: "10.5194/gmd-18-3065-2025"
url: "https://gmd.copernicus.org/articles/18/3065/2025/"
GitHub Events
Total
- Create event: 7
- Release event: 1
- Issues event: 11
- Watch event: 9
- Delete event: 5
- Issue comment event: 9
- Push event: 10
- Pull request review event: 1
- Pull request event: 13
- Fork event: 1
Last Year
- Create event: 7
- Release event: 1
- Issues event: 11
- Watch event: 9
- Delete event: 5
- Issue comment event: 9
- Push event: 10
- Pull request review event: 1
- Pull request event: 13
- Fork event: 1
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 5
- Total pull requests: 5
- Average time to close issues: about 1 month
- Average time to close pull requests: about 5 hours
- Total issue authors: 5
- Total pull request authors: 3
- Average comments per issue: 0.6
- Average comments per pull request: 0.0
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 5
- Pull requests: 5
- Average time to close issues: about 1 month
- Average time to close pull requests: about 5 hours
- Issue authors: 5
- Pull request authors: 3
- Average comments per issue: 0.6
- Average comments per pull request: 0.0
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- tyfolino (6)
- imitevski (2)
- claresinger (1)
- kls2177 (1)
- brian-rose (1)
- kaitlynwen (1)
- aurora-bf (1)
- olinke95 (1)
Pull Request Authors
- tyfolino (24)
- olinke95 (1)
- imitevski (1)
- kaitlynwen (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 178 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 6
- Total maintainers: 1
pypi.org: climkern
- Documentation: https://climkern.readthedocs.io/
- License: mit
-
Latest release: 1.1.2
published over 1 year ago