PySDM 2.63__py3-none-any.whl → 2.64__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.
@@ -7,19 +7,23 @@ from PySDM.products.impl.moment_product import MomentProduct
7
7
 
8
8
 
9
9
  class ConcentrationProduct(MomentProduct):
10
+ @staticmethod
11
+ def check_ctor_arguments(specific, stp):
12
+ if stp and specific:
13
+ raise ValueError(
14
+ "std-temperature-and-pressure precludes specific conc. option"
15
+ )
16
+
10
17
  def __init__(self, *, unit: str, name: str, specific: bool, stp: bool):
11
18
  """
12
19
  `stp` toggles expressing the concentration in terms of standard temperature
13
20
  and pressure conditions (ground level of the ICAO standard atmosphere, zero humidity)
14
21
  """
22
+ self.check_ctor_arguments(specific, stp)
15
23
  super().__init__(unit=unit, name=name)
16
24
  self.specific = specific
17
25
  self.stp = stp
18
26
  self.rho_stp = None
19
- if self.stp and self.specific:
20
- raise ValueError(
21
- "std-temperature-and-pressure precludes specific conc. option"
22
- )
23
27
 
24
28
  def register(self, builder):
25
29
  super().register(builder)
@@ -7,13 +7,26 @@ from abc import ABC
7
7
  import numpy as np
8
8
 
9
9
  from PySDM.products.impl.spectrum_moment_product import SpectrumMomentProduct
10
+ from PySDM.products.impl.concentration_product import ConcentrationProduct
10
11
 
11
12
 
12
13
  class ParticleSizeSpectrum(SpectrumMomentProduct, ABC):
13
- def __init__(self, *, radius_bins_edges, name, unit, dry=False, specific=False):
14
+ def __init__(
15
+ self,
16
+ *,
17
+ stp: bool,
18
+ radius_bins_edges,
19
+ name: str,
20
+ unit: str,
21
+ dry: bool = False,
22
+ specific: bool = False,
23
+ ):
24
+ ConcentrationProduct.check_ctor_arguments(specific, stp)
14
25
  self.volume_attr = "dry volume" if dry else "volume"
15
26
  self.radius_bins_edges = radius_bins_edges
16
27
  self.specific = specific
28
+ self.stp = stp
29
+ self.rho_stp = None
17
30
  super().__init__(name=name, unit=unit, attr_unit="m^3")
18
31
 
19
32
  def register(self, builder):
@@ -29,6 +42,7 @@ class ParticleSizeSpectrum(SpectrumMomentProduct, ABC):
29
42
  super().register(builder)
30
43
 
31
44
  self.shape = (*builder.particulator.mesh.grid, len(self.attr_bins_edges) - 1)
45
+ self.rho_stp = builder.formulae.constants.rho_STP
32
46
 
33
47
  def _impl(self, **kwargs):
34
48
  vals = np.empty([self.particulator.mesh.n_cell, len(self.attr_bins_edges) - 1])
@@ -42,7 +56,7 @@ class ParticleSizeSpectrum(SpectrumMomentProduct, ABC):
42
56
 
43
57
  vals[:] /= self.particulator.mesh.dv
44
58
 
45
- if self.specific:
59
+ if self.specific or self.stp:
46
60
  self._download_to_buffer(self.particulator.environment["rhod"])
47
61
 
48
62
  for i in range(len(self.attr_bins_edges) - 1):
@@ -50,29 +64,42 @@ class ParticleSizeSpectrum(SpectrumMomentProduct, ABC):
50
64
  volume=self.attr_bins_edges[i + 1]
51
65
  ) - self.formulae.trivia.radius(volume=self.attr_bins_edges[i])
52
66
  vals[:, i] /= dr
53
- if self.specific:
67
+ if self.specific or self.stp:
54
68
  vals[:, i] /= self.buffer.ravel()
69
+ if self.stp:
70
+ vals[:, i] *= self.rho_stp
55
71
 
56
72
  return np.squeeze(vals.reshape(self.shape))
57
73
 
58
74
 
59
75
  class ParticleSizeSpectrumPerMassOfDryAir(ParticleSizeSpectrum):
60
- def __init__(self, radius_bins_edges, dry=False, name=None, unit="kg^-1 m^-1"):
76
+ def __init__(
77
+ self,
78
+ *,
79
+ radius_bins_edges,
80
+ dry=False,
81
+ name=None,
82
+ unit="kg^-1 m^-1",
83
+ ):
61
84
  super().__init__(
62
85
  radius_bins_edges=radius_bins_edges,
63
86
  dry=dry,
64
87
  specific=True,
65
88
  name=name,
66
89
  unit=unit,
90
+ stp=False,
67
91
  )
68
92
 
69
93
 
70
94
  class ParticleSizeSpectrumPerVolume(ParticleSizeSpectrum):
71
- def __init__(self, radius_bins_edges, dry=False, name=None, unit="m^-3 m^-1"):
95
+ def __init__(
96
+ self, *, radius_bins_edges, dry=False, name=None, unit="m^-3 m^-1", stp=False
97
+ ):
72
98
  super().__init__(
73
99
  radius_bins_edges=radius_bins_edges,
74
100
  dry=dry,
75
101
  specific=False,
76
102
  name=name,
77
103
  unit=unit,
104
+ stp=stp,
78
105
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PySDM
3
- Version: 2.63
3
+ Version: 2.64
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
@@ -34,7 +34,7 @@ Provides-Extra: tests
34
34
  Requires-Dist: matplotlib ; extra == 'tests'
35
35
  Requires-Dist: pytest ; extra == 'tests'
36
36
  Requires-Dist: pytest-timeout ; extra == 'tests'
37
- Requires-Dist: PyPartMC ==1.3.1 ; extra == 'tests'
37
+ Requires-Dist: PyPartMC ==1.3.2 ; extra == 'tests'
38
38
  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'
@@ -345,7 +345,7 @@ PySDM/products/housekeeping/time.py,sha256=LvGhRNtCHtZGO8Anfc_Vo_xtA34T3w41HvtBh
345
345
  PySDM/products/housekeeping/timers.py,sha256=bgaQNhqI6KuMDLUqDCCZNIAs4Ldvxf6okyv7Mm-t59Q,1085
346
346
  PySDM/products/impl/__init__.py,sha256=uIZwUK-EysFR7rvJGxWIasDz9pqGFm1Cju1AeoNMZM0,387
347
347
  PySDM/products/impl/activation_filtered_product.py,sha256=JUr-Wmna7SYItM_qq3XTNNq4gpnHyvssh5z9mNCAKFk,829
348
- PySDM/products/impl/concentration_product.py,sha256=UNbjrft_nS8Co2iEsA02Mg9x_e7LW9_mWgDXHTCw9aE,1402
348
+ PySDM/products/impl/concentration_product.py,sha256=eOsKFu24Fb0R0pe4Y8wSF1IqtUAL-2xS1g_Qua9nEO4,1505
349
349
  PySDM/products/impl/moist_environment_product.py,sha256=czIPLjGV2hiX-sHHiXwuflcFZGbhvRyQ_QpIv3S-Hdo,889
350
350
  PySDM/products/impl/moment_product.py,sha256=rlYlTCNxdk0-oyCzVOq-4E6SZqNrGZGggDZerNmZLxg,1483
351
351
  PySDM/products/impl/product.py,sha256=z9kQWfQ8CKP0gRJ3LDVKL8JLfXhHjb3b9hjTox5ql_o,3412
@@ -368,15 +368,15 @@ PySDM/products/size_spectral/mean_volume_radius.py,sha256=fU8R0Dpglz7SExbQKgxGda
368
368
  PySDM/products/size_spectral/number_size_spectrum.py,sha256=UU4gzvh3eSEwqt-Qs0hMKCogsiwLZVy2BwXDHtv16lU,1422
369
369
  PySDM/products/size_spectral/particle_concentration.py,sha256=vhJqjqILq2NmZRVf1ZDd08TU-ok5Oz-QIGh1fw95o7c,1377
370
370
  PySDM/products/size_spectral/particle_concentration_activated.py,sha256=b7FYPz82uSZosqI6DQjPsDJ0WPSBJ3lTDgLt7hmlT8s,1565
371
- PySDM/products/size_spectral/particle_size_spectrum.py,sha256=EAGKhcdlMO8PKwIyCjM6w1RoTDd6vCCure8E6k2oI98,2631
371
+ PySDM/products/size_spectral/particle_size_spectrum.py,sha256=8TWlg1hnVbN2cZHsSvHdJn5al4FK3Nxxwmays8xgd3k,3218
372
372
  PySDM/products/size_spectral/particle_volume_versus_radius_logarithm_spectrum.py,sha256=cnSwy2coAcjoZQiLTI8JCa1Tk_NhjAUe7GMN5UpIYjg,1711
373
373
  PySDM/products/size_spectral/radius_binned_number_averaged_terminal_velocity.py,sha256=DZbDh5wx3INvHjk9eQXVbLAwcSUd_6sTA92bRztK9Z0,1358
374
374
  PySDM/products/size_spectral/size_standard_deviation.py,sha256=ikW_BefV27gwUlDPoFDnxrP45Pb9SWIIcp8vJUlpNUU,2104
375
375
  PySDM/products/size_spectral/total_particle_concentration.py,sha256=stDEn67KGhxEkrOC4CCfCFVgjtQPMphZTfJ1Vy_H5aw,454
376
376
  PySDM/products/size_spectral/total_particle_specific_concentration.py,sha256=z6SfknIoXgT2XbVeuswrwBew9yTlmbW7qWFRmD4rqUg,460
377
377
  PySDM/products/size_spectral/water_mixing_ratio.py,sha256=i2g2s8Hj_ZTmggZvXuGRWnqyxutSknncY8Imzw_Vfhk,1301
378
- PySDM-2.63.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
379
- PySDM-2.63.dist-info/METADATA,sha256=WDf4jw4wUNJaG7JbbbcmqX-h5mQEo39TKt1JvG58VOU,45787
380
- PySDM-2.63.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
381
- PySDM-2.63.dist-info/top_level.txt,sha256=6NYaDAhUnaYMD7ebD_dQ7HlhiJS7NMuKEXb0ck7Wcsg,6
382
- PySDM-2.63.dist-info/RECORD,,
378
+ PySDM-2.64.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
379
+ PySDM-2.64.dist-info/METADATA,sha256=CjyWiMYV6j24fbkqVJe0lieIuqXzU_8AlbfT9ODt8sY,45787
380
+ PySDM-2.64.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
381
+ PySDM-2.64.dist-info/top_level.txt,sha256=6NYaDAhUnaYMD7ebD_dQ7HlhiJS7NMuKEXb0ck7Wcsg,6
382
+ PySDM-2.64.dist-info/RECORD,,
File without changes
File without changes