PySDM 2.72__py3-none-any.whl → 2.74__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.
PySDM/builder.py CHANGED
@@ -49,8 +49,7 @@ class Builder:
49
49
  def _set_environment(self, environment):
50
50
  if self.particulator.environment is not None:
51
51
  raise AssertionError("environment has already been set")
52
- self.particulator.environment = environment
53
- self.particulator.environment.register(self)
52
+ self.particulator.environment = environment.instantiate(builder=self)
54
53
 
55
54
  def add_dynamic(self, dynamic):
56
55
  assert self.particulator.environment is not None
PySDM/environments/box.py CHANGED
@@ -5,8 +5,10 @@ Bare zero-dimensional framework
5
5
  import numpy as np
6
6
 
7
7
  from PySDM.impl.mesh import Mesh
8
+ from PySDM.environments.impl import register_environment
8
9
 
9
10
 
11
+ @register_environment()
10
12
  class Box:
11
13
  def __init__(self, dt, dv):
12
14
  self.dt = dt
@@ -1 +1,3 @@
1
1
  """ common internals not intended to be imported from user code """
2
+
3
+ from PySDM.environments.impl.register_environment import register_environment
@@ -0,0 +1,24 @@
1
+ """ decorator for environment classes
2
+ ensuring that their instances can be re-used with multiple builders """
3
+
4
+ from copy import deepcopy
5
+
6
+
7
+ def _instantiate(self, *, builder):
8
+ copy = deepcopy(self)
9
+ copy.register(builder=builder)
10
+ return copy
11
+
12
+
13
+ def register_environment():
14
+ def decorator(cls):
15
+ if hasattr(cls, "instantiate"):
16
+ if cls.instantiate is not _instantiate:
17
+ raise AttributeError(
18
+ "decorated class has a different instantiate method"
19
+ )
20
+ else:
21
+ setattr(cls, "instantiate", _instantiate)
22
+ return cls
23
+
24
+ return decorator
@@ -7,10 +7,12 @@ import numpy as np
7
7
 
8
8
  from PySDM.environments.impl.moist import Moist
9
9
 
10
- from ..impl import arakawa_c
11
- from ..initialisation.equilibrate_wet_radii import equilibrate_wet_radii
10
+ from PySDM.impl import arakawa_c
11
+ from PySDM.initialisation.equilibrate_wet_radii import equilibrate_wet_radii
12
+ from PySDM.environments.impl import register_environment
12
13
 
13
14
 
15
+ @register_environment()
14
16
  class Kinematic1D(Moist):
15
17
  def __init__(self, *, dt, mesh, thd_of_z, rhod_of_z, z0=0):
16
18
  super().__init__(dt, mesh, [])
@@ -12,10 +12,11 @@ from PySDM.initialisation.equilibrate_wet_radii import (
12
12
  equilibrate_wet_radii,
13
13
  )
14
14
  from PySDM.initialisation.sampling.spectral_sampling import ConstantMultiplicity
15
-
16
- from ..impl import arakawa_c
15
+ from PySDM.impl import arakawa_c
16
+ from PySDM.environments.impl import register_environment
17
17
 
18
18
 
19
+ @register_environment()
19
20
  class Kinematic2D(Moist):
20
21
  def __init__(self, *, dt, grid, size, rhod_of, mixed_phase=False):
21
22
  super().__init__(dt, Mesh(grid, size), [], mixed_phase=mixed_phase)
@@ -12,8 +12,10 @@ from PySDM.initialisation.equilibrate_wet_radii import (
12
12
  default_rtol,
13
13
  equilibrate_wet_radii,
14
14
  )
15
+ from PySDM.environments.impl import register_environment
15
16
 
16
17
 
18
+ @register_environment()
17
19
  class Parcel(Moist): # pylint: disable=too-many-instance-attributes
18
20
  def __init__(
19
21
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PySDM
3
- Version: 2.72
3
+ Version: 2.74
4
4
  Summary: Pythonic particle-based (super-droplet) warm-rain/aqueous-chemistry cloud microphysics package with box, parcel & 1D/2D prescribed-flow examples in Python, Julia and Matlab
5
5
  Home-page: https://github.com/open-atmos/PySDM
6
6
  Author: https://github.com/open-atmos/PySDM/graphs/contributors
@@ -25,7 +25,7 @@ Description-Content-Type: text/markdown
25
25
  Requires-Dist: ThrustRTC==0.3.20
26
26
  Requires-Dist: CURandRTC>=0.1.2
27
27
  Requires-Dist: numba>=0.51.2
28
- Requires-Dist: numpy<2.0.0
28
+ Requires-Dist: numpy
29
29
  Requires-Dist: Pint
30
30
  Requires-Dist: chempy
31
31
  Requires-Dist: scipy
@@ -39,6 +39,8 @@ Requires-Dist: pyrcel; extra == "tests"
39
39
  Requires-Dist: jupyter-core<5.0.0; extra == "tests"
40
40
  Requires-Dist: ipywidgets!=8.0.3; extra == "tests"
41
41
 
42
+ # <img src="https://raw.githubusercontent.com/open-atmos/PySDM/main/.github/pysdm_logo.png" width=100 height=146 alt="pysdm logo">
43
+
42
44
  # PySDM
43
45
 
44
46
  [![Python 3](https://img.shields.io/static/v1?label=Python&logo=Python&color=3776AB&message=3)](https://www.python.org/)
@@ -551,7 +553,7 @@ builder.add_dynamic(Condensation())
551
553
 
552
554
  r_dry, specific_concentration = spectral_sampling.Logarithmic(spectrum).sample(n_sd)
553
555
  v_dry = formulae.trivia.volume(radius=r_dry)
554
- r_wet = equilibrate_wet_radii(r_dry=r_dry, environment=env, kappa_times_dry_volume=kappa * v_dry)
556
+ r_wet = equilibrate_wet_radii(r_dry=r_dry, environment=builder.particulator.environment, kappa_times_dry_volume=kappa * v_dry)
555
557
 
556
558
  attributes = Dict()
557
559
  attributes["multiplicity"] = discretise_multiplicities(specific_concentration * env.mass_of_dry_air)
@@ -636,7 +638,7 @@ v_dry = formulae.trivia.volume(pyargs('radius', r_dry));
636
638
  specific_concentration = tmp{2};
637
639
  r_wet = equilibrate_wet_radii(pyargs(...
638
640
  'r_dry', r_dry, ...
639
- 'environment', env, ...
641
+ 'environment', builder.particulator.environment, ...
640
642
  'kappa_times_dry_volume', kappa * v_dry...
641
643
  ));
642
644
 
@@ -732,7 +734,7 @@ builder.add_dynamic(Condensation())
732
734
 
733
735
  r_dry, specific_concentration = spectral_sampling.Logarithmic(spectrum).sample(n_sd)
734
736
  v_dry = formulae.trivia.volume(radius=r_dry)
735
- r_wet = equilibrate_wet_radii(r_dry=r_dry, environment=env, kappa_times_dry_volume=kappa * v_dry)
737
+ r_wet = equilibrate_wet_radii(r_dry=r_dry, environment=builder.particulator.environment, kappa_times_dry_volume=kappa * v_dry)
736
738
 
737
739
  attributes = {
738
740
  'multiplicity': discretise_multiplicities(specific_concentration * env.mass_of_dry_air),
@@ -1,5 +1,5 @@
1
1
  PySDM/__init__.py,sha256=nrBhoz8kmvowBpYj_ijAM85wIqlcCxZg5Y-I1LLpeNo,1738
2
- PySDM/builder.py,sha256=yZd6C2y0f3g9408_vxDRhxJmgRG0--BKSFc0c-B92iw,5799
2
+ PySDM/builder.py,sha256=NpUwIZLXhepjB2BO7NRt6L42vmURXclLnw82iSv671g,5772
3
3
  PySDM/formulae.py,sha256=KZmUm6JpVPt5Y8lc7BYc_EWY8ZSMDktFjVHnFENp6YM,13761
4
4
  PySDM/particulator.py,sha256=yIRFNMTBDKelLlhD-uejqUL_-QUYu2Y9ShjE5wPzzZw,16447
5
5
  PySDM/attributes/__init__.py,sha256=cJVc2aGo7ZID8fTo_AcxSi0XhnxML-r9yc4L4RYJaE4,171
@@ -157,12 +157,13 @@ PySDM/dynamics/terminal_velocity/gunn_and_kinzer.py,sha256=ykbZFHne_oOyBw5ABmdi6
157
157
  PySDM/dynamics/terminal_velocity/power_series.py,sha256=Fyqop4Y74s_qO-jPYUWe_-xYRjKV9Fs-GC6bImlzv5E,981
158
158
  PySDM/dynamics/terminal_velocity/rogers_and_yau.py,sha256=ViSOOuXDBHhPkpK3DpfXjRsDw-5bTJ_S-VDTX8SiWSQ,361
159
159
  PySDM/environments/__init__.py,sha256=t9Pxa2ZdEcfh6siHPrcA1LbAMNNd0uoA2jdi5XoBxNg,246
160
- PySDM/environments/box.py,sha256=ai9j3lkOS001jIo1L-PvZ-cSFxsomD_Na4xshDKbE7c,1014
161
- PySDM/environments/kinematic_1d.py,sha256=k1SskJHTMqscKcUudXCJUbbGwDPVRwmFzFnEWS91F84,3110
162
- PySDM/environments/kinematic_2d.py,sha256=IStDaMdoBzXSFQFdvTIglwgnqjFnfT1bpxxm8GrRbtY,3259
163
- PySDM/environments/parcel.py,sha256=5ZzJpk8Z0Oo0YobE-kzODCEvwGBZyGt07Qtdrzr8ljY,5063
164
- PySDM/environments/impl/__init__.py,sha256=VLo3BCKoh2ITc5eMudK17HzmktSn74d-bCdjq9xbhRo,68
160
+ PySDM/environments/box.py,sha256=btth9o2JA1laapzr0UlFglQMme9aasz94S2rBGx7juE,1095
161
+ PySDM/environments/kinematic_1d.py,sha256=4jJRpuvxApojRzl3XvIY649vEcoPdph6fnmWX5RZJRI,3199
162
+ PySDM/environments/kinematic_2d.py,sha256=UB0q63_DI_io8tYV5SL_a0_8PtnazHUvQPrDcWvy9E8,3343
163
+ PySDM/environments/parcel.py,sha256=wpEeaBSFdl8oSBDz5TUHjO7GGLOz1oousXkpbgyTOyY,5144
164
+ PySDM/environments/impl/__init__.py,sha256=1Eute-rhDwy2D9cVuXPCPvGU8XJBNFliS2EodeCtKBA,147
165
165
  PySDM/environments/impl/moist.py,sha256=kGGNWcovIpZdc3autTiZMcau7aJV9xf-7Kbu2ZZDktU,4051
166
+ PySDM/environments/impl/register_environment.py,sha256=2r4Pkmf23tMdLnjLtkxcgPAoQDnSv9kUDfu8cOd-6wo,636
166
167
  PySDM/exporters/__init__.py,sha256=V-WgSuQYgRnG948WtViYSwEa_uTRgHCdS6kcaQvRjPU,277
167
168
  PySDM/exporters/netcdf_exporter.py,sha256=9Y34cOJiK2y9eO8-PJ-oEGOp3m28tafrmlUwLCSQXm0,4225
168
169
  PySDM/exporters/netcdf_exporter_1d.py,sha256=wpnTQfXocBSuNp46y98FxTEWMFdTMCHjwMElT996zFs,5212
@@ -380,8 +381,8 @@ PySDM/products/size_spectral/size_standard_deviation.py,sha256=A7fSj_keQi_bHW41P
380
381
  PySDM/products/size_spectral/total_particle_concentration.py,sha256=K7sO2jgUpYOwWvBK3jXp9KUxLRXk_Ve6ooOdY5q5jd0,470
381
382
  PySDM/products/size_spectral/total_particle_specific_concentration.py,sha256=isLZt5j2vJGr-FrzYFcUNPHZqMKhOtl51za1Hogh6hQ,476
382
383
  PySDM/products/size_spectral/water_mixing_ratio.py,sha256=PP54hfMy4SPDQDJgV4RNzVP03lmL1THZPa2KXrdgoQ4,1324
383
- PySDM-2.72.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
384
- PySDM-2.72.dist-info/METADATA,sha256=rA6ETsPRKxUPlQxxpZA8DZPIJLKbkhVi8vR9tHn2y-0,45823
385
- PySDM-2.72.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
386
- PySDM-2.72.dist-info/top_level.txt,sha256=6NYaDAhUnaYMD7ebD_dQ7HlhiJS7NMuKEXb0ck7Wcsg,6
387
- PySDM-2.72.dist-info/RECORD,,
384
+ PySDM-2.74.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
385
+ PySDM-2.74.dist-info/METADATA,sha256=RbATS7HELeaYhxOfVfgLhXiA1LC8lNX-3_qk6ekz5hI,46036
386
+ PySDM-2.74.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
387
+ PySDM-2.74.dist-info/top_level.txt,sha256=6NYaDAhUnaYMD7ebD_dQ7HlhiJS7NMuKEXb0ck7Wcsg,6
388
+ PySDM-2.74.dist-info/RECORD,,
File without changes
File without changes