Skip to main content

Kamodo

Python 3.10 Python 3.11 Python 3.12 Python 3.13 Python 3.14

Kamodo is an open source CCMC tool for access, interpolation, and visualization of space weather models and data in python. Kamodo allows model developers to represent simulation results as mathematical functions which may be manipulated directly by end users. This general approach allows observational data to be represented functionally, through the use of interpolators. Kamodo handles unit conversion transparently and supports interactive science discovery in a low coding environment through jupyter notebooks. These features allow Kamodo to be used in other fields of study and as a teaching tool for working with real world physical data.

This repository hosts the core Kamodo libraries under a permissive NASA open source license. The core library supports function registration, composition, unit conversion, automated plotting, LaTeX I/O, and Flask-backed REST API integrations.

Space weather simulation readers are implemented as subclasses of the Kamodo base class and are developed and maintained by the Community Coordinated Modeling Center, located at NASA Goddard Space Flight Center. CCMC's Kamodo readers may be found here https://github.com/nasa/Kamodo/

Usage

Suppose we have a vector field defined by a function of positions in the x-y plane:

from kamodo import kamodofy
import numpy as np

x = np.linspace(-np.pi, np.pi, 25)
y = np.linspace(-np.pi, np.pi, 30)
xx, yy = np.meshgrid(x,y)
points = np.array(list(zip(xx.ravel(), yy.ravel())))

@kamodofy(units = 'km/s')
def fvec(rvec = points):
    ux = np.sin(rvec[:,0])
    uy = np.cos(rvec[:,1])
    return np.vstack((ux,uy)).T

The @kamodofy decorator lets us register this field with units to enable unit-conversion downstream:

from kamodo import Kamodo

kamodo = Kamodo(fvec = fvec)
kamodo

When run in a jupyter notebook, the above kamodo object will render as a set of equations:

$$\vec{f}{\left (\vec{r} \right )} [km/s] = \lambda{\left (\vec{r} \right )}$$

We can now evaluate our function using dot notation:

kamodo.fvec(np.array([[-1,1]]))
array([[-0.84147098,  0.54030231]])

We can perform unit conversion by function composition:

kamodo['gvec[m/s]'] = 'fvec'

kamodo automatically generates the appropriate multiplicative factors: $$\vec{g}{\left (\vec{r} \right )} [m/s] = 1000 \vec{f}{\left (\vec{r} \right )}$$ we can verify these results through evaluation

kamodo.gvec(np.array([[-1,1]]))
array([[-841.47098481,  540.30230587]])

Kamodo also generates quick-look graphics via function inspection.

import plotly.io as pio

fig = kamodo.plot('fvec')
pio.write_image(fig, 'images/fig2d-usage.svg')

usage

Head over to the Introduction page for more details.

Getting started

Kamodo may be installed from pip

pip install kamodo-core-official

To get the latest version of Kamodo Core, install from the NASA git repo:

pip install git+https://github.com/nasa/Kamodo-core.git

Kamodo Environment

We strongly recommend using the conda environment system to avoid library conflicts with your host machine's python.

Download and install miniconda from here. The advantage to using miniconda is that each new environment includes the bare-minimum for a project. This allows you to keep many different projects on a single work station.

Create Kamodo environment

Create a new environment for kamodo

conda create -n envkamodo python=3.14
conda activate envkamodo
(envkamodo) pip install kamodo-core-official

!!! note The leading (envkamodo) in your prompt indicates that you have activated the envkamodo environment. From here on, anything you install will be isolated to the envkamodo environment.

Loading example notebooks

If you want to run any of the notebooks in docs, you will need to install jupyter:

(envkamodo) pip install jupyter

Navigate to the top-level of the kamodo repo, then point jupyter to docs/notebooks:

(envkamodo) jupyter notebook docs/notebooks

This should open a browser window that will allow you to load any of the example notebooks.

Requirements

The core library requires:

  • python-forge
  • numpy
  • scipy
  • sympy>=1.12
  • pandas
  • plotly
  • kaleido
  • pytest
  • Flask>=3.0
  • flask-cors
  • flask-restful
  • antlr4-python3-runtime>=4.11,<4.12
  • requests
  • pyyaml

The antlr package may be necessary for rendering latex in a notebook

pip install antlr-python-runtime

Test Suite

Kamodo's unit tests are run with pytest. To install pytest with code coverage

pip install pytest pytest-cov

Then, from the base of the git repo, run tests

pytest

or check code coverage of tests with

PYTHONPATH=. coverage run -m pytest
coverage report -m

Run tests locally prior to pushing changes to GitHub.

Release files for kamodo-core-official 26.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kamodo-core-official 26.9.1
File Size Uploaded
kamodo_core_official-26.9.1.tar.gz 115.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kamodo-core-official 26.9.1
File Interpreter ABI Platform
kamodo_core_official-26.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 231.7 kB

Release files / kamodo_core_official-26.9.1.tar.gz

Download URL kamodo_core_official-26.9.1.tar.gz
Size 115.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1e6087d568f6a9afcbcace8430b41fe75e2ccef9a52863e9e2cf7cf0a9082148
BLAKE2b-256 checksum
How to use checksums
202719c49e185fed2a966455a1fdbad8b3baa1746d3a7c8df6c3571a68bf7f63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / kamodo_core_official-26.9.1-py3-none-any.whl

Download URL kamodo_core_official-26.9.1-py3-none-any.whl
Size 116.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79248edfa6fd05f1b20e681d2a41ad3bce7325cbf166b8d4e7ec90ee5b6ea864
BLAKE2b-256 checksum
How to use checksums
80112cc64e9f4851d5150c60165343750ae27a16410dc0c489232f85f45add3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

26.9.1 This release

2 release files

26.8.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page