Skip to main content

Python interface to PartMC

Project description

logo

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)

Notes for developers

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

Pre-commit hooks

PyPartMC codebase benefits from Pylint, Black and isort code analysis (which are all part of the CI workflows where we also use pre-commit hooks. The pre-commit hooks can be run locally, and then the resultant changes need to be staged before committing. To set up the hooks locally, install pre-commit via pip install pre-commit and set up the git hooks via pre-commit install (this needs to be done every time you clone the project). To run all pre-commit hooks, run pre-commit run --all-files. The .pre-commit-config.yaml file can be modified in case new hooks are to be added or existing ones need to be altered.

Credits

PyPartMC:

author: PyPartMC developers
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.29.tar.gz (1.4 MB 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.29-cp311-cp311-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.11Windows x86-64

PyPartMC-0.0.29-cp311-cp311-manylinux_2_24_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64

PyPartMC-0.0.29-cp311-cp311-macosx_12_0_universal2.whl (907.0 kB view details)

Uploaded CPython 3.11macOS 12.0+ universal2 (ARM64, x86-64)

PyPartMC-0.0.29-cp310-cp310-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.10Windows x86-64

PyPartMC-0.0.29-cp310-cp310-manylinux_2_24_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64

PyPartMC-0.0.29-cp310-cp310-macosx_12_0_x86_64.whl (907.0 kB view details)

Uploaded CPython 3.10macOS 12.0+ x86-64

PyPartMC-0.0.29-cp39-cp39-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.9Windows x86-64

PyPartMC-0.0.29-cp39-cp39-manylinux_2_24_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.24+ x86-64

PyPartMC-0.0.29-cp39-cp39-macosx_12_0_x86_64.whl (907.1 kB view details)

Uploaded CPython 3.9macOS 12.0+ x86-64

PyPartMC-0.0.29-cp38-cp38-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.8Windows x86-64

PyPartMC-0.0.29-cp38-cp38-manylinux_2_24_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.24+ x86-64

PyPartMC-0.0.29-cp38-cp38-macosx_12_0_x86_64.whl (907.1 kB view details)

Uploaded CPython 3.8macOS 12.0+ x86-64

PyPartMC-0.0.29-cp37-cp37m-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.7mWindows x86-64

PyPartMC-0.0.29-cp37-cp37m-manylinux_2_24_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.24+ x86-64

PyPartMC-0.0.29-cp37-cp37m-macosx_12_0_x86_64.whl (903.3 kB view details)

Uploaded CPython 3.7mmacOS 12.0+ x86-64

File details

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

File metadata

  • Download URL: PyPartMC-0.0.29.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for PyPartMC-0.0.29.tar.gz
Algorithm Hash digest
SHA256 de629d6291898b71eedbde6a6bea953dddf259787a2ee6e0a62dc381da390446
MD5 d1e1c97d2d47cf1c1bb5ffa9b3657051
BLAKE2b-256 bb8dc1dca4b2dbe4821d981cc207d725040c5e7c3de17ff456b19481497a2685

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.29-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: PyPartMC-0.0.29-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for PyPartMC-0.0.29-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b70a5e1f8f4ce5182beb2c04566b3a0aec0207bad6113365e1d6107349307467
MD5 3b73ae4785e64672726b443ae53e5858
BLAKE2b-256 33bda93cbd822b1e2e8a878da16fbfcaf3d96ad8b754bd6c690f9f25123ce04c

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.29-cp311-cp311-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.29-cp311-cp311-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 a75950c7e17be197e59aca97a46de7b6c1e2ddcd759ff953f172e39e15e0cbc8
MD5 6dfa37d4446d6a00f7d049bb01628957
BLAKE2b-256 b02e51a1855d1d928ea088c58188ed3cc4ffdf8526c17c7e7487ae19e01998c1

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.29-cp311-cp311-macosx_12_0_universal2.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.29-cp311-cp311-macosx_12_0_universal2.whl
Algorithm Hash digest
SHA256 877ed65cad9221749cd39f991f86721bed441472440873c2fcb3a46e97e6afd6
MD5 9d37aaf6336c47e61fee63ee4266774f
BLAKE2b-256 a21005c92e7c1876ba0ebd623da74b42cd1fd8ed8fd8ee7630f4b1eb1b30150f

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.29-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: PyPartMC-0.0.29-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for PyPartMC-0.0.29-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bdcb82bb89ede6530d9df40bc040c707929805e1e9cbd1b4103519d304120e06
MD5 85a8bb0191c908660a10bdb49c75dbed
BLAKE2b-256 57fce99d90f25e36e84074e286333277272988e4c26fb5bdbc0df7f701d10868

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for PyPartMC-0.0.29-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 960eed35938934d60b3060efc1e94aa18a36493b157fe0cd4b9bc584c7488905
MD5 cd2ae8deca61e549ff74145e507123d2
BLAKE2b-256 794f76f634ea6d393ebf1bb3bcabb5095976091c914d1d805758dda7720d6abd

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.29-cp310-cp310-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.29-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 6cb75d4a70d7717c055c091d94525f92721b5ad0c3853745e3c7c4dc41336744
MD5 fde98938314c43863c3c18a953c979ab
BLAKE2b-256 54b23212b876dd2d061ad495de54faa3566bbabc52f27bedf92bce3c59cfb914

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.29-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: PyPartMC-0.0.29-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for PyPartMC-0.0.29-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 7b603a4bba8df8642760dbd89808132e1aadc6b49c5822f4052d4bcb3760a672
MD5 8e4f71cd8b0b4cb4e1f6018a622bdc93
BLAKE2b-256 15c402cbf8213362c1f4436e53c80b0f642a479babe25a23053b6d9a6120195b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for PyPartMC-0.0.29-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 adcd3d2b15fb7bc8d07f1e265ff5348a4cdab42f494335371288b15640d61de0
MD5 868556e4c55b34ed7cd31837620762af
BLAKE2b-256 f973e59c39c580bc279fd7f30faaa589eb795c33ce567de9eb7cdfa6b310d5aa

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.29-cp39-cp39-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.29-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 81b62128dd9fce75a359e0fd7a204c8b70ca670fffe44f44fd7c1f7b7a68c1bf
MD5 ba84b85d24b2c721d9e853d9c00c7237
BLAKE2b-256 edf8db65b1b0e3660db0c8e989e26549c81737affd9f6c5423fd181779e01067

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.29-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: PyPartMC-0.0.29-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for PyPartMC-0.0.29-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ba7d006055dfde92cc12afdebe467caef025bfd74b3b6dee7e34731d95d124c4
MD5 b53025d9fb5ecd420297aa6427f0dd58
BLAKE2b-256 d81642f800b1e31f488c55c0d025fa56d9cf778433376c1d36e121a95125a23b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for PyPartMC-0.0.29-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 fe76b2f93a3030a9c945917f154f9be5e1995c3d0b999fcaf6116ba6e49e0628
MD5 07ed468fd97bf090d5518a2b8025caa7
BLAKE2b-256 c4a5f54bb31af501f0c21873b294343b0432035cea20bb9bf5c32f5edb9c7c05

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.29-cp38-cp38-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.29-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 5f9bf144a23161ee9c7bb8c0acaa028bf9e0db20cab70362b515646a915da77f
MD5 ac8364086729a3955a8f34abfce78aee
BLAKE2b-256 ef567760ecbca0884d0ac5d62fb8d0c9ef68f441a26e836de0442c41259ba7f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: PyPartMC-0.0.29-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for PyPartMC-0.0.29-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 012f0451437a8ecc0645bd65176bd1bd87ccad600e1010072862df9438bfa543
MD5 f8a09433edd5357c607cf0d71796affc
BLAKE2b-256 ee6234f9209bf9bdc106f804218b57e31ae43b955acbac7f13f8147eb43b5b9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for PyPartMC-0.0.29-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 78699aaff87e9e3eb680fb67ddaf4037b1ce928d7f8db8546790d0ccd1bd30f8
MD5 ad967f6462791ce25e1e7faaf6fbebc4
BLAKE2b-256 73c71fd16a54be96069c8dcb43ec16b2a01ab76072036420df7f4a8b178e02c9

See more details on using hashes here.

File details

Details for the file PyPartMC-0.0.29-cp37-cp37m-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for PyPartMC-0.0.29-cp37-cp37m-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 1731e195c8a0639030780913e901eb726a25ac004c8acf655b2fedbc9b0b1eba
MD5 a66e756a5aa8cc3e394de712b225198f
BLAKE2b-256 c5f3feaccafd2aaf506cf6fff72919d5a416b2d43d2a66c73dcab538901b9110

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