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.6-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95239ab12be1520659c1c002b08c3b1ef41daacd47dbf04367b48cb1d9db9b3c |
|
MD5 | 11f93eb8eff674d6d1024da7d7e52afd |
|
BLAKE2b-256 | eb48020ae6d818c634ea663752e1029272219ccdc381503da66095305e547d49 |
Hashes for PyPartMC-0.0.6-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 137615c32d2fc2a974357633de53ecabcd0167e1aadcab03cd64eb190560c07b |
|
MD5 | e55156e9704b8b2094964e6c759633ed |
|
BLAKE2b-256 | 919a4a51fcb8071c4e22bc35b322a652dced03da798ff266bab9001c134c1421 |
Hashes for PyPartMC-0.0.6-cp310-cp310-macosx_12_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ab327f59760bfd0e4bcf4ce400d421eaf61332e8569c0f6ca6aa9f9b54e291e |
|
MD5 | b0cd93afc04a6d3d8f488f09415fba6e |
|
BLAKE2b-256 | 8975bfcc16fbc7ea6323360898be140a8607bb7be87b51e7b36ac30d15fe097d |
Hashes for PyPartMC-0.0.6-cp310-cp310-macosx_11_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d7530dc3517481e5a9139b23b6c2262953da379aa7083ca9668da0a340d199b |
|
MD5 | 3345e97c08268af564d23e826c88603e |
|
BLAKE2b-256 | 37ef9d770204b062ee34a6589e7478a32243f043bb15419588f93f69f023a39a |
Hashes for PyPartMC-0.0.6-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ab406100b50155a578f75334b9eccf89441156f51bebcd3df93272500d0fd11 |
|
MD5 | 2606f36fb6c545a613911adccb6f8cd7 |
|
BLAKE2b-256 | 724f49c0fc8450fec65f63434766976948334c56a4698e212cca1a655da93207 |
Hashes for PyPartMC-0.0.6-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6ca595322d865800b5e54c0c10f81f59cb9f32ec4bce02d29584c3553580f54 |
|
MD5 | 11445f8df7b50aa6a2d0b1a6280f1121 |
|
BLAKE2b-256 | ec7dbc1dd9a4a9b3b58f9ac18aae599a0a1f75ec69d039a1749435f946a90196 |
Hashes for PyPartMC-0.0.6-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f67ca64f86b8d9875a12790cdb9eec2988776b0c364aaad890a00c9131d84a3b |
|
MD5 | d85e391b4081c4c41f869c45390f5500 |
|
BLAKE2b-256 | e15c3aa397939948692107a7be3b6125727d752abcf3992f97a46231fd01ff89 |
Hashes for PyPartMC-0.0.6-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf343d42cd9b7bacb6cc207de315e6e2dde80054ed72c6d8bf98669699490722 |
|
MD5 | 2eaa3eec5d0f83e9ee4aebc15ae5673c |
|
BLAKE2b-256 | 7c89aad1b4f85f539f8b011b0f1b85cb6b6e6ab756301f2ba8e7f09bfb505e24 |
Hashes for PyPartMC-0.0.6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b45d1ebe121e24a370dcaeb765ed6dbc53bde308856d6de410f6f15b6d3943a |
|
MD5 | c1707201fe815874864fdb0192e9f388 |
|
BLAKE2b-256 | bff0bec9e65434f81801cf8761b9165b64ff295146a04c41420325045014f350 |
Hashes for PyPartMC-0.0.6-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef63b11dd91ec879292d9870a42a8b50539307418081624e84faa844848a6e78 |
|
MD5 | ce6a16518fc401d685d2fd3bcb877124 |
|
BLAKE2b-256 | 257420933b67f017286bd220aa791921dfbe9b226d541ccaf49781e02b488c69 |
Hashes for PyPartMC-0.0.6-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7faf7e010f7500ac812bf6e65a3668d909e2865f4acc2279fc9bbf23685c5cd2 |
|
MD5 | 43442add001db7a630d67335aefb4bdc |
|
BLAKE2b-256 | 101fd20ebac78da9290a08e791123c1790652b91e0c0f19429f38789ff4c1b79 |
Hashes for PyPartMC-0.0.6-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4fc83cd1b1cc87b9e2bc2a8db27a8043128abda5742f9fa3f22b5804db3ad6c |
|
MD5 | 29c28025050f434b9d2375cf009b5292 |
|
BLAKE2b-256 | f03fad4f3f4eeec1d1699d91b264d303ac62a0bac4d25ff39149253008884b76 |
Hashes for PyPartMC-0.0.6-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a72c65867f3e11d0aaac385b9a3c1ab10df5be856743b34b0bd207e774c5466e |
|
MD5 | 22cf22ecb5b2b4d5a838172d80c1f4e2 |
|
BLAKE2b-256 | 774d004db6a5e78664ecd5dcee7d2b02dee9acea4186d62cc0a208bea9e4cb71 |
Hashes for PyPartMC-0.0.6-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4521997433b6a94bd586941b80ec8c254fcad26b11aca3608714116b217693d |
|
MD5 | 0b40ee180e4da672b6d9c21aeaeb56d6 |
|
BLAKE2b-256 | b2175e779e21172fcb1f6c1475fce51ee6666e687b4d9369757d2f0aae8d50b1 |
Hashes for PyPartMC-0.0.6-cp37-cp37m-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 246e5c2c7f9027358a640c9c2da9a8b749b99f4fe3ba5cfa3f9e40ff1afaa76c |
|
MD5 | 5dcf11b8192c8b0ad710034b4088c4b2 |
|
BLAKE2b-256 | 483b2f202833e1e89936e201733b250ad7204a592444fba6b6ad04d9d4ef89cd |
Hashes for PyPartMC-0.0.6-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d3e3e76890e6e73bdc77086e3ac8d77e0f590941a7919894ede38215b5311e9 |
|
MD5 | 3790fb56a7e0c9491ceb7d563887a4a2 |
|
BLAKE2b-256 | bc0b3f6ff0c4366d7fc918b5caf781b7ab7aec70f27f43bc270c22c627262e32 |