PySDM-examples 2.130__py3-none-any.whl → 2.131__py3-none-any.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.
@@ -1,13 +1,33 @@
1
+ from functools import lru_cache
2
+
1
3
  import numpy as np
2
4
  from PySDM_examples.Lowe_et_al_2019.constants_def import LOWE_CONSTS
3
5
  from pystrict import strict
4
6
 
5
7
  from PySDM import Formulae
8
+ from PySDM.backends import CPU
6
9
  from PySDM.initialisation.aerosol_composition import DryAerosolMixture
7
10
  from PySDM.initialisation.sampling import spectral_sampling as spec_sampling
8
11
  from PySDM.physics import si
9
12
 
10
13
 
14
+ @lru_cache
15
+ def backend(model):
16
+ return CPU(
17
+ formulae=Formulae(
18
+ surface_tension=model,
19
+ constants=LOWE_CONSTS,
20
+ diffusion_kinetics="LoweEtAl2019",
21
+ diffusion_thermics="LoweEtAl2019",
22
+ latent_heat_vapourisation="Lowe2019",
23
+ saturation_vapour_pressure="Lowe1977",
24
+ optical_albedo="Bohren1987",
25
+ optical_depth="Stephens1978",
26
+ ),
27
+ override_jit_flags={"parallel": False},
28
+ )
29
+
30
+
11
31
  @strict
12
32
  class Settings:
13
33
  def __init__(
@@ -22,16 +42,8 @@ class Settings:
22
42
  assert model in ("Constant", "CompressedFilmOvadnevaite")
23
43
  self.model = model
24
44
  self.n_sd_per_mode = n_sd_per_mode
25
- self.formulae = Formulae(
26
- surface_tension=model,
27
- constants=LOWE_CONSTS,
28
- diffusion_kinetics="LoweEtAl2019",
29
- diffusion_thermics="LoweEtAl2019",
30
- latent_heat_vapourisation="Lowe2019",
31
- saturation_vapour_pressure="Lowe1977",
32
- optical_albedo="Bohren1987",
33
- optical_depth="Stephens1978",
34
- )
45
+ self.backend = backend(model)
46
+ self.formulae = self.backend.formulae
35
47
  const = self.formulae.constants
36
48
  self.aerosol = aerosol
37
49
  self.spectral_sampling = spectral_sampling
@@ -3,7 +3,6 @@ from PySDM_examples.utils import BasicSimulation
3
3
 
4
4
  import PySDM.products as PySDM_products
5
5
  from PySDM import Builder
6
- from PySDM.backends import CPU
7
6
  from PySDM.dynamics import AmbientThermodynamics, Condensation
8
7
  from PySDM.environments import Parcel
9
8
  from PySDM.initialisation import equilibrate_wet_radii
@@ -15,9 +14,7 @@ class Simulation(BasicSimulation):
15
14
  n_sd = settings.n_sd_per_mode * len(settings.aerosol.modes)
16
15
  builder = Builder(
17
16
  n_sd=n_sd,
18
- backend=CPU(
19
- formulae=settings.formulae, override_jit_flags={"parallel": False}
20
- ),
17
+ backend=settings.backend,
21
18
  environment=Parcel(
22
19
  dt=settings.dt,
23
20
  mass_of_dry_air=settings.mass_of_dry_air,
@@ -12,11 +12,22 @@ from PySDM.environments import Box
12
12
  from PySDM.initialisation.sampling.spectral_sampling import ConstantMultiplicity
13
13
  from PySDM.products import ParticleVolumeVersusRadiusLogarithmSpectrum, WallTime
14
14
 
15
+ _BACKEND_CACHE = {}
16
+
17
+
18
+ def backend_factory(backend_class, formulae):
19
+ key = backend_class.__name__ + ":" + str(formulae)
20
+ if key not in _BACKEND_CACHE:
21
+ _BACKEND_CACHE[key] = backend_class(formulae=formulae)
22
+ return _BACKEND_CACHE[key]
23
+
15
24
 
16
25
  def run(settings, backend=CPU, observers=()):
17
26
  env = Box(dv=settings.dv, dt=settings.dt)
18
27
  builder = Builder(
19
- n_sd=settings.n_sd, backend=backend(formulae=settings.formulae), environment=env
28
+ n_sd=settings.n_sd,
29
+ backend=backend_factory(backend, formulae=settings.formulae),
30
+ environment=env,
20
31
  )
21
32
  attributes = {}
22
33
  sampling = ConstantMultiplicity(settings.spectrum)
@@ -0,0 +1,7 @@
1
+ """
2
+ global_meteoric_water_line.ipynb:
3
+ .. include:: ./global_meteoric_water_line.ipynb.badges.md
4
+
5
+ timescales_comparison.ipynb:
6
+ .. include:: ./timescales_comparison.ipynb.badges.md
7
+ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pysdm-examples
3
- Version: 2.130
3
+ Version: 2.131
4
4
  Summary: PySDM usage examples reproducing results from literature and depicting how to use PySDM from Python Jupyter notebooks
5
5
  Home-page: https://github.com/open-atmos/PySDM
6
6
  Author: https://github.com/open-atmos/PySDM/graphs/contributors
@@ -15,6 +15,7 @@ Requires-Dist: PyMPDATA
15
15
  Requires-Dist: open-atmos-jupyter-utils
16
16
  Requires-Dist: pystrict
17
17
  Requires-Dist: matplotlib
18
+ Requires-Dist: Pillow
18
19
  Requires-Dist: joblib
19
20
  Requires-Dist: ipywidgets
20
21
  Requires-Dist: seaborn
@@ -75,8 +75,8 @@ PySDM_examples/Lowe_et_al_2019/aerosol.py,sha256=8h0e1QAo4CQyyKokYScfuiWbKVJuLHf
75
75
  PySDM_examples/Lowe_et_al_2019/aerosol_code.py,sha256=HqjEfWwsdKFnrCvRNpyUrfX4JGJLdS53AbHTJ0NgyzQ,9667
76
76
  PySDM_examples/Lowe_et_al_2019/constants_def.py,sha256=dgNxLpBwXiyrefuW4t87uNIxIV3wySx5PXW3QqQZ7f0,480
77
77
  PySDM_examples/Lowe_et_al_2019/plot_helper.py,sha256=5h7zo0Aonm2pzUPFNNTqxLhShWcJZaNgG-Bwa9EwY9E,6427
78
- PySDM_examples/Lowe_et_al_2019/settings.py,sha256=p6xSlPJIyDPE4OZ6VX0GxPUTqJdkU9posreOGFLbbO4,2599
79
- PySDM_examples/Lowe_et_al_2019/simulation.py,sha256=JDBlmjbsQzg-M0rW4L2sDeZGtmAT6BV-akVbvV04Q5c,5837
78
+ PySDM_examples/Lowe_et_al_2019/settings.py,sha256=OBBv-yjEEKcyihV_Q-HBw0eH-EKjoo9BWO6xHMiHRbo,2844
79
+ PySDM_examples/Lowe_et_al_2019/simulation.py,sha256=09cfSbH7Oglotf-2MuEy5STtWdQgXcjo_D4KF0J-Jio,5721
80
80
  PySDM_examples/Merlivat_and_Nief_1967/__init__.py,sha256=ng7qsws-A87JR1X5DSewG2ABFdSVrnsUbczc3sKgfME,178
81
81
  PySDM_examples/Miyake_et_al_1968/__init__.py,sha256=6uWg29ppJfgyvgwuuBPJdX9immnAly-gkFF_fjTZ9hE,202
82
82
  PySDM_examples/Morrison_and_Grabowski_2007/__init__.py,sha256=EB1uqfjyflCw4U-rwlV3dpvCMtUpBuJizSWrxO46FeE,203
@@ -97,7 +97,7 @@ PySDM_examples/Rozanski_and_Sonntag_1982/__init__.py,sha256=7VDJkeNyItUTatkUxWc1
97
97
  PySDM_examples/Rozanski_and_Sonntag_1982/multibox.py,sha256=dZrtirCf7UxaL3IH3KENW8YX8eh_kjP8wTPS_Sqp7Go,3594
98
98
  PySDM_examples/Shima_et_al_2009/__init__.py,sha256=7ZyHkEi03pePgJ9JFKtxy2eeGldZe3ADv5sg5GhPJ8I,234
99
99
  PySDM_examples/Shima_et_al_2009/error_measure.py,sha256=YkaGvvest25O5TYV3_jBt1owLEGd92w4M1kMbadXkMI,222
100
- PySDM_examples/Shima_et_al_2009/example.py,sha256=Pdf8YYO-OVHSEhIarl7Nu80vOAKX6l9sAlFPhKZySJo,2351
100
+ PySDM_examples/Shima_et_al_2009/example.py,sha256=qdXM1ZprUIfUdK--07TDoWXwyFGGxF03jSOTW2Cr73U,2637
101
101
  PySDM_examples/Shima_et_al_2009/example_timing.py,sha256=ArX9MGIxHnNX3OWYMbI_kKlnJpCtkgMMrYdOOqXzBE4,1816
102
102
  PySDM_examples/Shima_et_al_2009/settings.py,sha256=X9YI5OrBXJk68vE0HDeQxc1yk_gVUjZ7UhMUKugEHa0,1176
103
103
  PySDM_examples/Shima_et_al_2009/spectrum_plotter.py,sha256=98y_ofVp8qm60xVDQ-llPm9kqaBXKDh5AZpZXTZ0_-c,5623
@@ -128,7 +128,7 @@ PySDM_examples/Van_Hook_1968/__init__.py,sha256=rTmp4AjFBnNJP61rn7Scui5G_AwQruqj
128
128
  PySDM_examples/Yang_et_al_2018/__init__.py,sha256=w7eRDdbBJKvp-iRqgTJDEGlX2o1vqubjjuqc0YECodc,278
129
129
  PySDM_examples/Yang_et_al_2018/settings.py,sha256=FkK46ZhgRIwPRAZKWBFcf1NYquvMtyQmoX3z7_eMwQs,2330
130
130
  PySDM_examples/Yang_et_al_2018/simulation.py,sha256=vLmevPahaEaCoxx6H8wKKk8lq0n8yxNywI150NzUnwA,4286
131
- PySDM_examples/Zaba_et_al_2025/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
131
+ PySDM_examples/Zaba_et_al/__init__.py,sha256=-bTkm91qmYxnHsB9Z9qJ9pFtbre2j_TPWLxjF7PQBpg,183
132
132
  PySDM_examples/_HOWTOs/__init__.py,sha256=1k3BtizvAoImB2DMfeafabeMmdT0NeaqI5zwNOwEvuQ,169
133
133
  PySDM_examples/deJong_Azimi/__init__.py,sha256=HEv69Ke02s732IjcQ5expjDT2uPCKpfaYe6L8gP9AKU,376
134
134
  PySDM_examples/deJong_Azimi/cloudy_data.py,sha256=WrseLwj7uF0cESY7xRWqXbXzOu-WPJCNAPyrNMOqQHE,11258
@@ -165,7 +165,7 @@ PySDM_examples/utils/kinematic_2d/storage.py,sha256=NaGoujCRLubSEbhLA0QZDaSkATpJ
165
165
  PySDM_examples/utils/widgets/__init__.py,sha256=U67WZ2YDcXSocMraI7pzcMxCfcxzXNqehDzoG6ogsh4,519
166
166
  PySDM_examples/utils/widgets/freezer.py,sha256=tFlZWShXUzA2X0cxgeE44N1g9kD33q3KQWZBqkgBP0A,407
167
167
  PySDM_examples/utils/widgets/progbar_updater.py,sha256=3uhG32QkAiSM3dTV7DoROJl7fAUNA6ZsJEIKSg3tdmk,267
168
- pysdm_examples-2.130.dist-info/METADATA,sha256=K8YiJfOxJJWvn9jmjx1FnZX_pTyymwJMUjl_k5gn0Lk,13207
169
- pysdm_examples-2.130.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
170
- pysdm_examples-2.130.dist-info/top_level.txt,sha256=axw2inuuYKPWkQhzBYtkZJTPDlo5LrpGLOA0iSAf9v0,15
171
- pysdm_examples-2.130.dist-info/RECORD,,
168
+ pysdm_examples-2.131.dist-info/METADATA,sha256=WLAgiorNxjlVJnnlmYLx3ucyvTLp1Q2SW92VrJ6Zd7A,13229
169
+ pysdm_examples-2.131.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
170
+ pysdm_examples-2.131.dist-info/top_level.txt,sha256=axw2inuuYKPWkQhzBYtkZJTPDlo5LrpGLOA0iSAf9v0,15
171
+ pysdm_examples-2.131.dist-info/RECORD,,
File without changes