PyPartMC 0.7.1__cp311-cp311-macosx_14_0_arm64.whl → 1.3.6__cp311-cp311-macosx_14_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of PyPartMC might be problematic. Click here for more details.

PyPartMC/__init__.py CHANGED
@@ -1,3 +1,7 @@
1
+ """
2
+ .. include::../README.md
3
+ """
4
+
1
5
  # pylint: disable=invalid-name,wrong-import-position
2
6
  import os
3
7
  from collections import namedtuple
@@ -24,23 +28,51 @@ def __build_extension_env():
24
28
  cookie.close()
25
29
 
26
30
 
27
- # TODO #113: 2 x loop over prefixes and units
28
- si = namedtuple("SI", ("m", "cm", "um", "nm", "kg", "g", "s", "K", "Pa", "hPa", "mol"))(
29
- m=1.0,
30
- cm=0.01,
31
- um=1e-6,
32
- nm=1e-9,
33
- kg=1.0,
34
- g=1e-3,
35
- s=1.0,
36
- K=1.0,
37
- Pa=1.0,
38
- hPa=100.0,
39
- mol=1.0,
40
- )
41
- """ TODO #113 """
31
+ def __generate_si():
32
+ prefixes = {
33
+ "T": 1e12,
34
+ "G": 1e9,
35
+ "M": 1e6,
36
+ "k": 1e3,
37
+ "h": 1e2,
38
+ "da": 1e1,
39
+ "": 1e0,
40
+ "d": 1e-1,
41
+ "c": 1e-2,
42
+ "m": 1e-3,
43
+ "u": 1e-6,
44
+ "n": 1e-9,
45
+ "p": 1e-12,
46
+ }
47
+ units = {
48
+ "m": 1e0,
49
+ "g": 1e-3,
50
+ "s": 1e0,
51
+ "K": 1e0,
52
+ "Pa": 1e0,
53
+ "mol": 1e0,
54
+ "W": 1e0,
55
+ "J": 1e0,
56
+ "N": 1e0,
57
+ }
58
+ return namedtuple("SI", [prefix + unit for prefix in prefixes for unit in units])(
59
+ **{
60
+ prefix_k + unit_k: prefix_v * unit_v
61
+ for prefix_k, prefix_v in prefixes.items()
62
+ for unit_k, unit_v in units.items()
63
+ }
64
+ )
65
+
66
+
67
+ si = __generate_si()
68
+ """ a utility namedtuple aimed at clrifying physics-related code by providing
69
+ SI-prefix-aware unit multipliers, resulting in e.g.: `p = 1000 * si.hPa`
70
+ notation. Note: no dimensional analysis is done! """
42
71
 
43
72
  with __build_extension_env():
44
73
  import _PyPartMC
45
74
  from _PyPartMC import *
46
- from _PyPartMC import __all__, __version__ # pylint: disable=no-name-in-module
75
+ from _PyPartMC import __all__ as _PyPartMC_all # pylint: disable=no-name-in-module
76
+ from _PyPartMC import __version__, __versions_of_build_time_dependencies__
77
+
78
+ __all__ = tuple([*_PyPartMC_all, "si"])
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPartMC
3
- Version: 0.7.1
3
+ Version: 1.3.6
4
4
  Summary: Python interface to PartMC
5
- Author: Sylwester Arabas
6
- Author-email: sarabas@illinois.edu
5
+ Author: PyPartMC team (see https://github.com/open-atmos/PyPartMC/graphs/contributors)
6
+ Author-email: nriemer@illinois.edu
7
7
  License: GPL-3.0
8
8
  Project-URL: Tracker, https://github.com/open-atmos/PyPartMC/issues
9
9
  Project-URL: Documentation, https://open-atmos.github.io/PyPartMC
@@ -13,10 +13,11 @@ Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
14
  Requires-Dist: numpy
15
15
  Provides-Extra: tests
16
- Requires-Dist: pytest ; extra == 'tests'
17
- Requires-Dist: pytest-order ; extra == 'tests'
18
- Requires-Dist: fastcore !=1.5.8 ; extra == 'tests'
19
- Requires-Dist: ghapi ; extra == 'tests'
16
+ Requires-Dist: pytest; extra == "tests"
17
+ Requires-Dist: pytest-order; extra == "tests"
18
+ Requires-Dist: fastcore!=1.5.8; extra == "tests"
19
+ Requires-Dist: ghapi; extra == "tests"
20
+ Requires-Dist: scipy; extra == "tests"
20
21
 
21
22
  ![logo](https://raw.githubusercontent.com/wiki/open-atmos/PyPartMC/logo.svg)
22
23
 
@@ -25,19 +26,20 @@ Requires-Dist: ghapi ; extra == 'tests'
25
26
  PyPartMC is a Python interface to [PartMC](https://lagrange.mechse.illinois.edu/partmc/),
26
27
  a particle-resolved Monte-Carlo code for atmospheric aerosol simulation.
27
28
  PyPartMC is implemented in C++ and it also constitutes a C++ API to the PartMC Fortran internals.
28
- The Python API can facilitate using PartMC from other environments - see, e.g., Julia example below.
29
+ The Python API can facilitate using PartMC from other environments - see, e.g., Julia and Matlab examples below.
29
30
 
30
- For an outline of the project, rationale, architecture, and features, refer to: [D'Aquino et al., 2023 (arXiv)](https://doi.org/10.48550/arXiv.2308.02052) (please cite if PyPartMC is used in your research).
31
+ For an outline of the project, rationale, architecture, and features, refer to: [D'Aquino et al., 2024 (SoftwareX)](https://doi.org/10.1016/j.softx.2023.101613) (please cite if PyPartMC is used in your research).
31
32
  For a list of talks and other relevant resources, please see [project Wiki](https://github.com/open-atmos/PyPartMC/wiki/).
33
+ If interested in contributing to PyPartMC, please have a look a the [notes for developers](https://github.com/open-atmos/PyPartMC/tree/main/CONTRIBUTING.md).
32
34
 
33
- [![US Funding](https://img.shields.io/static/v1?label=US%20DOE%20Funding%20by&color=267c32&message=ASR&logoWidth=25&logo=image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAQCAMAAAA25D/gAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAASFBMVEVOTXyyIjRDQnNZWINZWITtzdFUU4BVVIFVVYHWiZM9PG/KZnNXVoJaWYT67/FKSXhgX4hgX4lcW4VbWoX03uHQeIN2VXj///9pZChlAAAAAWJLR0QXC9aYjwAAAAd0SU1FB+EICRMGJV+KCCQAAABdSURBVBjThdBJDoAgEETRkkkZBBX0/kd11QTTpH1/STqpAAwWBkobSlkGbt0o5xmEfqxDZJB2Q6XMoBwnVSbTylWp0hi42rmbwTOYPDfR5Kc+07IIUQQvghX9THsBHcES8/SiF0kAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDgtMDlUMTk6MDY6MzcrMDA6MDCX1tBgAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTA4LTA5VDE5OjA2OjM3KzAwOjAw5oto3AAAAABJRU5ErkJggg==)](https://asr.science.energy.gov/)
35
+ [![US Funding](https://img.shields.io/static/v1?label=US%20DOE%20Funding%20by&color=267c32&message=ASR&logoWidth=25&logo=image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAQCAMAAAA25D/gAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAASFBMVEVOTXyyIjRDQnNZWINZWITtzdFUU4BVVIFVVYHWiZM9PG/KZnNXVoJaWYT67/FKSXhgX4hgX4lcW4VbWoX03uHQeIN2VXj///9pZChlAAAAAWJLR0QXC9aYjwAAAAd0SU1FB+EICRMGJV+KCCQAAABdSURBVBjThdBJDoAgEETRkkkZBBX0/kd11QTTpH1/STqpAAwWBkobSlkGbt0o5xmEfqxDZJB2Q6XMoBwnVSbTylWp0hi42rmbwTOYPDfR5Kc+07IIUQQvghX9THsBHcES8/SiF0kAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDgtMDlUMTk6MDY6MzcrMDA6MDCX1tBgAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTA4LTA5VDE5OjA2OjM3KzAwOjAw5oto3AAAAABJRU5ErkJggg==)](https://asr.science.energy.gov/) [![PL Funding](https://img.shields.io/static/v1?label=PL%20Funding%20by&color=d21132&message=NCN&logoWidth=25&logo=image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAABmJLR0QA/wD/AP+gvaeTAAAAKUlEQVQ4jWP8////fwYqAiZqGjZqIHUAy4dJS6lqIOMdEZvRZDPcDQQAb3cIaY1Sbi4AAAAASUVORK5CYII=)](https://www.ncn.gov.pl/?language=en)
36
+
34
37
  [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.html)
35
38
  [![Copyright](https://img.shields.io/static/v1?label=Copyright&color=249fe2&message=UIUC&)](https://atmos.illinois.edu/)
36
- [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/open-atmos/PyPartMC/graphs/commit-activity)
37
- [![Github Actions Build Status](https://github.com/open-atmos/PyPartMC/workflows/tests/badge.svg?branch=main)](https://github.com/open-atmos/PyPartMC/actions)
38
- [![API docs](https://img.shields.io/badge/API_docs-pdoc3-blue.svg)](https://open-atmos.github.io/PyPartMC/)
39
+ [![Github Actions Build Status](https://github.com/open-atmos/PyPartMC/workflows/tests+pypi/badge.svg?branch=main)](https://github.com/open-atmos/PyPartMC/actions)
40
+ [![API docs](https://shields.mitmproxy.org/badge/docs-pdoc.dev-brightgreen.svg)](https://open-atmos.github.io/PyPartMC/)
39
41
  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7662635.svg)](https://doi.org/10.5281/zenodo.7662635)
40
-
42
+ [![PyPI version](https://badge.fury.io/py/PyPartMC.svg)](https://pypi.org/p/PyPartMC)
41
43
 
42
44
  ## TL;DR (try in a Jupyter notebook)
43
45
 
@@ -53,16 +55,34 @@ import PyPartMC
53
55
  ```
54
56
 
55
57
  #### Jupyter notebooks with examples
58
+ Note: clicking the badges below redirects to cloud-computing platforms. The mybinder.org links allow anonymous execution, Google Colab requires logging in with a Google account, ARM JupyerHub requires logging in with an ARM account (and directing Jupyter to a particular notebook within the `examples` folder).
56
59
 
57
- - Urban plume scenario demo (as in [PartMC](https://github.com/compdyn/partmc/tree/master/scenarios/1_urban_plume)):
58
- [![nbviewer](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)](https://nbviewer.jupyter.org/github/open-atmos/PyPartMC/blob/main/examples/particle_simulation.ipynb)
59
- [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/particle_simulation.ipynb)
60
+ - Urban plume scenario demo (as in [PartMC](https://github.com/compdyn/partmc/tree/master/scenarios/1_urban_plume)):
61
+ [![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/particle_simulation.ipynb)
62
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/particle_simulation.ipynb)
60
63
  [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/particle_simulation.ipynb)
64
+ [![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=)
61
65
  - Dry-Wet Particle Size Equilibration with PartMC and PySDM:
62
- [![nbviewer](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)](https://nbviewer.jupyter.org/github/open-atmos/PyPartMC/blob/main/examples/lognorm_ex.ipynb)
66
+ [![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/lognorm_ex.ipynb)
63
67
  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/lognorm_ex.ipynb)
64
68
  [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/lognorm_ex.ipynb)
69
+ [![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=)
65
70
  [![Voila](https://img.shields.io/static/v1?label=Voil%C3%A0&logo=jupyter&color=teal&message=web+app)](https://mybinder.org/v2/gh/open-atmos/PyPartMC/main?urlpath=voila%2Frender%2Fexamples%2Flognorm_ex.ipynb)
71
+ - Simulation output processing example (loading from netCDF files using PyPartMC):
72
+ [![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/process_simulation_output.ipynb)
73
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/process_simulation_output.ipynb)
74
+ [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/process_simulation_output.ipynb)
75
+ [![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=)
76
+ - Optical properties calculation using external Python package ([PyMieScatt](https://pymiescatt.readthedocs.io/en/latest/)):
77
+ [![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/mie_optical.ipynb)
78
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/mie_optical.ipynb)
79
+ [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/mie_optical.ipynb)
80
+ [![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=)
81
+ - Cloud parcel example featuring supersaturation-evolution-coupled CCN activation and drop growth:
82
+ [![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/cloud_parcel.ipynb)
83
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/cloud_parcel.ipynb)
84
+ [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/cloud_parcel.ipynb)
85
+ [![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=)
66
86
 
67
87
  ## Features
68
88
 
@@ -72,7 +92,7 @@ import PyPartMC
72
92
  - ships with [a set of examples](https://github.com/open-atmos/PyPartMC/tree/main/examples) maintained in a form of Jupyter notebooks
73
93
  - Pythonic API (but retaining PartMC jargon) incl. Python GC deallocation of Fortran objects
74
94
  - specification of parameters using native Python datatypes (lists, dicts) in place of PartMC spec files
75
- - code snippets in README depicting how to use PyPartMC from Julia (also executed on CI)
95
+ - code snippets in README depicting how to use PyPartMC from Julia and Matlab (also executed on CI)
76
96
  - auto-generated [API docs on the web](https://open-atmos.github.io/PyPartMC/)
77
97
  - support for [de]serialization of selected wrapped structures using JSON
78
98
  - based on [unmodified PartMC code](https://github.com/open-atmos/PyPartMC/tree/main/gitmodules)
@@ -82,9 +102,9 @@ import PyPartMC
82
102
  ## Usage examples
83
103
 
84
104
  The listings below depict how the identical task of randomly sampling particles from an aerosol size distribution in PartMC can be
85
- done in three different programming languages.
105
+ done in different programming languages.
86
106
 
87
- For a Fortran equivalent of the Python and Julia programs below, see the [`readme_fortran` folder](https://github.com/open-atmos/PyPartMC/tree/main/readme_fortran).
107
+ For a Fortran equivalent of the Python, Julia and Matlab programs below, see the [`readme_fortran` folder](https://github.com/open-atmos/PyPartMC/tree/main/readme_fortran).
88
108
 
89
109
  #### Python
90
110
 
@@ -130,7 +150,7 @@ aero_state.dist_sample(aero_dist)
130
150
  print(np.dot(aero_state.masses(), aero_state.num_concs), "# kg/m3")
131
151
  ```
132
152
 
133
- #### Julia
153
+ #### Julia (using [PyCall.jl](https://github.com/JuliaPy/PyCall.jl))
134
154
  ```Julia
135
155
  using Pkg
136
156
  Pkg.add("PyCall")
@@ -174,68 +194,83 @@ aero_state.dist_sample(aero_dist)
174
194
  print(aero_state.masses()'aero_state.num_concs, "# kg/m3")
175
195
  ```
176
196
 
197
+ #### Matlab (using [Matlab's built-in Python interface](https://www.mathworks.com/help/matlab/python-language.html))
198
+
199
+ notes (see the [PyPartMC Matlab CI workflow](https://github.com/open-atmos/PyPartMC/blob/main/.github/workflows/readme_listings.yml) for an example on how to achieve it on Ubuntu 20):
200
+ - Matlab ships with convenience copies of C, C++ and Fortran runtime libraries which are `dlopened()` by default; one way to make PyPartMC OK with it is to [pip-]install by compiling from source using the very same version of GCC that Matlab borrowed these libraries from (e.g., [GCC 9 for Matlab R2022a, etc](https://www.mathworks.com/support/requirements/supported-compilers-linux.html));
201
+ - Matlab needs to [use the same Python interpretter/venv](https://www.mathworks.com/support/requirements/python-compatibility.html) as the pip invocation used to install PyPartMC;
202
+ - a single-line `pybind11_builtins.py` file with just `pybind11_type=type` inside needs to be placed within Matlab's `PYTHONPATH` to sort out a [Matlab-pybind11 incompatibility](https://github.com/pybind/pybind11/issues/3945).
203
+
204
+ ````Matlab
205
+ ppmc = py.importlib.import_module('PyPartMC');
206
+ si = py.importlib.import_module('PyPartMC').si;
207
+
208
+ aero_data = ppmc.AeroData(py.tuple({ ...
209
+ py.dict(pyargs("OC", py.tuple({1000 * si.kg/si.m^3, 0, 1e-3 * si.kg/si.mol, 0.001}))), ...
210
+ py.dict(pyargs("BC", py.tuple({1800 * si.kg/si.m^3, 0, 1e-3 * si.kg/si.mol, 0}))) ...
211
+ }));
212
+
213
+ aero_dist = ppmc.AeroDist(aero_data, py.tuple({ ...
214
+ py.dict(pyargs( ...
215
+ "cooking", py.dict(pyargs( ...
216
+ "mass_frac", py.tuple({py.dict(pyargs("OC", py.tuple({1})))}), ...
217
+ "diam_type", "geometric", ...
218
+ "mode_type", "log_normal", ...
219
+ "num_conc", 3200 / si.cm^3, ...
220
+ "geom_mean_diam", 8.64 * si.nm, ...
221
+ "log10_geom_std_dev", .28 ...
222
+ )) ...
223
+ )), ...
224
+ py.dict(pyargs( ...
225
+ "diesel", py.dict(pyargs( ...
226
+ "mass_frac", py.tuple({ ...
227
+ py.dict(pyargs("OC", py.tuple({.3}))), ...
228
+ py.dict(pyargs("BC", py.tuple({.7}))), ...
229
+ }), ...
230
+ "diam_type", "geometric", ...
231
+ "mode_type", "log_normal", ...
232
+ "num_conc", 2900 / si.cm^3, ...
233
+ "geom_mean_diam", 50 * si.nm, ...
234
+ "log10_geom_std_dev", .24 ...
235
+ )) ...
236
+ )) ...
237
+ }));
238
+
239
+ n_part = 100;
240
+ aero_state = ppmc.AeroState(aero_data, n_part, "nummass_source");
241
+ aero_state.dist_sample(aero_dist);
242
+ masses = cell(aero_state.masses());
243
+ num_concs = cell(aero_state.num_concs);
244
+ fprintf('%g # kg/m3\n', dot([masses{:}], [num_concs{:}]))
245
+ ````
246
+
177
247
  #### usage in other projects
178
248
 
179
249
  PyPartMC is used within the [test workflow of the PySDM project](https://github.com/atmos-cloud-sim-uj/PySDM/tree/main/tests/smoke_tests/box/partmc).
180
250
 
181
- ## Implementation outline
182
-
183
- - PyPartMC is written in C++, Fortran and uses [pybind11](https://pybind11.readthedocs.io/en/stable/) and [CMake](https://cmake.org/).
184
- - JSON support is handled with [nlohmann::json](https://github.com/nlohmann/json) and [pybind11_json](https://github.com/pybind/pybind11_json)
185
- - PartMC and selected parts of SUNDIALS are statically linked (and compiled in during `pip install` or `python -m build`)
186
- - C (SUNDIALS, netCDF), C++ (pybind11, ...) and Fortran (PartMC, CAMP, netCDF-fortran) dependencies are linked through [git submodules](https://github.com/open-atmos/PyPartMC/blob/main/.gitmodules)
187
- - MOSAIC dependency is optionally linked through setting the environmental variable `MOSAIC_HOME`
188
- - a [drop-in replacement of the PartMC spec file routines](https://github.com/open-atmos/PyPartMC/blob/main/src/fake_spec_file.F90) is used for i/o from/to JSON
189
-
190
- ## Implementation architecture
191
-
192
- ```mermaid
193
- flowchart TD
194
- subgraph J ["Julia"]
195
- julia_user_code["Julia user code"] --> PyCall.jl
196
- end
197
- subgraph P ["Python"]
198
- PyCall.jl --> PyPartMC
199
- python_user_code -.-> NumPy
200
- python_user_code["Python user code"] ---> PyPartMC["pubind11-generated PyPartMC module"]
201
- end
202
- subgraph Cpp ["C++"]
203
- cpp_user_code["C++ user code"] ----> ppmc_cpp
204
- PyPartMC --> ppmc_cpp["PyPartMC-C++"]
205
- ppmc_cpp --> pybind11_json
206
- pybind11_json ---> nlohmann::JSON
207
- fake_spec_file_cpp --> nlohmann::JSON
208
- end
209
- subgraph C ["C"]
210
- fake_spec_file_c --> fake_spec_file_cpp["SpecFile-C++"]
211
- ppmc_cpp --> ppmc_c["PyPartMC-C"]
212
- netCDF-C
213
- SUNDIALS
214
- camp_c["CAMP C code"]
215
- end
216
- subgraph Fortran ["Fortran"]
217
- PartMC -....-> MOSAIC
218
- ppmc_c --> ppmc_f["PyPartMC-F"]
219
- ppmc_f ---> PartMC
220
- PartMC --> netCDF-F
221
- netCDF-F --> netCDF-C
222
- PartMC --> SUNDIALS
223
- PartMC ---> camp_f
224
- camp_f["CAMP"] --> camp_c
225
- PartMC ----> fake_spec_file_f[SpecFile-F]
226
- fake_spec_file_f --> fake_spec_file_c["SpecFile-C"]
227
- end
228
-
229
- style PartMC fill:#7ae7ff,stroke-width:2px,color:#2B2B2B
251
+ ## FAQ
252
+ - Q: How to install PyPartMC with MOSAIC enabled?
253
+ A: Installation can be done using `pip`, however, `pip` needs to be instructed not to use binary packages available at pypi.org but rather to compile from source (pip will download the source from pip.org), and the path to compiled MOSAIC library needs to be provided at compile-time; the following command should convey it:
254
+ ```bash
255
+ MOSAIC_HOME=<<PATH_TO_MOSAIC_LIB>> pip install --force-reinstall --no-binary=PyPartMC PyPartMC
230
256
  ```
231
257
 
232
- ## FAQ
233
258
  - Q: Why `pip install PyPartMC` triggers compilation on my brand new Apple machine, while it quickly downloads and installs binary packages when executed on older Macs, Windows or Linux?
234
- A: We are not yet providing binary wheels on PyPI for Apple-silicon (arm64) machines. Cross-compilation with gfortran is only supported with experimental unofficial builds [and is tricky](https://github.com/iains/gcc-12-branch/issues/23), while Github Actions ARM64 virtual machines are [costly](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#minute-multipliers).
259
+ A: We are providing binary wheels on PyPI for Apple-silicon (arm64) machines for selected macOS version made available by Github. In case the macOS version you are using is newer, compilation from source is triggered.
235
260
 
236
261
  - Q: Why some of the constructors expect data to be passed as **lists of single-entry dictionaries** instead of multi-element dictionaries?
237
262
  A: This is intentional and related with PartMC relying on the order of elements within spec-file input; while Python dictionaries preserve ordering (insertion order), JSON format does not, and we intend to make these data structures safe to be [de]serialized using JSON.
238
263
 
264
+ - Q: How to check the version of PartMC that PyPartMC was compiled against?
265
+ A: Version numbers of compile-time dependencies of PyPartMC, including PartMC, can be accessed as follows:
266
+ ```Python
267
+ import PyPartMC
268
+ PyPartMC.__versions_of_build_time_dependencies__['PartMC']
269
+ ```
270
+
271
+ - Q: Why m4 and perl are required at compile time?
272
+ A: PyPartMC includes parts of netCDF and HDF5 codebases which depend on m4 and perl, respectively, for generating source files before compilation.
273
+
239
274
  ## Troubleshooting
240
275
 
241
276
  #### Common installation issues
@@ -254,24 +289,12 @@ Could not find NC_M4 using the following names: m4, m4.exe
254
289
  ```
255
290
  Try installing `m4` (e.g., using [MSYS2](https://packages.msys2.org/package/m4?repo=msys&variant=x86_64) on Windows).
256
291
 
257
- ## Notes for developers
258
- #### How to debug
259
- ```sh
260
- git clone --recursive git+https://github.com/open-atmos/PyPartMC.git
261
- cd PyPartMC
262
- DEBUG=1 VERBOSE=1 pip --verbose install -e .
263
- gdb python
264
- (gdb) run -m pytest -s -vv -We -p no:unraisableexception tests
265
- ```
266
- #### Pre-commit hooks
267
- 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.
268
-
269
292
  ## Credits
270
293
 
271
294
  #### PyPartMC:
272
295
 
273
296
  authors: [PyPartMC developers](https://github.com/open-atmos/PyPartMC/graphs/contributors)
274
- funding: [US Department of Energy Atmospheric System Research programme](https://asr.science.energy.gov/)
297
+ funding: [US Department of Energy Atmospheric System Research programme](https://asr.science.energy.gov/), [Polish National Science Centre](https://ncn.gov.pl/en)
275
298
  copyright: [University of Illinois at Urbana-Champaign](https://atmos.illinois.edu/)
276
299
  licence: [GPL v3](https://www.gnu.org/licenses/gpl-3.0.en.html)
277
300
 
@@ -0,0 +1,7 @@
1
+ _PyPartMC.cpython-311-darwin.so,sha256=PlgK4xEGPvnCymGfkSx2mNjQ_P5Q7hcj2igLpWSWD5E,7690960
2
+ PyPartMC/__init__.py,sha256=VAqwePpJZEFJ7YieM1GbUvfluRhUyWXciP89pY9xIH4,2217
3
+ PyPartMC-1.3.6.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
4
+ PyPartMC-1.3.6.dist-info/METADATA,sha256=8VrL8W2i2SupJBy_VIYUncaGGu92F-8tSdZ76HShRbs,19059
5
+ PyPartMC-1.3.6.dist-info/WHEEL,sha256=Q7p5oqHZOZAXAiIGnjR5HFR_GU55bmirdQn4LwDE4jM,114
6
+ PyPartMC-1.3.6.dist-info/top_level.txt,sha256=PJxy22pTnxcBhqrb6r4AIL32rkxA61gzw7ohlzybgSM,19
7
+ PyPartMC-1.3.6.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.2.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp311-cp311-macosx_14_0_universal2
5
+
Binary file
@@ -1,7 +0,0 @@
1
- _PyPartMC.cpython-311-darwin.so,sha256=fN-r3Ghib_4Tacl3ZdLfR2aBjUrv8R5jeDLxWZoG8Jk,3609504
2
- PyPartMC/__init__.py,sha256=x4i-ZXpn25wXmkfhYD3h8u0Ylf5RLosn-r7CUuHzh1U,1372
3
- PyPartMC-0.7.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
4
- PyPartMC-0.7.1.dist-info/METADATA,sha256=5CnIGOJWBsnei-qjZSe_IDOb8ALsvjByytxQDZncy74,14695
5
- PyPartMC-0.7.1.dist-info/WHEEL,sha256=HWYX263JeAjyVv057HbcELWrJCfjqgjaP_5I-d5jo6M,110
6
- PyPartMC-0.7.1.dist-info/top_level.txt,sha256=PJxy22pTnxcBhqrb6r4AIL32rkxA61gzw7ohlzybgSM,19
7
- PyPartMC-0.7.1.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.3)
3
- Root-Is-Purelib: false
4
- Tag: cp311-cp311-macosx_14_0_arm64
5
-