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.7-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b75f6a8c10c0ff06e8d01a9c47ac4d5b1fcd513f712efaab11a213a180c730e |
|
MD5 | e5ac4ca45b735674547f6a2c76ea6fda |
|
BLAKE2b-256 | 66553e613b25d9c2eeb8108348b7075570eca36e05669e8e09c4b61c6a94c6a7 |
Hashes for PyPartMC-0.0.7-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d02dcd8e90ca57df1688c9a67d14eae1636bd6aa8b7ab6a7fa4ba295dcab5c49 |
|
MD5 | 1ed3197c1b06120dc3bdcc9975727fef |
|
BLAKE2b-256 | 85abb67b4af4af2ed508a2016ae86d199812a400990090d1ae31592d5d3f6948 |
Hashes for PyPartMC-0.0.7-cp310-cp310-macosx_12_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97733542c91134931ba6afc77a61244c0f90a96a33b01e0677c0df13c63fdcc1 |
|
MD5 | 1c80291f10b2f4389ca1576d979c1757 |
|
BLAKE2b-256 | 862be32321658ec1956bd7e9c92da6f5126b8c7d272ba3731dc7924177bef19d |
Hashes for PyPartMC-0.0.7-cp310-cp310-macosx_11_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cdb3cfe776d34a70ea852d2748e58b55d2344e90a8b58f117d07d64ec8e7a5f |
|
MD5 | 88de113183b686c1c33689550eb9d49d |
|
BLAKE2b-256 | a85dfa5b80661f043e755e901161c0cb31205d72c6256cc714b947338f7fec36 |
Hashes for PyPartMC-0.0.7-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd708c44e58f480e04e208c22b18b6e2106a20baf5a93f820a0e53e61fae6deb |
|
MD5 | 088892754ce10d057433f4da0a33d230 |
|
BLAKE2b-256 | fae31dc6021d17f263569b800496a6c6c550b33f30df8807b2ac9c510a79174e |
Hashes for PyPartMC-0.0.7-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5aaba0ab99fba2027c954e0283216071cf31b44870e4787f8fd97af2adf7f27 |
|
MD5 | 276e5bea9bbbc442aa4f12027347702f |
|
BLAKE2b-256 | 03498a28666fc79452b6c4aefca6fd9f4a930ce587a5532fb7f44af452540ab9 |
Hashes for PyPartMC-0.0.7-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9d553238c4e9b0eb6fce49206e5a748c74db59f08d0befdd30c8023d2596fee |
|
MD5 | bfa1caa49630f184de4e1905e5d0c528 |
|
BLAKE2b-256 | b0047beced92fccd028a9a4b6dd1dd85d8b4186d7ec7435e143da6548db9cbdc |
Hashes for PyPartMC-0.0.7-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0898799cc287df95c6d91a2225ee3c53b7e19b6301921aa7c1f06431247c2fbe |
|
MD5 | ef9dfbb3107ee73988e86f2cc185987d |
|
BLAKE2b-256 | c87bd55d2697bcc6de9fd58fe66ad47a87f9e6127af41b0da68dfed2c84b5a2e |
Hashes for PyPartMC-0.0.7-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b00176527ab4a9ff372069ab8f8f147ff83e80508b82f57a76aa72f334b157e |
|
MD5 | 1a48813a736517f3108cfde6e1e87108 |
|
BLAKE2b-256 | 98066568f28802c3ac2e4aa3b4cf95de5f8a39fa22a1cf421cc050d98e09f6f3 |
Hashes for PyPartMC-0.0.7-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9404f6eca6c7a81f2c0a7ed059448545488807e23dc263ee1f3877f969278b0 |
|
MD5 | 69386b48eec006cf4a5dcb9dcf0e6dde |
|
BLAKE2b-256 | aad3bac48cd5bec74d69bb625fb30fe5f2acd134d9a6aee80d6895e90b0a6ac9 |
Hashes for PyPartMC-0.0.7-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc65b04df476604c30e0618d970df6a05471a811437ffff066e8232846a73bdc |
|
MD5 | f25e6ddac18f357cb402db1e29b63bde |
|
BLAKE2b-256 | d00d8bd8c6cda85bcadb5d300f696a43f1ae66a227432690d47e6c664bd23ec2 |
Hashes for PyPartMC-0.0.7-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a629010ee23685799c27d666466497878d9556737a5a21a6bf645f8be9647247 |
|
MD5 | 60aa5bfacdb5b1b2a4671cbf51ddf662 |
|
BLAKE2b-256 | e27fb27d2840d42318ed49ce8b2e32d3cde0f24a432cd7ecc10b82d912691c2d |
Hashes for PyPartMC-0.0.7-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d1af1e26658851fb928b28b1cb3ac39271b89b555077ad6c99f674ad61f4cbd |
|
MD5 | 56cd52c017fda63af317dd721bf880e7 |
|
BLAKE2b-256 | 376c45c7ec4e1eb7ab6aeb78dfc0e0f87732dfb8ea80a347e52de54793c06dd0 |
Hashes for PyPartMC-0.0.7-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d3ddd2915f1ef07baad27ac7100df34fa950b8b5aaaa5a6c95cf97f1a41a690 |
|
MD5 | 3be2e944f4b9feec5028a28b98839055 |
|
BLAKE2b-256 | 595257aa7317cbb79b9f20eef9359494e104416fe65637e1b428e10516c1c6af |
Hashes for PyPartMC-0.0.7-cp37-cp37m-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59e4f56c93f230c217d99d93f42fbe3f3b4ac59ae09aa0fa87759a8187726baa |
|
MD5 | 9ed9ea2ed18ec5e293c50de284b67f0e |
|
BLAKE2b-256 | 47bb78ff0fc2544ece3367aa1147c667a8c42028643e9e7870fbbac2d8d65646 |
Hashes for PyPartMC-0.0.7-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5df7e2ff72b161b5d19ef31971375ce021b28bb7263a82082231e8ef05cd6a9c |
|
MD5 | cf1aaee1e2d56ffdd3bc997ab6004e51 |
|
BLAKE2b-256 | e5603e7a0891b6a4acefbdde4f710cf098d80e0e023c7e389e83b73e5a28acc4 |