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.
TL;DR (try in a Jupyter notebook)
! 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
- PyPartMC is written in C++, Fortran and uses pybind11 and CMake.
- JSON support is handled with nlohmann::json and pybind11_json
- PartMC and selected parts of SUNDIALS are compiled during
pip install
and statically linked - C (SUNDIALS), C++ (pybind11, ...) and Fortran (PartMC) dependencies are linked through git submodules
- a mock of Fortran netCDF API and a mock of PartMC spec file API are used for i/o from/to JSON
- a mock of Fortran MPI API is used for error handling using existing MPI API calls within PartMC
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
Built Distributions
Hashes for PyPartMC-0.0.8-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8184da63e51caf755afa2be6eac17a9f9ef0c6528eb551670c7852536d87a36 |
|
MD5 | d367e6400b3581b21f4f0576d9f0ba2b |
|
BLAKE2b-256 | acb764de1571d21a70958756b358953d4e4fd58c99216999672469be10155739 |
Hashes for PyPartMC-0.0.8-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ff212ea4bede4b965129531fc1d75d0e72296782f55861a67ed534e48ada43e |
|
MD5 | 48a42a05c01450321ba9c41d7061d503 |
|
BLAKE2b-256 | b0b356f6923c7c12f7fd88a078a1572dab73946ee962254657e1648cdfa68a81 |
Hashes for PyPartMC-0.0.8-cp310-cp310-macosx_12_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6559eec6dcb873a75f1bb57510d876effc108d89161cd03a6057021c22cef34 |
|
MD5 | fa35c626a6035915e2fddd6c505a6e89 |
|
BLAKE2b-256 | bca36548eaa04cfc7a8677ecb5e6bb8552c09156f857c215622b01e11fe2e9b1 |
Hashes for PyPartMC-0.0.8-cp310-cp310-macosx_11_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40ad5e3257c9906c54d5cc734ea155a73c8354caff74191a9c40a5adf60badc2 |
|
MD5 | 06e472178ee562a810b98dc11204aec3 |
|
BLAKE2b-256 | ee14bfb2bb03059e9e6b7ffa94d202571723441e309804f2e062ee8601f2ede1 |
Hashes for PyPartMC-0.0.8-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd5c37d8f2f3e5a914f56d1b55002f34d80234bb437857274829a6c4e0446979 |
|
MD5 | 6c4dbe5374d54c880a34618fb25d4383 |
|
BLAKE2b-256 | ad3bf05e70fa4fb8453da2de31f8b33af7813e7b3283f862d8bb4c004e103bd5 |
Hashes for PyPartMC-0.0.8-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fea908bb9cd1132997addf3fb85e649d81b21e5e04cf05e14f35b898cb3addb4 |
|
MD5 | ffb830194d1cfbb32e35942e3dec9266 |
|
BLAKE2b-256 | 901955ab5fb83b395cc9f248e473c65a196d9038cbb6c29672d6d50f2d026c3b |
Hashes for PyPartMC-0.0.8-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24a06ba99ca1c2d25dce5463c8157b23350aac7951df586b2cca5a17c35072a5 |
|
MD5 | 251369cd8f52a69d674ff72a3e67f0ca |
|
BLAKE2b-256 | 2a1a22b4c5bbd25bb5b7ba91e12f5f1db9dbe63f104c4aa7d58f3a39baa57f0c |
Hashes for PyPartMC-0.0.8-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bf9d8c11c50d6d6b7af3ffd9eafa3ad5b964304883a649bd0d8858e5cd4fcdb |
|
MD5 | a39afbd94bc955f72ba9e4d179190776 |
|
BLAKE2b-256 | dede31b7fa737a4c079800183b55930f19cb7eada352deb2d204ce3354ce9146 |
Hashes for PyPartMC-0.0.8-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0f0cfe6459f16c073fb3abdc0385b17ba8bc34716a96736a1040377cc2e831c |
|
MD5 | 61aeebd597945b31a202dd0d3b7cab1d |
|
BLAKE2b-256 | a20d80ec51e7b217318c1e908d0037976bd90ac3d91b55f45147f03c7ce23077 |
Hashes for PyPartMC-0.0.8-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2253fa42f0d974a4a1f2bbfc87f9cdbaf31b0e260dc2850a6176a327f70effa |
|
MD5 | 401149bbf6adfc13d2fa4689c5e2fe9c |
|
BLAKE2b-256 | 4521ad1821638ba501f32be2619de7293fc2d1e723e886d898062ad8794c38d0 |
Hashes for PyPartMC-0.0.8-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b5533b5a7c3c25d5b9ef7b6025765081ecc5b52d5259bfeb007f19d21e73936 |
|
MD5 | f024ecba940b9026f046b272b93bc872 |
|
BLAKE2b-256 | 3c20d8c2f207b6be407ab9c3380a2c6548ac4f00b324f840b0e42ec1cf1228d4 |
Hashes for PyPartMC-0.0.8-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 762b0be1fcd7ef3de7a8903effdf7ccc9e508fc32b26a7861b3f6590c3e8b2dc |
|
MD5 | cafa67b4e5b77a3179b65615932e0f5e |
|
BLAKE2b-256 | 127e32fbf749a9bb9b09524cc5549e705a858f8c3c7c400fc61b75786bc8cbae |
Hashes for PyPartMC-0.0.8-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87d5931284e1900eaf4eb894cbdf1a2ce79868e2e012e5b73fc3b259b68c468c |
|
MD5 | bd365e2cde7bf4162fce50d5f83f8a92 |
|
BLAKE2b-256 | 6dda9a760651a64d814410fdd324e3b1506c32a657a2f5ce8681c42f55ac1fef |
Hashes for PyPartMC-0.0.8-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbd4d19818d5598c48d22e56a9e47575ffb19062d15b895f5a3d485dc94258a0 |
|
MD5 | faf80f4ee25b65e1c36ad5e54353ed28 |
|
BLAKE2b-256 | f734559919a76d480d7e874a450bd634436bffa35911b322b211f3dc405ae873 |
Hashes for PyPartMC-0.0.8-cp37-cp37m-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af7a1e89c3e426914e9ac5712392550313cc1855732612995b7f45fa5a847812 |
|
MD5 | 0c936b8967d657480c090fa74c40fc22 |
|
BLAKE2b-256 | 92b76388065ef5d8de336d04eea1dcce17d6188857fb1c1f3447b71d20f0f29a |
Hashes for PyPartMC-0.0.8-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce4fd6674e7507eade49748690e145badcf7c0169eb772c0875961b6ea076ac1 |
|
MD5 | 0b36ba4d71b7849eb92ea2f551136010 |
|
BLAKE2b-256 | 24a8b0be727464b53a0cd77234889fd96ec683eb2125eaf624abefdaaa26eb7e |