Skip to main content

Python interface to PartMC

Project description

PyPartMC (pre-alpha!)

PyPartMC is a Python interface to PartMC, a particle-resolved Monte-Carlo code for atmospheric aerosol simulation. Since PyPartMC is implemented in C++, it also constitutes a C++ API to the PartMC Fortran internals; the Python API can be used from other environments - see, e.g., Julia example below.

US Funding License: GPL v3 Copyright Maintenance Github Actions Build Status API docs

TL;DR (try in a Jupyter notebook)

Python 3 Linux OK macOS OK Windows OK Jupyter

! pip install PyPartMC
import PyPartMC

Features

  • works on Linux, macOS and Windows (compatibility assured with CI builds)
  • hassle-free installation using pip (prior PartMC installation not needed)
  • works out of the box on mybinder.org, Google Colab and alike
  • ships with a set of examples maintained in a form of Jupyter notebooks
  • Pythonic API (but retaining PartMC jargon) incl. exceptions and GC deallocation of Fortran objects
  • code snippets in README depicting how to use PyPartMC from Julia (also executed on CI)
  • auto-generated docs on the web
  • support for [de]serialization of all exposed structures using JSON
  • based on unmodified PartMC code
  • does not use or require shell or netCDF Fortran library
  • aiming at 100% unit test coverage

Usage examples

example object instantiation in Python

import PyPartMC as ppmc
print(ppmc.__version__)
gas_data = ppmc.GasData(("H2SO4", "HNO3", "HCl", "NH3", "NO", "NO2"))

example object instantiation in Julia

using Pkg
Pkg.add("PyCall")

using PyCall
ppmc = pyimport("PyPartMC")
print(ppmc.__version__)
gas_data = ppmc.GasData(("H2SO4", "HNO3", "HCl", "NH3", "NO", "NO2"))

Jupyter notebooks with examples

See the PyPartMC-examples project.

usage in other projects

PyPartMC is used within the test workflow of the PySDM project.

Implementation outline

Troubleshooting

Common installation issues

error: [Errno 2] No such file or directory: 'cmake'

Try rerunning after installing CMake (e.g., apt-get install cmake or brew install cmake)

No CMAKE_Fortran_COMPILER could be found.

Try installing a Fortran compiler (e.g., brew reinstall gcc)

warning: no files found matching 'gitmodules/...

Since git clone was done without recursive option, try: git submodule update --init

How to debug

git clone --recursive git+https://github.com/open-atmos/PyPartMC.git
cd PyPartMC
DEBUG=1 VERBOSE=1 pip --verbose install -e .
gdb python 
(gdb) run -m pytest -s -vv -We -p no:unraisableexception tests

Credits

PyPartMC:

author: Sylwester Arabas et al.
funding: US Department of Energy Atmospheric System Research programme
copyright: University of Illinois at Urbana-Champaign
licence: GPL v3

PartMC:

authors: Nicole Riemer, Matthew West, Jeff Curtis et al.
licence: GPL v2 or later

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyPartMC-0.0.4.tar.gz (876.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

PyPartMC-0.0.4-cp310-cp310-manylinux_2_24_x86_64.whl (948.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64

PyPartMC-0.0.4-cp310-cp310-macosx_11_0_universal2.whl (474.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ universal2 (ARM64, x86-64)

PyPartMC-0.0.4-cp39-cp39-manylinux_2_24_x86_64.whl (948.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.24+ x86-64

PyPartMC-0.0.4-cp39-cp39-macosx_11_0_x86_64.whl (474.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

PyPartMC-0.0.4-cp38-cp38-manylinux_2_24_x86_64.whl (948.5 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.24+ x86-64

PyPartMC-0.0.4-cp38-cp38-macosx_11_0_x86_64.whl (474.1 kB view details)

Uploaded CPython 3.8macOS 11.0+ x86-64

PyPartMC-0.0.4-cp37-cp37m-win_amd64.whl (551.7 kB view details)

Uploaded CPython 3.7mWindows x86-64

PyPartMC-0.0.4-cp37-cp37m-manylinux_2_24_x86_64.whl (951.2 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.24+ x86-64

PyPartMC-0.0.4-cp37-cp37m-macosx_11_0_x86_64.whl (473.3 kB view details)

Uploaded CPython 3.7mmacOS 11.0+ x86-64

File details

Details for the file PyPartMC-0.0.4.tar.gz.

File metadata

  • Download URL: PyPartMC-0.0.4.tar.gz
  • Upload date:
  • Size: 876.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for PyPartMC-0.0.4.tar.gz
Algorithm Hash digest
SHA256 1750768e44347db6a45c80712386b5b82b987ac71bbce253af6f6fda8684bc2b
MD5 cb1e8bf3b55515535c179db561376a79
BLAKE2b-256 a205aec8ef4fdef7725c8f71c9ebb67cda4181b98ce6daa01955814ca7f0f42e

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.4-cp310-cp310-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.4-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e90d515bcf3f6f384e6c41711cdf85f1c90bc6ab808923c744e4b6b64305c3a3
MD5 84f83986e184a66a738c5badcf1b4c36
BLAKE2b-256 5477a2ebc640912f40f03356cb45b7794e39d87e5ea9fa4b649ac4c85f638195

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.4-cp310-cp310-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.4-cp310-cp310-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 2f89c39afaf3b52dce5d7263c450b315821ca276703f39ab6510db837e7a39f1
MD5 19b31e924dfcd760e0bd6601bccfc79e
BLAKE2b-256 46699832c3e6efaba764dab84422814ac2b0f4182b9c2949286a133c2405ab61

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.4-cp39-cp39-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.4-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 8e45c076454d8cb5c4173a4d541ec789412da79870927b32e603067b62c3e807
MD5 d8a2f82b10621065ca1734de8496d0db
BLAKE2b-256 11ab300d9266273c2c874cdab7e967d640806c520399d7cac3e0640724698d4b

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.4-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.4-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1b400d63d09c28103009dc7548e1b1a118af1ebc4d781bfdbb9c027e6fc68aa1
MD5 b7c5a7d29caa341c2072895d3fbb4080
BLAKE2b-256 bebaea559f53f3e9efc1d66213bf2348ccba7093d416ec58eed3234d086f2989

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.4-cp38-cp38-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.4-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7d43175c2b3340193344b9102c5f918f3ccaf3e78faee4e80b2e0752faf479e9
MD5 586f3d11120defc0933a7de1fa846ad0
BLAKE2b-256 21f5854708c98cc020664ceee59a57415a62860e96f838c30e8f42c1d07839cc

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.4-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.4-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 b8ee8edc0ef917adbaf08bdff9038b4b20a6c991a6e1ca608a0d23816f81271d
MD5 6878f0b943ae43013fbd8181fb2d80e0
BLAKE2b-256 6e64c16abceb58c1de0702331f9a0aa5ff9a5c8ea47e34a2b494c47e1bb893ec

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.4-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: PyPartMC-0.0.4-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 551.7 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for PyPartMC-0.0.4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 3d9eac5d88f452621ba0936a8cce11e975538ac4159e818caa46b5a59c2b8dc0
MD5 f6d0095fff16dbf0c4c74a7f625ca48d
BLAKE2b-256 0d8a282f8ffa1bd867006973633646ce9febed98973e277c3b059b68091f02cc

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.4-cp37-cp37m-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.4-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 c28b61f71b707c6aace10c40b486a2b38be89c1ad0e404ef29c82866631d271c
MD5 a1468886df26af7ffa6f54fb3d326c6a
BLAKE2b-256 2faf882282438210ebddf4a57cc28b30a27cd2a9f22294e007ad159f564699a2

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.4-cp37-cp37m-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.4-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 270a73299aececb427470db32a562ade166041a371d2cc75de00d146f9000719
MD5 23ea23c685d584cc40327e53394c4709
BLAKE2b-256 a4688547eba033533bd04e411db6eca0ab1a5366a7cf3325217e983a6d8d664f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page