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)
1""" 2concentration of particles within a grid cell (either per-volume of per-mass-of-dry air, 3 optionally restricted to a given size range) 4""" 5 6import numpy as np 7 8from PySDM.products.impl import ConcentrationProduct, register_product 9 10 11@register_product() 12class ParticleConcentration(ConcentrationProduct): 13 # pylint: disable=too-many-arguments 14 def __init__( 15 self, 16 radius_range=(0, np.inf), 17 specific=False, 18 stp=False, 19 name=None, 20 unit="m^-3", 21 ): 22 self.radius_range = radius_range 23 super().__init__(name=name, unit=unit, specific=specific, stp=stp) 24 25 def _impl(self, **kwargs): 26 self._download_moment_to_buffer( 27 attr="water mass", 28 rank=0, 29 filter_range=( 30 self.formulae.particle_shape_and_density.volume_to_mass( 31 self.formulae.trivia.volume(radius=self.radius_range[0]) 32 ), 33 self.formulae.particle_shape_and_density.volume_to_mass( 34 self.formulae.trivia.volume(self.radius_range[1]) 35 ), 36 ), 37 ) 38 return super()._impl(**kwargs) 39 40 41@register_product() 42class ParticleSpecificConcentration(ParticleConcentration): 43 def __init__(self, radius_range=(0, np.inf), name=None, unit="kg^-1"): 44 super().__init__(radius_range=radius_range, specific=True, name=name, unit=unit)
@register_product()
class
ParticleConcentration12@register_product() 13class ParticleConcentration(ConcentrationProduct): 14 # pylint: disable=too-many-arguments 15 def __init__( 16 self, 17 radius_range=(0, np.inf), 18 specific=False, 19 stp=False, 20 name=None, 21 unit="m^-3", 22 ): 23 self.radius_range = radius_range 24 super().__init__(name=name, unit=unit, specific=specific, stp=stp) 25 26 def _impl(self, **kwargs): 27 self._download_moment_to_buffer( 28 attr="water mass", 29 rank=0, 30 filter_range=( 31 self.formulae.particle_shape_and_density.volume_to_mass( 32 self.formulae.trivia.volume(radius=self.radius_range[0]) 33 ), 34 self.formulae.particle_shape_and_density.volume_to_mass( 35 self.formulae.trivia.volume(self.radius_range[1]) 36 ), 37 ), 38 ) 39 return super()._impl(**kwargs)
Helper class that provides a standard way to create an ABC using inheritance.
ParticleConcentration( radius_range=(0, inf), specific=False, stp=False, name=None, unit='m^-3')
15 def __init__( 16 self, 17 radius_range=(0, np.inf), 18 specific=False, 19 stp=False, 20 name=None, 21 unit="m^-3", 22 ): 23 self.radius_range = radius_range 24 super().__init__(name=name, unit=unit, specific=specific, stp=stp)
stp
toggles expressing the concentration in terms of standard temperature
and pressure conditions (ground level of the ICAO standard atmosphere, zero humidity)
Inherited Members
42@register_product() 43class ParticleSpecificConcentration(ParticleConcentration): 44 def __init__(self, radius_range=(0, np.inf), name=None, unit="kg^-1"): 45 super().__init__(radius_range=radius_range, specific=True, name=name, unit=unit)
Helper class that provides a standard way to create an ABC using inheritance.
ParticleSpecificConcentration(radius_range=(0, inf), name=None, unit='kg^-1')
44 def __init__(self, radius_range=(0, np.inf), name=None, unit="kg^-1"): 45 super().__init__(radius_range=radius_range, specific=True, name=name, unit=unit)
stp
toggles expressing the concentration in terms of standard temperature
and pressure conditions (ground level of the ICAO standard atmosphere, zero humidity)