-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lowe et al. 2019 Fig S2 (+smoke tests); new optical formulae and prod…
…ucts (optical depth & albedo); LWP product; activation-filtered r_eff product; cleanups (#1256) Co-authored-by: Sanky <76765634+bhiogade@users.noreply.github.com> Co-authored-by: Sanket Bhiogade <sbhiogade@agh.edu.pl> Co-authored-by: Sylwester Arabas <sylwester.arabas@agh.edu.pl> Co-authored-by: claresinger <clareees@gmail.com>
- Loading branch information
1 parent
809e15d
commit cb50957
Showing
45 changed files
with
1,046 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
""" | ||
alternative formulations of cloud albedo | ||
""" | ||
|
||
from .bohren1987 import Bohren1987 | ||
from .null import Null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
""" | ||
[Bohren 1987](https://doi.org/10.1119/1.15109) Eq. 14 | ||
""" | ||
|
||
|
||
class Bohren1987: # pylint: disable=too-few-public-methods | ||
def __init__(self, _): | ||
pass | ||
|
||
@staticmethod | ||
def albedo(const, tau): | ||
return ((const.ONE - const.asymmetry_g) * tau) / ( | ||
const.TWO + (const.ONE - const.asymmetry_g) * tau | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
""" | ||
null (default) class | ||
""" | ||
|
||
|
||
class Null: # pylint: disable=too-few-public-methods | ||
def __init__(self, _): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
""" | ||
alternative formulations of optical depth | ||
""" | ||
|
||
from .stephens_1978 import Stephens1978 | ||
from .null import Null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
""" | ||
null (default) class | ||
""" | ||
|
||
|
||
class Null: # pylint: disable=too-few-public-methods | ||
def __init__(self, _): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" | ||
[Stephens 1978](https://doi.org/10.1175/1520-0469(1978)035%3C2123:RPIEWC%3E2.0.CO;2) | ||
Eq. 7 for optical depth, where LWP is in g/m^2 and reff is in um. | ||
""" | ||
|
||
|
||
class Stephens1978: # pylint: disable=too-few-public-methods | ||
def __init__(self, _): | ||
pass | ||
|
||
@staticmethod | ||
def tau(const, LWP, reff): | ||
return (const.ONE_AND_A_HALF * LWP) / (const.rho_w * reff) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
""" cloud optical properties """ | ||
|
||
from .cloud_optical_depth import CloudOpticalDepth | ||
from .cloud_albedo import CloudAlbedo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" | ||
cloud albedo | ||
""" | ||
|
||
from PySDM.products.impl.product import Product | ||
|
||
|
||
class CloudAlbedo(Product): | ||
def __init__(self, *, unit="dimensionless", name=None): | ||
super().__init__(name=name, unit=unit) | ||
|
||
def _impl(self, **kwargs): | ||
return self.formulae.optical_albedo.albedo(kwargs["optical_depth"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
cloud optical depth | ||
""" | ||
|
||
from PySDM.products.impl.product import Product | ||
|
||
|
||
class CloudOpticalDepth(Product): | ||
def __init__(self, *, unit="dimensionless", name=None): | ||
super().__init__(name=name, unit=unit) | ||
|
||
def _impl(self, **kwargs): | ||
return self.formulae.optical_depth.tau( | ||
kwargs["liquid_water_path"], | ||
kwargs["effective_radius"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
""" products specific to the parcel environment """ | ||
|
||
from .cloud_water_path import ParcelLiquidWaterPath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
""" | ||
cloud water path integrated over parcel displacement taking into account changes | ||
in parcel volume along the way | ||
""" | ||
|
||
from PySDM.environments.parcel import Parcel | ||
|
||
from PySDM.products.impl.activation_filtered_product import _ActivationFilteredProduct | ||
from PySDM.products.impl.moment_product import MomentProduct | ||
|
||
|
||
class ParcelLiquidWaterPath(MomentProduct, _ActivationFilteredProduct): | ||
def __init__( | ||
self, | ||
count_unactivated: bool, | ||
count_activated: bool, | ||
name=None, | ||
unit="kg/m^2", | ||
): | ||
MomentProduct.__init__(self, unit=unit, name=name) | ||
_ActivationFilteredProduct.__init__( | ||
self, count_activated=count_activated, count_unactivated=count_unactivated | ||
) | ||
self.previous = {"z": 0.0, "cwc": 0.0} | ||
self.cwp = 0.0 | ||
|
||
def register(self, builder): | ||
if not isinstance(builder.particulator.environment, Parcel): | ||
raise NotImplementedError() | ||
_ActivationFilteredProduct.register(self, builder) | ||
MomentProduct.register(self, builder) | ||
self.particulator.observers.append(self) | ||
|
||
def notify(self): | ||
_ActivationFilteredProduct.impl(self, attr="water mass", rank=1) | ||
avg_mass = self.buffer.copy() | ||
|
||
_ActivationFilteredProduct.impl(self, attr="water mass", rank=0) | ||
tot_numb = self.buffer.copy() | ||
|
||
self._download_to_buffer(self.particulator.environment["z"]) | ||
current_z = self.buffer.copy() | ||
|
||
cwc = avg_mass * tot_numb / self.particulator.mesh.dv | ||
dz = current_z - self.previous["z"] | ||
cwc_mean = (cwc + self.previous["cwc"]) / 2 | ||
|
||
if self.previous["cwc"] > 0: | ||
self.cwp += cwc_mean * dz | ||
|
||
self.previous["z"] = current_z | ||
self.previous["cwc"] = cwc | ||
|
||
def _impl(self, **kwargs): | ||
return self.cwp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.