Module PySDM.products.size_spectral.particle_concentration
concentration of particles within a grid cell (either per-volume of per-mass-of-dry air, optionally restricted to a given size range)
Expand source code
"""
concentration of particles within a grid cell (either per-volume of per-mass-of-dry air,
optionally restricted to a given size range)
"""
import numpy as np
from PySDM.products.impl.concentration_product import ConcentrationProduct
class ParticleConcentration(ConcentrationProduct):
# pylint: disable=too-many-arguments
def __init__(
self,
radius_range=(0, np.inf),
specific=False,
stp=False,
name=None,
unit="m^-3",
):
self.radius_range = radius_range
super().__init__(name=name, unit=unit, specific=specific, stp=stp)
def _impl(self, **kwargs):
self._download_moment_to_buffer(
attr="water mass",
rank=0,
filter_range=(
self.formulae.particle_shape_and_density.volume_to_mass(
self.formulae.trivia.volume(radius=self.radius_range[0])
),
self.formulae.particle_shape_and_density.volume_to_mass(
self.formulae.trivia.volume(self.radius_range[1])
),
),
)
return super()._impl(**kwargs)
class ParticleSpecificConcentration(ParticleConcentration):
def __init__(self, radius_range=(0, np.inf), name=None, unit="kg^-1"):
super().__init__(radius_range=radius_range, specific=True, name=name, unit=unit)
Classes
class ParticleConcentration (radius_range=(0, inf), specific=False, stp=False, name=None, unit='m^-3')
-
Helper class that provides a standard way to create an ABC using inheritance.
stp
toggles expressing the concentration in terms of standard temperature and pressure conditions (ground level of the ICAO standard atmosphere, zero humidity)Expand source code
class ParticleConcentration(ConcentrationProduct): # pylint: disable=too-many-arguments def __init__( self, radius_range=(0, np.inf), specific=False, stp=False, name=None, unit="m^-3", ): self.radius_range = radius_range super().__init__(name=name, unit=unit, specific=specific, stp=stp) def _impl(self, **kwargs): self._download_moment_to_buffer( attr="water mass", rank=0, filter_range=( self.formulae.particle_shape_and_density.volume_to_mass( self.formulae.trivia.volume(radius=self.radius_range[0]) ), self.formulae.particle_shape_and_density.volume_to_mass( self.formulae.trivia.volume(self.radius_range[1]) ), ), ) return super()._impl(**kwargs)
Ancestors
- ConcentrationProduct
- MomentProduct
- Product
- abc.ABC
Subclasses
Inherited members
class ParticleSpecificConcentration (radius_range=(0, inf), name=None, unit='kg^-1')
-
Helper class that provides a standard way to create an ABC using inheritance.
stp
toggles expressing the concentration in terms of standard temperature and pressure conditions (ground level of the ICAO standard atmosphere, zero humidity)Expand source code
class ParticleSpecificConcentration(ParticleConcentration): def __init__(self, radius_range=(0, np.inf), name=None, unit="kg^-1"): super().__init__(radius_range=radius_range, specific=True, name=name, unit=unit)
Ancestors
Inherited members