diff --git a/.github/workflows/ndsl-checks.yml b/.github/workflows/ndsl-checks.yml index 6abff0f82..476bf4aa5 100644 --- a/.github/workflows/ndsl-checks.yml +++ b/.github/workflows/ndsl-checks.yml @@ -33,6 +33,7 @@ jobs: cd ndsl pip install -e .[develop] pip install -e ../GCMGridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist + pip install pylint==3.2.6 - name: Run lint via pre-commit run: | cd ./GCMGridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/.pre-commit-config.yaml b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/.pre-commit-config.yaml index 4f45b4bab..caa8dd04b 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/.pre-commit-config.yaml +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/.pre-commit-config.yaml @@ -4,22 +4,12 @@ default_language_version: files: pyMoist repos: -- repo: https://github.com/psf/black - rev: 20.8b1 - hooks: - - id: black - additional_dependencies: ["click==8.0.4"] - -- repo: https://github.com/pre-commit/mirrors-isort - rev: v5.4.2 - hooks: - - id: isort - args: ["--profile", "black"] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.4.1 hooks: - id: mypy + description: Perform static type analysis of Python code name: mypy-pyMoist args: [ --ignore-missing-imports, @@ -35,31 +25,40 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.3.0 hooks: + - id: check-added-large-files + - id: check-ast + - id: check-case-conflict + - id: check-merge-conflict - id: check-toml - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace -- repo: https://github.com/pycqa/flake8 - rev: 3.9.2 +- repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + name: codespell + description: Check for spelling errors + entry: codespell + args: ["--ignore-words","GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/ignored_codespell.txt"] + +- repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.6.0 + hooks: + # Run the linter. + - id: ruff + name: ruff linting + args: [--fix ] + # Run the formatter. + - id: ruff-format + name: ruff formatting +- repo: local hooks: - - id: flake8 - name: flake8 - language_version: python3 - args: [ - "--exclude=docs", - "--ignore=W503,E302,E203,F841", - "--max-line-length=88" - ] - exclude: | - (?x)^( - .*/__init__.py | - )$ - - id: flake8 - name: flake8 __init__.py files - files: "__init__.py" - # ignore unused import error in __init__.py files - args: [ - "--exclude=docs", - "--ignore=W503,E302,E203,F841,F401", - "--max-line-length=88",] + - id: pylint + name: pylint + language: system + entry: pylint + args: + - --rcfile=GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/.pylintrc diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/.pylintrc b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/.pylintrc new file mode 100644 index 000000000..1797c34bf --- /dev/null +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/.pylintrc @@ -0,0 +1,6 @@ +[MAIN] +ignore-patterns=^__init__.py$ + +[FORMAT] +# Maximum number of characters on a single line. +max-line-length=100 diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/README.md b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/README.md index 260b05e09..d4699b23b 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/README.md +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/README.md @@ -14,4 +14,4 @@ The `interface` sub-directory contain the three-way bridge to and from GEOS. ## Develop -- Run `pre-commit run --all-files` before comitting for code guidelines coherency. +- Run `pre-commit run --all-files` before committing for code guidelines coherency. diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/ignored_codespell.txt b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/ignored_codespell.txt new file mode 100644 index 000000000..3fe524d2a --- /dev/null +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/ignored_codespell.txt @@ -0,0 +1,3 @@ +THIRDPARTY +dum +te diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/aer_activation.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/aer_activation.py index d5b441347..717eecfec 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/aer_activation.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/aer_activation.py @@ -1,14 +1,16 @@ import copy from gt4py.cartesian.gtscript import PARALLEL, computation, exp, interval, log, sqrt - -import pyMoist.aer_activation_constants as constants from ndsl import QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, Y_DIM, Z_DIM from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, Int -from pyMoist.numerical_recipes import Erf + +import pyMoist.aer_activation_constants as constants +from pyMoist.numerical_recipes import error_function from pyMoist.types import FloatField_NModes +# ruff: noqa: PLR0913,PLR0915 + def aer_activation_stencil( aero_dgn: FloatField_NModes, @@ -67,7 +69,6 @@ def aer_activation_stencil( None """ with computation(PARALLEL), interval(...): - # Compute nwfa # Fortran AeroProps aero_kap is aero_hygroscopicity nfaux = 0.0 @@ -99,14 +100,17 @@ def aer_activation_stencil( n = 0 while n < constants.n_modes: ni[0, 0, 0][n] = max( - aero_num[0, 0, 0][n] * air_den, constants.ZERO_PAR + aero_num[0, 0, 0][n] * air_den, + constants.ZERO_PAR, ) # unit: [m-3] rg[0, 0, 0][n] = max( - aero_dgn[0, 0, 0][n] * 0.5 * 1.0e6, constants.ZERO_PAR + aero_dgn[0, 0, 0][n] * 0.5 * 1.0e6, + constants.ZERO_PAR, ) # unit: [um] sig0[0, 0, 0][n] = aero_sigma[0, 0, 0][n] # unit: [um] bibar[0, 0, 0][n] = max( - aero_hygroscopicity[0, 0, 0][n], constants.ZERO_PAR + aero_hygroscopicity[0, 0, 0][n], + constants.ZERO_PAR, ) n += 1 @@ -147,43 +151,32 @@ def aer_activation_stencil( # These variables are common to all modes and need only be computed once. dv = ( - constants.DIJH2O0 - * (constants.P0DIJ / plo) - * (tk / constants.T0DIJ) ** 1.94e00 + constants.DIJH2O0 * (constants.P0DIJ / plo) * (tk / constants.T0DIJ) ** 1.94e00 ) # [m^2/s] (p&k,2nd ed., p.503) surten = 76.10e-3 - 0.155e-3 * (tk - 273.15e00) # [j/m^2] wpe = exp( - 77.34491296 - 7235.424651 / tk - 8.2 * log(tk) + tk * 5.7113e-3 + 77.34491296 - 7235.424651 / tk - 8.2 * log(tk) + tk * 5.7113e-3, ) # [pa] dumw = sqrt( - constants.TWOPI * constants.WMOLMASS / constants.RGASJMOL / tk + constants.TWOPI * constants.WMOLMASS / constants.RGASJMOL / tk, ) # [s/m] dvprime = dv / ( - (rdrp / (rdrp + constants.DELTAV)) - + (dv * dumw / (rdrp * constants.ALPHAC)) + (rdrp / (rdrp + constants.DELTAV)) + (dv * dumw / (rdrp * constants.ALPHAC)) ) # [m^2/s] - eq. (17) xka = ( 5.69 + 0.017 * (tk - 273.15) ) * 418.4e-5 # [j/m/s/k] (0.0238 j/m/s/k at 273.15 k) duma = sqrt( - constants.TWOPI * constants.AMOLMASS / constants.RGASJMOL / tk + constants.TWOPI * constants.AMOLMASS / constants.RGASJMOL / tk, ) # [s/m] xkaprime = xka / ( (rdrp / (rdrp + constants.DELTAT)) - + ( - xka - * duma - / (rdrp * constants.ALPHAT * constants.DENH2O * constants.CPAIR) - ) + + (xka * duma / (rdrp * constants.ALPHAT * constants.DENH2O * constants.CPAIR)) ) # [j/m/s/k] g = 1.0 / ( - (constants.DENH2O * constants.RGASJMOL * tk) - / (wpe * dvprime * constants.WMOLMASS) + (constants.DENH2O * constants.RGASJMOL * tk) / (wpe * dvprime * constants.WMOLMASS) + ((constants.HEATVAP * constants.DENH2O) / (xkaprime * tk)) - * ( - (constants.HEATVAP * constants.WMOLMASS) / (constants.RGASJMOL * tk) - - 1.0 - ) + * ((constants.HEATVAP * constants.WMOLMASS) / (constants.RGASJMOL * tk) - 1.0) ) # [m^2/s] a = (2.0 * surten * constants.WMOLMASS) / ( constants.DENH2O * constants.RGASJMOL * tk @@ -194,10 +187,8 @@ def aer_activation_stencil( ) # [1/m] gamma = (constants.RGASJMOL * tk) / (wpe * constants.WMOLMASS) + ( constants.WMOLMASS * constants.HEATVAP * constants.HEATVAP - ) / ( - constants.CPAIR * plo * constants.AMOLMASS * tk - ) # [m^3/kg] - dum = sqrt(alpha * wupdraft / g) # [1/m] + ) / (constants.CPAIR * plo * constants.AMOLMASS * tk) # [m^3/kg] + dum: None = sqrt(alpha * wupdraft / g) # [1/m] zeta = 2.0 * a * dum / 3.0 # [1] # These variables must be computed for each mode @@ -205,21 +196,13 @@ def aer_activation_stencil( while n < constants.n_modes: xlogsigm = log(sig0[0, 0, 0][n]) # [1] smax = 0.0 # [1] - sm = (2.0 / sqrt(bibar[0, 0, 0][n])) * ( - a / (3.0 * rg[0, 0, 0][n]) - ) ** 1.5 # [1] - eta = dum ** 3 / ( - constants.TWOPI * constants.DENH2O * gamma * ni[0, 0, 0][n] - ) # [1] - f1 = 0.5 * exp(2.50 * xlogsigm ** 2) # [1] + sm = (2.0 / sqrt(bibar[0, 0, 0][n])) * (a / (3.0 * rg[0, 0, 0][n])) ** 1.5 # [1] + eta = dum**3 / (constants.TWOPI * constants.DENH2O * gamma * ni[0, 0, 0][n]) # [1] + f1 = 0.5 * exp(2.50 * xlogsigm**2) # [1] f2 = 1.0 + 0.25 * xlogsigm # [1] smax = ( smax - + ( - f1 * (zeta / eta) ** 1.5 - + f2 * (sm ** 2 / (eta + 3.0 * zeta)) ** 0.75 - ) - / sm ** 2 + + (f1 * (zeta / eta) ** 1.5 + f2 * (sm**2 / (eta + 3.0 * zeta)) ** 0.75) / sm**2 ) # [1] - eq. (6) n += 1 @@ -227,13 +210,11 @@ def aer_activation_stencil( n = 0 u = 0.0 while n < constants.n_modes: - sm = (2.0 / sqrt(bibar[0, 0, 0][n])) * ( - a / (3.0 * rg[0, 0, 0][n]) - ) ** 1.5 # [1] + sm = (2.0 / sqrt(bibar[0, 0, 0][n])) * (a / (3.0 * rg[0, 0, 0][n])) ** 1.5 # [1] xlogsigm = log(sig0[0, 0, 0][n]) # [1] ac = rg[0, 0, 0][n] * (sm / smax) ** 0.66666666666666667 # [um] u = log(ac / rg[0, 0, 0][n]) / (constants.SQRT2 * xlogsigm) # [1] - fracactn = 0.5 * (1.0 - Erf(u)) # [1] + fracactn = 0.5 * (1.0 - error_function(u)) # [1] nact[0, 0, 0][n] = fracactn * ni[0, 0, 0][n] # [#/m^3] n += 1 @@ -247,9 +228,7 @@ def aer_activation_stencil( nactl = min(nactl, 0.99 * numbinit) # Ice Clouds Calculation - if (tk <= constants.MAPL_TICE) and ( - qi > constants.FLOAT_TINY or ql > constants.FLOAT_TINY - ): + if (tk <= constants.MAPL_TICE) and (qi > constants.FLOAT_TINY or ql > constants.FLOAT_TINY): numbinit = 0.0 n = 0 while n < constants.n_modes: @@ -262,21 +241,14 @@ def aer_activation_stencil( nacti = ( constants.AI * ((constants.MAPL_TICE - tk) ** constants.BI) - * ( - numbinit - ** (constants.CI * (constants.MAPL_TICE - tk) + constants.DI) - ) + * (numbinit ** (constants.CI * (constants.MAPL_TICE - tk) + constants.DI)) ) # apply limits for NACTL/NACTI - if nactl < constants.NN_MIN: - nactl = constants.NN_MIN - if nactl > constants.NN_MAX: - nactl = constants.NN_MAX - if nacti < constants.NN_MIN: - nacti = constants.NN_MIN - if nacti > constants.NN_MAX: - nacti = constants.NN_MAX + nactl = max(nactl, constants.NN_MIN) + nactl = min(nactl, constants.NN_MAX) + nacti = max(nacti, constants.NN_MIN) + nacti = min(nacti, constants.NN_MAX) class AerActivation: @@ -287,7 +259,7 @@ class AerActivation: stencil_factory (StencilFactory): Factory for creating stencil computations. quantity_factory (QuantityFactory): Factory for creating quantities. n_modes (Int): Number of aerosol modes. - USE_AERSOL_NN (bool): Flag indicating whether to use neural network for aerosol. + use_aersol_nn (bool): Flag indicating whether to use neural network for aerosol. """ def __init__( @@ -295,7 +267,7 @@ def __init__( stencil_factory: StencilFactory, quantity_factory: QuantityFactory, n_modes: Int, - USE_AERSOL_NN: bool, + use_aersol_nn: bool, ) -> None: """ Initialize the AerActivation class. @@ -304,7 +276,7 @@ def __init__( stencil_factory (StencilFactory): Factory for creating stencil computations. quantity_factory (QuantityFactory): Factory for creating quantities. n_modes (Int): Number of aerosol modes. - USE_AERSOL_NN (bool): Flag indicating whether to use neural network for aerosol. + use_aersol_nn (bool): Flag indicating whether to use neural network for aerosol. Raises: NotImplementedError: If the number of modes is not equal to the expected number. @@ -314,15 +286,15 @@ def __init__( if constants.n_modes != n_modes: raise NotImplementedError( - f"Coding limitation: 14 modes are expected, getting {n_modes}" + f"Coding limitation: 14 modes are expected, getting {n_modes}", ) - if not USE_AERSOL_NN: + if not use_aersol_nn: raise NotImplementedError("Non NN Aerosol not implemented") # Temporary buffers nmodes_quantity_factory = AerActivation.make_nmodes_quantity_factory( - quantity_factory + quantity_factory, ) self._nact = nmodes_quantity_factory.zeros( [X_DIM, Y_DIM, Z_DIM, "n_modes"], @@ -362,7 +334,7 @@ def make_nmodes_quantity_factory(ijk_quantity_factory: QuantityFactory): nmodes_quantity_factory.set_extra_dim_lengths( **{ "n_modes": constants.n_modes, - } + }, ) return nmodes_quantity_factory diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/aer_activation_constants.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/aer_activation_constants.py index 0b386982b..1d8958c4d 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/aer_activation_constants.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/aer_activation_constants.py @@ -1,8 +1,6 @@ import numpy as np - from ndsl.dsl.typing import Float - """ All global constants used for aer_actv_single_moment.F90 """ @@ -58,5 +56,5 @@ # Define how many modes in an aerosol n_modes = 14 -# Python euqivalent of Fortran's tiny(X) +# Python equivalent of Fortran's tiny(X) FLOAT_TINY = np.finfo(Float).tiny diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/numerical_recipes.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/numerical_recipes.py index 1b14136e7..4392cf2c1 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/numerical_recipes.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/numerical_recipes.py @@ -1,11 +1,10 @@ -import gt4py.cartesian.gtscript as gtscript +from gt4py.cartesian import gtscript from gt4py.cartesian.gtscript import exp, log - from ndsl.dsl.typing import Float @gtscript.function -def GammLn(xx: Float) -> Float: +def log_of_gamma(xx: Float) -> Float: """ See numerical recipes, w. press et al., 2nd edition. @@ -24,17 +23,17 @@ def GammLn(xx: Float) -> Float: y = x tmp = x + 5.5 tmp = (x + 0.5) * log(tmp) - tmp - ser = 1.000000000190015 + stirling_approximation = 1.000000000190015 - ser += 76.18009172947146 / (y + 1) - ser += -86.50532032941677 / (y + 1) - ser += 24.01409824083091 / (y + 1) - ser += -1.231739572450155 / (y + 1) - ser += 0.001208650973866179 / (y + 1) - ser += -0.000005395239384953 / (y + 1) + stirling_approximation += 76.18009172947146 / (y + 1) + stirling_approximation += -86.50532032941677 / (y + 1) + stirling_approximation += 24.01409824083091 / (y + 1) + stirling_approximation += -1.231739572450155 / (y + 1) + stirling_approximation += 0.001208650973866179 / (y + 1) + stirling_approximation += -0.000005395239384953 / (y + 1) - gammln = tmp + log(stp * ser / x) - return gammln + log_of_gamma = tmp + log(stp * stirling_approximation / x) + return log_of_gamma @gtscript.function @@ -54,7 +53,7 @@ def gser(a: Float, x: Float, gln: Float) -> Float: """ eps = 3.0e-9 # was eps=3.0d-07 in press et al. itmax = 10000 # was itmax=100 in press et al. - gln = GammLn(a) + gln = log_of_gamma(a) if x <= 0: # Fortran messages here x < 0 in gser # TODO: Allow print in GT4Py @@ -96,7 +95,7 @@ def gcf_matrix(a: Float, x: Float, gln: Float) -> Float: itmax = 10000 eps = 3.0e-7 fpmin = 1.0e-30 - gln = GammLn(a) + gln = log_of_gamma(a) b = x + 1.0 - a c = 1.0 / fpmin d = 1.0 / b @@ -122,7 +121,7 @@ def gcf_matrix(a: Float, x: Float, gln: Float) -> Float: @gtscript.function -def GammP(a: Float, x: Float) -> Float: +def incomplete_gamma(a: Float, x: Float) -> Float: """ See numerical recipes, w. press et al., 2nd edition. @@ -139,7 +138,7 @@ def GammP(a: Float, x: Float) -> Float: # TODO: Allow print in GT4Py # if (x < 0.0) or (a <= 0.0): # raise ValueError("aero_actv: function gammp: bad arguments") - gln = GammLn(a) + gln = log_of_gamma(a) if x < a + 1.0: gammp = gser(a, x, gln) else: @@ -148,7 +147,7 @@ def GammP(a: Float, x: Float) -> Float: @gtscript.function -def Erf(x: Float) -> Float: +def error_function(x: Float) -> Float: """ See numerical recipes, w. press et al., 2nd edition. @@ -162,7 +161,7 @@ def Erf(x: Float) -> Float: """ erf = 0.0 if x < 0.0e00: - erf = -1.0 * GammP(0.5, x ** 2) + erf = -1.0 * incomplete_gamma(0.5, x**2) else: - erf = GammP(0.5, x ** 2) + erf = incomplete_gamma(0.5, x**2) return erf diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/radiation_coupling.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/radiation_coupling.py index a38fc4672..4ed020a51 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/radiation_coupling.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/radiation_coupling.py @@ -1,35 +1,42 @@ -import gt4py.cartesian.gtscript as gtscript -from gt4py.cartesian.gtscript import PARALLEL, computation, interval, log10 - -import pyMoist.radiation_coupling_constants as radconstants +# pylint: ignore reportInvalidTypeForm +from gt4py.cartesian import gtscript +from gt4py.cartesian.gtscript import ( + PARALLEL, + computation, + interval, + log10, +) from ndsl import QuantityFactory, StencilFactory from ndsl.constants import X_DIM, Y_DIM, Z_DIM from ndsl.dsl.typing import Float, FloatField +import pyMoist.radiation_coupling_constants as radconstants + +# ruff: noqa: PLR0913 + @gtscript.function -def air_density(PL: Float, TE: Float) -> Float: +def air_density(pl: Float, te: Float) -> Float: """ Calculate air density [kg/m^3] Parameters: - PL (Float): Pressure level. - TE (Float): Temperature. + pl (Float): Pressure level. + te (Float): Temperature. Returns: Float: Calculated air density. + """ - air_density = (100.0 * PL) / (radconstants.MAPL_RGAS * TE) + air_density = (100.0 * pl) / (radconstants.MAPL_RGAS * te) return air_density @gtscript.function def cloud_effective_radius_ice( - PL: Float, - TE: Float, - QC: Float, - NNL: Float, - NNI: Float, + pl: Float, + te: Float, + qc: Float, ) -> Float: """ Calculate the effective radius of ice clouds [m] @@ -38,268 +45,265 @@ def cloud_effective_radius_ice( Parameters: PL (Float): Pressure level. TE (Float): Temperature. - QC (Float): Ice cloud mixing ratio. - NNL (Float): Number concentration of liquid cloud droplets. - Not used in function body, but included in the Fortran code. - NNI (Float): Number concentration of ice cloud crystals. - Not used in function body, but included in the Fortran code. + qc (Float): Ice cloud mixing ratio. Returns: Float: Effective radius of ice clouds. """ # Calculate ice water content - WC = ( - 1.0e3 * air_density(PL, TE) * QC - ) # air density [g/m3] * ice cloud mixing ratio [kg/kg] + wc = 1.0e3 * air_density(pl, te) * qc # air density [g/m3] * ice cloud mixing ratio [kg/kg] # Calculate radius in meters [m] if radconstants.ICE_RADII_PARAM == 1: # Ice cloud effective radius -- [klaus wyser, 1998] - if TE > radconstants.MAPL_TICE or QC <= 0.0: - BB = -2.0 + if te > radconstants.MAPL_TICE or qc <= 0.0: + bb = -2.0 else: - BB = -2.0 + log10(WC / 50.0) * ( - 1.0e-3 * (radconstants.MAPL_TICE - TE) ** 1.5 - ) - BB = min(max(BB, -6.0), -2.0) - RADIUS = 377.4 + 203.3 * BB + 37.91 * BB ** 2 + 2.3696 * BB ** 3 - RADIUS = min(150.0e-6, max(5.0e-6, 1.0e-6 * RADIUS)) + bb = -2.0 + log10(wc / 50.0) * (1.0e-3 * (radconstants.MAPL_TICE - te) ** 1.5) + bb = min(max(bb, -6.0), -2.0) + radius = 377.4 + 203.3 * bb + 37.91 * bb**2 + 2.3696 * bb**3 + radius = min(150.0e-6, max(5.0e-6, 1.0e-6 * radius)) else: # Ice cloud effective radius ----- [Sun, 2001] - TC = TE - radconstants.MAPL_TICE - ZFSR = 1.2351 + 0.0105 * TC - AA = 45.8966 * (WC ** 0.2214) - BB = 0.79570 * (WC ** 0.2535) - RADIUS = ZFSR * (AA + BB * (TE - 83.15)) - RADIUS = min(150.0e-6, max(5.0e-6, 1.0e-6 * RADIUS * 0.64952)) - return RADIUS + tc = te - radconstants.MAPL_TICE + zfsr = 1.2351 + 0.0105 * tc + aa = 45.8966 * (wc**0.2214) + bb = 0.79570 * (wc**0.2535) + radius = zfsr * (aa + bb * (te - 83.15)) + radius = min(150.0e-6, max(5.0e-6, 1.0e-6 * radius * 0.64952)) + return radius @gtscript.function def cloud_effective_radius_liquid( - PL: Float, - TE: Float, - QC: Float, - NNL: Float, - NNI: Float, + pl: Float, + te: Float, + qc: Float, + nnl: Float, ) -> Float: """ Calculate the effective radius of liquid clouds [m] Implementation of LDRADIUS4 for liquid clouds Parameters: - PL (Float): Pressure level. - TE (Float): Temperature. - QC (Float): Liquid cloud mixing ratio. - NNL (Float): Number concentration of liquid cloud droplets. - NNI (Float): Number concentration of ice cloud crystals. Not used in function body. + pl (Float): Pressure level. + te (Float): Temperature. + qc (Float): Liquid cloud mixing ratio. + nnl (Float): Number concentration of liquid cloud droplets. Returns: Float: Effective radius of liquid clouds. """ # Calculate liquid water content - WC = ( - 1.0e3 * air_density(PL, TE) * QC + liquid_water_content = ( + 1.0e3 * air_density(pl, te) * qc ) # air density [g/m3] * liquid cloud mixing ratio [kg/kg] # Calculate cloud drop number concentration from the aerosol model + .... - NNX = max(NNL * 1.0e-6, 10.0) + nnx = max(nnl * 1.0e-6, 10.0) # Calculate Radius in meters [m] if radconstants.LIQ_RADII_PARAM == 1: # Jason Version - RADIUS = min( + radius = min( 60.0e-6, max( 2.5e-6, 1.0e-6 * radconstants.BX - * (WC / NNX) ** radconstants.R13BBETA + * (liquid_water_content / nnx) ** radconstants.R13BBETA * radconstants.ABETA * 6.92, ), ) else: # [liu&daum, 2000 and 2005. liu et al 2008] - RADIUS = min( + radius = min( 60.0e-6, - max(2.5e-6, 1.0e-6 * radconstants.LBX * (WC / NNX) ** radconstants.LBE), + max( + 2.5e-6, + 1.0e-6 * radconstants.LBX * (liquid_water_content / nnx) ** radconstants.LBE, + ), ) - return RADIUS + return radius def _fix_up_clouds_stencil( - QV: FloatField, - TE: FloatField, - QLC: FloatField, - QIC: FloatField, - CF: FloatField, - QLA: FloatField, - QIA: FloatField, - AF: FloatField, + qv: FloatField, + te: FloatField, + q_lc: FloatField, + q_ic: FloatField, + cf: FloatField, + q_la: FloatField, + q_ia: FloatField, + af: FloatField, ) -> None: """ Fix cloud variables to ensure physical consistency. Parameters: - QV (FloatField): Water vapor mixing ratio. - TE (FloatField): Temperature. - QLC (FloatField): Liquid cloud mixing ratio. - QIC (FloatField): Ice cloud mixing ratio. - CF (FloatField): Cloud fraction. - QLA (FloatField): Anvil liquid cloud mixing ratio. - QIA (FloatField): Anvil ice cloud mixing ratio. - AF (FloatField): Anvil cloud fraction. + qv (FloatField): Water vapor mixing ratio. + te (FloatField): Temperature. + q_lc (FloatField): Liquid cloud mixing ratio. + q_ic (FloatField): Ice cloud mixing ratio. + cf (FloatField): Cloud fraction. + q_la (FloatField): Anvil liquid cloud mixing ratio. + q_ia (FloatField): Anvil ice cloud mixing ratio. + af (FloatField): Anvil cloud fraction. """ with computation(PARALLEL), interval(...): # Fix if Anvil cloud fraction too small - if AF < 1.0e-5: - QV = QV + QLA + QIA - TE = TE - (radconstants.ALHLBCP) * QLA - (radconstants.ALHSBCP) * QIA - AF = 0.0 - QLA = 0.0 - QIA = 0.0 + if af < 1.0e-5: + qv = qv + q_la + q_ia + te = te - (radconstants.ALHLBCP) * q_la - (radconstants.ALHSBCP) * q_ia + af = 0.0 + q_la = 0.0 + q_ia = 0.0 # Fix if LS cloud fraction too small - if CF < 1.0e-5: - QV = QV + QLC + QIC - TE = TE - (radconstants.ALHLBCP) * QLC - (radconstants.ALHSBCP) * QIC - CF = 0.0 - QLC = 0.0 - QIC = 0.0 + if cf < 1.0e-5: + qv = qv + q_lc + q_ic + te = te - (radconstants.ALHLBCP) * q_lc - (radconstants.ALHSBCP) * q_ic + cf = 0.0 + q_lc = 0.0 + q_ic = 0.0 # LS LIQUID too small - if QLC < 1.0e-8: - QV = QV + QLC - TE = TE - (radconstants.ALHLBCP) * QLC - QLC = 0.0 + if q_lc < 1.0e-8: + qv = qv + q_lc + te = te - (radconstants.ALHLBCP) * q_lc + q_lc = 0.0 # LS ICE too small - if QIC < 1.0e-8: - QV = QV + QIC - TE = TE - (radconstants.ALHSBCP) * QIC - QIC = 0.0 + if q_ic < 1.0e-8: + qv = qv + q_ic + te = te - (radconstants.ALHSBCP) * q_ic + q_ic = 0.0 # Anvil LIQUID too small - if QLA < 1.0e-8: - QV = QV + QLA - TE = TE - (radconstants.ALHLBCP) * QLA - QLA = 0.0 + if q_la < 1.0e-8: + qv = qv + q_la + te = te - (radconstants.ALHLBCP) * q_la + q_la = 0.0 # Anvil ICE too small - if QIA < 1.0e-8: - QV = QV + QIA - TE = TE - (radconstants.ALHSBCP) * QIA - QIA = 0.0 + if q_ia < 1.0e-8: + qv = qv + q_ia + te = te - (radconstants.ALHSBCP) * q_ia + q_ia = 0.0 # Fix ALL cloud quants if Anvil cloud LIQUID+ICE too small - if (QLA + QIA) < 1.0e-8: - QV = QV + QLA + QIA - TE = TE - (radconstants.ALHLBCP) * QLA - (radconstants.ALHSBCP) * QIA - AF = 0.0 - QLA = 0.0 - QIA = 0.0 + if (q_la + q_ia) < 1.0e-8: + qv = qv + q_la + q_ia + te = te - (radconstants.ALHLBCP) * q_la - (radconstants.ALHSBCP) * q_ia + af = 0.0 + q_la = 0.0 + q_ia = 0.0 # Fix ALL cloud quants if LS cloud LIQUID+ICE too small - if (QLC + QIC) < 1.0e-8: - QV = QV + QLC + QIC - TE = TE - (radconstants.ALHLBCP) * QLC - (radconstants.ALHSBCP) * QIC - CF = 0.0 - QLC = 0.0 - QIC = 0.0 + if (q_lc + q_ic) < 1.0e-8: + qv = qv + q_lc + q_ic + te = te - (radconstants.ALHLBCP) * q_lc - (radconstants.ALHSBCP) * q_ic + cf = 0.0 + q_lc = 0.0 + q_ic = 0.0 def _radcouple_stencil( - TE: FloatField, - PL: FloatField, - CF: FloatField, - AF: FloatField, - QV: FloatField, - QClLS: FloatField, - QCiLS: FloatField, - QClAN: FloatField, - QCiAN: FloatField, - QRN_ALL: FloatField, - QSN_ALL: FloatField, - QGR_ALL: FloatField, - NL: FloatField, - NI: FloatField, - RAD_QV: FloatField, - RAD_QL: FloatField, - RAD_QI: FloatField, - RAD_QR: FloatField, - RAD_QS: FloatField, - RAD_QG: FloatField, - RAD_CF: FloatField, - RAD_RL: FloatField, - RAD_RI: FloatField, - FAC_RL: Float, - MIN_RL: Float, - MAX_RL: Float, - FAC_RI: Float, - MIN_RI: Float, - MAX_RI: Float, + te: FloatField, + pl: FloatField, + cf: FloatField, + af: FloatField, + qv: FloatField, + q_cl_ls: FloatField, + q_ci_ls: FloatField, + q_cl_an: FloatField, + q_ci_an: FloatField, + q_rn_all: FloatField, + q_sn_all: FloatField, + q_gr_all: FloatField, + nl: FloatField, + rad_qv: FloatField, # pylint: ignore W0613 + rad_ql: FloatField, + rad_qi: FloatField, + rad_qr: FloatField, + rad_qs: FloatField, + rad_qg: FloatField, + rad_cf: FloatField, + rad_rl: FloatField, + rad_ri: FloatField, + fac_rl: Float, + min_rl: Float, + max_rl: Float, + fac_ri: Float, + min_ri: Float, + max_ri: Float, ) -> None: """ Couple radiation with cloud variables to ensure physical consistency. Parameters: - TE (FloatField): Temperature. - PL (FloatField): Pressure level. - CF (FloatField): Cloud fraction. - AF (FloatField): Anvil cloud fraction. - QV (FloatField): Water vapor mixing ratio. - QClLS (FloatField): Liquid cloud mixing ratio (large-scale). - QCiLS (FloatField): Ice cloud mixing ratio (large-scale). - QClAN (FloatField): Liquid cloud mixing ratio (anvil). - QCiAN (FloatField): Ice cloud mixing ratio (anvil). - QRN_ALL (FloatField): Rain mixing ratio. - QSN_ALL (FloatField): Snow mixing ratio. - QGR_ALL (FloatField): Graupel mixing ratio. - NL (FloatField): Number concentration of liquid cloud droplets. - NI (FloatField): Number concentration of ice cloud crystals. - RAD_QV (FloatField): Radiation water vapor mixing ratio. - RAD_QL (FloatField): Radiation liquid cloud mixing ratio. - RAD_QI (FloatField): Radiation ice cloud mixing ratio. - RAD_QR (FloatField): Radiation rain mixing ratio. - RAD_QS (FloatField): Radiation snow mixing ratio. - RAD_QG (FloatField): Radiation graupel mixing ratio. - RAD_CF (FloatField): Radiation cloud fraction. - RAD_RL (FloatField): Radiation liquid effective radius. - RAD_RI (FloatField): Radiation ice effective radius. - FAC_RL (Float): Factor for liquid effective radius. - MIN_RL (Float): Minimum liquid effective radius. - MAX_RL (Float): Maximum liquid effective radius. - FAC_RI (Float): Factor for ice effective radius. - MIN_RI (Float): Minimum ice effective radius. - MAX_RI (Float): Maximum ice effective radius. + te (FloatField): Temperature. + pl (FloatField): Pressure level. + cf (FloatField): Cloud fraction. + af (FloatField): Anvil cloud fraction. + qv (FloatField): Water vapor mixing ratio. + q_cl_ls (FloatField): Liquid cloud mixing ratio (large-scale). + q_ci_ls (FloatField): Ice cloud mixing ratio (large-scale). + q_cl_an (FloatField): Liquid cloud mixing ratio (anvil). + q_ci_an (FloatField): Ice cloud mixing ratio (anvil). + q_rn_all (FloatField): Rain mixing ratio. + q_sn_all (FloatField): Snow mixing ratio. + q_gr_all (FloatField): Graupel mixing ratio. + nl (FloatField): Number concentration of liquid cloud droplets. + rad_qv (FloatField): Radiation water vapor mixing ratio. + rad_ql (FloatField): Radiation liquid cloud mixing ratio. + rad_qi (FloatField): Radiation ice cloud mixing ratio. + rad_qr (FloatField): Radiation rain mixing ratio. + rad_qs (FloatField): Radiation snow mixing ratio. + rad_qg (FloatField): Radiation graupel mixing ratio. + rad_cf (FloatField): Radiation cloud fraction. + rad_rl (FloatField): Radiation liquid effective radius. + rad_ri (FloatField): Radiation ice effective radius. + fac_rl (Float): Factor for liquid effective radius. + min_rl (Float): Minimum liquid effective radius. + max_rl (Float): Maximum liquid effective radius. + fac_ri (Float): Factor for ice effective radius. + min_ri (Float): Minimum ice effective radius. + max_ri (Float): Maximum ice effective radius. """ with computation(PARALLEL), interval(...): # water vapor - RAD_QV = QV + rad_qv = qv # total cloud fraction - RAD_CF = max(min(CF + AF, 1.0), 0.0) - if RAD_CF >= 1.0e-5: - RAD_QL = (QClLS + QClAN) / RAD_CF if (QClLS + QClAN) >= 1.0e-8 else 0.0 - RAD_QI = (QCiLS + QCiAN) / RAD_CF if (QCiLS + QCiAN) >= 1.0e-8 else 0.0 - RAD_QR = QRN_ALL / RAD_CF if QRN_ALL >= 1.0e-8 else 0.0 - RAD_QS = QSN_ALL / RAD_CF if QSN_ALL >= 1.0e-8 else 0.0 - RAD_QG = QGR_ALL / RAD_CF if QGR_ALL >= 1.0e-8 else 0.0 + rad_cf = max(min(cf + af, 1.0), 0.0) + if rad_cf >= 1.0e-5: + rad_ql = (q_cl_ls + q_cl_an) / rad_cf if (q_cl_ls + q_cl_an) >= 1.0e-8 else 0.0 + rad_qi = (q_ci_ls + q_ci_an) / rad_cf if (q_ci_ls + q_ci_an) >= 1.0e-8 else 0.0 + rad_qr = q_rn_all / rad_cf if q_rn_all >= 1.0e-8 else 0.0 + rad_qs = q_sn_all / rad_cf if q_sn_all >= 1.0e-8 else 0.0 + rad_qg = q_gr_all / rad_cf if q_gr_all >= 1.0e-8 else 0.0 else: - RAD_CF = 0.0 - RAD_QL = 0.0 - RAD_QI = 0.0 - RAD_QR = 0.0 - RAD_QS = 0.0 - RAD_QG = 0.0 + rad_cf = 0.0 + rad_ql = 0.0 + rad_qi = 0.0 + rad_qr = 0.0 + rad_qs = 0.0 + rad_qg = 0.0 # Cap the high end of condensates - RAD_QL = min(RAD_QL, 0.01) - RAD_QI = min(RAD_QI, 0.01) - RAD_QR = min(RAD_QR, 0.01) - RAD_QS = min(RAD_QS, 0.01) - RAD_QG = min(RAD_QG, 0.01) + rad_ql = min(rad_ql, 0.01) + rad_qi = min(rad_qi, 0.01) + rad_qr = min(rad_qr, 0.01) + rad_qs = min(rad_qs, 0.01) + rad_qg = min(rad_qg, 0.01) # Liquid radii - Brams formulation with limits - RAD_RL = max( - MIN_RL, - min(cloud_effective_radius_liquid(PL, TE, RAD_QL, NL, NI) * FAC_RL, MAX_RL), + rad_rl = max( + min_rl, + min( + cloud_effective_radius_liquid(pl, te, rad_ql, nl) * fac_rl, + max_rl, + ), ) # Ice radii - Brams formulation with limits - RAD_RI = max( - MIN_RI, - min(cloud_effective_radius_ice(PL, TE, RAD_QI, NL, NI) * FAC_RI, MAX_RI), + rad_ri = max( + min_ri, + min( + cloud_effective_radius_ice(pl, te, rad_qi) * fac_ri, + max_ri, + ), ) @@ -333,114 +337,113 @@ def __init__( if self.do_qa: # RHX = Q/GEOS_QSAT( T, PLmb) raise NotImplementedError( - "[Radiation Coupling] Diagnostic (do_qa) not implemented." - "(GEOS_QSAT missing)" + "[Radiation Coupling] Diagnostic (do_qa) not implemented." "(GEOS_QSAT missing)", ) def __call__( self, - Q: FloatField, - T: FloatField, - QLLS: FloatField, - QILS: FloatField, - CLLS: FloatField, - QLCN: FloatField, - QICN: FloatField, - CLCN: FloatField, - PLmb: FloatField, - QRAIN: FloatField, - QSNOW: FloatField, - QGRAUPEL: FloatField, - NACTL: FloatField, - NACTI: FloatField, - RAD_QV: FloatField, - RAD_QL: FloatField, - RAD_QI: FloatField, - RAD_QR: FloatField, - RAD_QS: FloatField, - RAD_QG: FloatField, - RAD_CF: FloatField, - CLDREFFL: FloatField, - CLDREFFI: FloatField, - FAC_RL: Float, - MIN_RL: Float, - MAX_RL: Float, - FAC_RI: Float, - MIN_RI: Float, - MAX_RI: Float, + q: FloatField, + te: FloatField, + q_lls: FloatField, + q_ils: FloatField, + clls: FloatField, + q_lcn: FloatField, + q_icn: FloatField, + clcn: FloatField, + pl: FloatField, + q_rain: FloatField, + q_snow: FloatField, + q_graupel: FloatField, + nactl: FloatField, + nacti: FloatField, + rad_q_v: FloatField, + rad_q_l: FloatField, + rad_q_i: FloatField, + rad_q_r: FloatField, + rad_q_s: FloatField, + rad_q_g: FloatField, + rad_c_f: FloatField, + cldreff_l: FloatField, + cldreff_i: FloatField, + fac_rl: Float, + min_rl: Float, + max_rl: Float, + fac_ri: Float, + min_ri: Float, + max_ri: Float, ): """ Perform the radiation coupling process. Parameters: - Q (FloatField): Water vapor mixing ratio. - T (FloatField): Temperature. - QLLS (FloatField): Liquid cloud mixing ratio (large-scale). - QILS (FloatField): Ice cloud mixing ratio (large-scale). - CLLS (FloatField): Cloud fraction (large-scale). - QLCN (FloatField): Liquid cloud mixing ratio (anvil). - QICN (FloatField): Ice cloud mixing ratio (anvil). - CLCN (FloatField): Cloud fraction (anvil). - PLmb (FloatField): Pressure level in millibars. - QRAIN (FloatField): Rain mixing ratio. - QSNOW (FloatField): Snow mixing ratio. - QGRAUPEL (FloatField): Graupel mixing ratio. - NACTL (FloatField): Number concentration of liquid cloud droplets. - NACTI (FloatField): Number concentration of ice cloud crystals. - RAD_QV (FloatField): Radiation water vapor mixing ratio. - RAD_QL (FloatField): Radiation liquid cloud mixing ratio. - RAD_QI (FloatField): Radiation ice cloud mixing ratio. - RAD_QR (FloatField): Radiation rain mixing ratio. - RAD_QS (FloatField): Radiation snow mixing ratio. - RAD_QG (FloatField): Radiation graupel mixing ratio. - RAD_CF (FloatField): Radiation cloud fraction. - CLDREFFL (FloatField): Radiation liquid effective radius. - CLDREFFI (FloatField): Radiation ice effective radius. - FAC_RL (Float): Factor for liquid effective radius. - MIN_RL (Float): Minimum liquid effective radius. - MAX_RL (Float): Maximum liquid effective radius. - FAC_RI (Float): Factor for ice effective radius. - MIN_RI (Float): Minimum ice effective radius. - MAX_RI (Float): Maximum ice effective radius. + q (FloatField): Water vapor mixing ratio. + te (FloatField): Temperature. + q_lls (FloatField): Liquid cloud mixing ratio (large-scale). + q_ils (FloatField): Ice cloud mixing ratio (large-scale). + clls (FloatField): Cloud fraction (large-scale). + q_lcn (FloatField): Liquid cloud mixing ratio (anvil). + q_icn (FloatField): Ice cloud mixing ratio (anvil). + clcn (FloatField): Cloud fraction (anvil). + pl (FloatField): Pressure level in millibars. + q_rain (FloatField): Rain mixing ratio. + q_snow (FloatField): Snow mixing ratio. + q_graupel (FloatField): Graupel mixing ratio. + nactl (FloatField): Number concentration of liquid cloud droplets. + nacti (FloatField): Number concentration of ice cloud crystals. + rad_q_v (FloatField): Radiation water vapor mixing ratio. + rad_q_l (FloatField): Radiation liquid cloud mixing ratio. + rad_q_i (FloatField): Radiation ice cloud mixing ratio. + rad_q_r (FloatField): Radiation rain mixing ratio. + rad_q_s (FloatField): Radiation snow mixing ratio. + rad_q_g (FloatField): Radiation graupel mixing ratio. + rad_c_f (FloatField): Radiation cloud fraction. + cldreff_l (FloatField): Radiation liquid effective radius. + cldreff_i (FloatField): Radiation ice effective radius. + fac_rl (Float): Factor for liquid effective radius. + min_rl (Float): Minimum liquid effective radius. + max_rl (Float): Maximum liquid effective radius. + fac_ri (Float): Factor for ice effective radius. + min_ri (Float): Minimum ice effective radius. + max_ri (Float): Maximum ice effective radius. """ self._fix_up_clouds( - QV=Q, - TE=T, - QLC=QLLS, - QIC=QILS, - CF=CLLS, - QLA=QLCN, - QIA=QICN, - AF=CLCN, + qv=q, + te=te, + q_lc=q_lls, + q_ic=q_ils, + cf=clls, + q_la=q_lcn, + q_ia=q_icn, + af=clcn, ) self._radcouple( - TE=T, - PL=PLmb, - CF=CLLS, - AF=CLCN, - QV=Q, - QClLS=QLLS, - QCiLS=QILS, - QClAN=QLCN, - QCiAN=QICN, - QRN_ALL=QRAIN, - QSN_ALL=QSNOW, - QGR_ALL=QGRAUPEL, - NL=NACTL, - NI=NACTI, - RAD_QV=RAD_QV, - RAD_QL=RAD_QL, - RAD_QI=RAD_QI, - RAD_QR=RAD_QR, - RAD_QS=RAD_QS, - RAD_QG=RAD_QG, - RAD_CF=RAD_CF, - RAD_RL=CLDREFFL, - RAD_RI=CLDREFFI, - FAC_RL=FAC_RL, - MIN_RL=MIN_RL, - MAX_RL=MAX_RL, - FAC_RI=FAC_RI, - MIN_RI=MIN_RI, - MAX_RI=MAX_RI, + te, + pl, + clls, + clcn, + q, + q_lls, + q_ils, + q_lcn, + q_icn, + q_rain, + q_snow, + q_graupel, + nactl, + nacti, + rad_q_v, + rad_q_l, + rad_q_i, + rad_q_r, + rad_q_s, + rad_q_g, + rad_c_f, + cldreff_l, + cldreff_i, + fac_rl, + min_rl, + max_rl, + fac_ri, + min_ri, + max_ri, ) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/redistribute_clouds.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/redistribute_clouds.py index 14cf9b9d3..941835c4a 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/redistribute_clouds.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/redistribute_clouds.py @@ -1,101 +1,104 @@ -from gt4py.cartesian.gtscript import PARALLEL, computation, interval - -import pyMoist.radiation_coupling_constants as radconstants -from ndsl import QuantityFactory, StencilFactory +from gt4py.cartesian.gtscript import ( + PARALLEL, + computation, + interval, +) +from ndsl import StencilFactory from ndsl.constants import X_DIM, Y_DIM, Z_DIM from ndsl.dsl.typing import FloatField +import pyMoist.radiation_coupling_constants as radconstants + +# ruff: noqa: PLR0913 + def redist_clouds( - CF: FloatField, - QL: FloatField, - QI: FloatField, - CLCN: FloatField, - CLLS: FloatField, - QLCN: FloatField, - QLLS: FloatField, - QICN: FloatField, - QILS: FloatField, - QV: FloatField, - TE: FloatField, + cf: FloatField, + ql: FloatField, + qi: FloatField, + clcn: FloatField, + clls: FloatField, + qlcn: FloatField, + qlls: FloatField, + qinc: FloatField, + qils: FloatField, + qv: FloatField, + te: FloatField, ): - with computation(PARALLEL), interval(...): # Constants from MAPL.h alhlbcp = radconstants.ALHLBCP alhsbcp = radconstants.ALHSBCP - # Define FCN as a 3-d array - FCN = CF + # Define fcn as a 3-d array + fcn = cf # Fix cloud quants if too small - if QL + QI < 1e-8: - QV = QV + QL + QI - TE = TE - alhlbcp * QL - alhsbcp * QI - CF = 0.0 - QL = 0.0 - QI = 0.0 - - if CF < 1e-5: - QV = QV + QL + QI - TE = TE - (alhlbcp * QL) - (alhsbcp * QI) - CF = 0.0 - QL = 0.0 - QI = 0.0 + if ql + qi < 1e-8: + qv = qv + ql + qi + te = te - alhlbcp * ql - alhsbcp * qi + cf = 0.0 + ql = 0.0 + qi = 0.0 + + if cf < 1e-5: + qv = qv + ql + qi + te = te - (alhlbcp * ql) - (alhsbcp * qi) + cf = 0.0 + ql = 0.0 + qi = 0.0 # Redistribute liquid CN/LS portions based on prior fractions - FCN = 0.0 - if QLCN + QLLS > 0.0: - FCN = min(max(QLCN / (QLCN + QLLS), 0.0), 1.0) + fcn = 0.0 + if qlcn + qlls > 0.0: + fcn = min(max(qlcn / (qlcn + qlls), 0.0), 1.0) # Put all new condensate into LS - DQC = QL - (QLCN + QLLS) - if DQC > 0.0: - QLLS = QLLS + DQC - DQC = 0.0 + dqc = ql - (qlcn + qlls) + if dqc > 0.0: + qlls = qlls + dqc + dqc = 0.0 # Any loss of condensate uses the FCN ratio - QLCN = QLCN + DQC * FCN - QLLS = QLLS + DQC * (1.0 - FCN) + qlcn = qlcn + dqc * fcn + qlls = qlls + dqc * (1.0 - fcn) # Redistribute ice CN/LS portions based on prior fractions - FCN = 0.0 - if QICN + QILS > 0.0: - FCN = min(max(QICN / (QICN + QILS), 0.0), 1.0) + fcn = 0.0 + if qinc + qils > 0.0: + fcn = min(max(qinc / (qinc + qils), 0.0), 1.0) # Put all new condensate into LS - DQC = QI - (QICN + QILS) - if DQC > 0.0: - QILS = QILS + DQC - DQC = 0.0 + dqc = qi - (qinc + qils) + if dqc > 0.0: + qils = qils + dqc + dqc = 0.0 # Any loss of condensate uses the FCN ratio - QICN = QICN + DQC * FCN - QILS = QILS + DQC * (1.0 - FCN) + qinc = qinc + dqc * fcn + qils = qils + dqc * (1.0 - fcn) # Redistribute cloud-fraction CN/LS portions based on prior fractions - FCN = 0.0 - if CLCN + CLLS > 0.0: - FCN = min(max(CLCN / (CLCN + CLLS), 0.0), 1.0) + fcn = 0.0 + if clcn + clls > 0.0: + fcn = min(max(clcn / (clcn + clls), 0.0), 1.0) # Put all new condensate into LS - DQC = CF - (CLCN + CLLS) - if DQC > 0.0: - CLLS = CLLS + DQC - DQC = 0.0 + dqc = cf - (clcn + clls) + if dqc > 0.0: + clls = clls + dqc + dqc = 0.0 # Any loss of condensate uses the FCN ratio - CLCN = CLCN + DQC * FCN - CLLS = CLLS + DQC * (1.0 - FCN) + clcn = clcn + dqc * fcn + clls = clls + dqc * (1.0 - fcn) class RedistributeClouds: def __init__( self, stencil_factory: StencilFactory, - quantity_factory: QuantityFactory, ) -> None: - self._redist_clouds = stencil_factory.from_dims_halo( func=redist_clouds, compute_dims=[X_DIM, Y_DIM, Z_DIM], @@ -103,44 +106,44 @@ def __init__( def __call__( self, - RAD_CF: FloatField, - RAD_QL: FloatField, - RAD_QI: FloatField, - CLCN: FloatField, - CLLS: FloatField, - QLCN: FloatField, - QLLS: FloatField, - QICN: FloatField, - QILS: FloatField, - RAD_QV: FloatField, - T: FloatField, + rad_cf: FloatField, + rad_ql: FloatField, + rad_qi: FloatField, + clcn: FloatField, + clls: FloatField, + qlcn: FloatField, + qlls: FloatField, + qicn: FloatField, + q_ils: FloatField, + rad_qv: FloatField, + t: FloatField, ): """ Perform the redistribute clouds process. Parameters: - RAD_CF (3D inout): Radiation cloud fraction. - RAD_QL (3D inout): Radiation liquid cloud mixing ratio. - RAD_QI (3D inout): Radiation ice cloud mixing ratio. - CLCN (3D inout): Cloud fraction (anvil). - CLLS (3D inout): Cloud fraction (large-scale). - QLCN (3D inout): Liquid cloud mixing ratio (anvil). - QLLS (3D inout): Liquid cloud mixing ratio (large-scale). - QICN (3D inout): Ice cloud mixing ratio (anvil). - QILS (3D inout): Ice cloud mixing ratio (large-scale). - RAD_QV (3D inout): Radiation water vapor mixing ratio. - T (3D inout): Temperature. + rad_cf (3D in/out): Radiation cloud fraction. + rad_ql (3D in/out): Radiation liquid cloud mixing ratio. + rad_qi (3D in/out): Radiation ice cloud mixing ratio. + clcn (3D in/out): Cloud fraction (anvil). + clls (3D in/out): Cloud fraction (large-scale). + qlcn (3D in/out): Liquid cloud mixing ratio (anvil). + qlls (3D in/out): Liquid cloud mixing ratio (large-scale). + qicn (3D in/out): Ice cloud mixing ratio (anvil). + q_ils (3D in/out): Ice cloud mixing ratio (large-scale). + rad_qv (3D in/out): Radiation water vapor mixing ratio. + t (3D in/out): Temperature. """ self._redist_clouds( - CF=RAD_CF, - QL=RAD_QL, - QI=RAD_QI, - CLCN=CLCN, - CLLS=CLLS, - QLCN=QLCN, - QLLS=QLLS, - QICN=QICN, - QILS=QILS, - QV=RAD_QV, - TE=T, + cf=rad_cf, + ql=rad_ql, + qi=rad_qi, + clcn=clcn, + clls=clls, + qlcn=qlcn, + qlls=qlls, + qicn=qicn, + qils=q_ils, + qv=rad_qv, + te=t, ) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/slope.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/slope.py new file mode 100644 index 000000000..83a706883 --- /dev/null +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/slope.py @@ -0,0 +1,132 @@ +from gt4py.cartesian.gtscript import computation, interval, PARALLEL, stencil, max, min +import numpy as np +from ndsl.constants import X_DIM, Y_DIM, Z_DIM +from ndsl.dsl.typing import FloatField, Int +from ndsl.quantity import Quantity +from ndsl import QuantityFactory, StencilFactory + + + +#@stencil(backend="numpy") +def calc_slope(field: FloatField, p0: FloatField, slope: FloatField): + with computation(PARALLEL), interval(1, None): + below=field + below_value = (field[0, 0, 1] - field[0, 0, 0]) / (p0[0, 0, 1] - p0[0, 0, 0]) + above_value = (field[0, 0, 0] - field[0, 0, -1]) / (p0[0, 0, 0] - p0[0, 0, -1]) + if above_value > 0.0: + slope_value = max(0.0, min(above_value, below_value)) + else: + slope_value = min(0.0, max(above_value, below_value)) + below[0, 0, 0] = above_value + slope[0, 0, 0] = slope_value + with computation(PARALLEL), interval(0, 1): + slope_value = slope[0, 0, -1] + slope[0, 0, 0] = slope_value + + +class Slope: + def __init__( + self, + stencil_factory: StencilFactory, + quantity_factory: QuantityFactory, + ) -> None: + + self._calc_slope = stencil_factory.from_dims_halo( + func=calc_slope, + compute_dims=[X_DIM, Y_DIM, Z_DIM], + + ) + + def __call__( + self, + thl0_test: FloatField, + pmid0_test: FloatField, + ssthl0_test: FloatField, + ): + """ + Calculate slope. + + Parameters: + field (3D in): Variable of interest. + p0 (3D in): Environmental pressure [ Pa ] + slope (3D out): Slope [units?] + """ + + self._calc_slope( + field=thl0_test, + p0=pmid0_test, + slope=ssthl0_test, + ) + + +''' +# Define dimensions +nx, ny, nz = 24, 24, 72 # Adjust dimensions as needed +shape = (nx*ny, nz) + +arr = np.indices(shape, dtype=np.float64).sum(axis=0) # Value of each entry is sum of the I and J index at each point +arr_zero = np.zeros_like(arr) + +field = arr +p0 = arr + + +field = Quantity(data=arr, + dims=["IJ", "K"], + units="m", + gt4py_backend="numpy") +p0 = Quantity(data=arr, + dims=["IJ", "K"], + units="m", + gt4py_backend="numpy") +below = Quantity(data=arr_zero, + dims=["IJ", "K"], + units="m", + gt4py_backend="numpy") +slope = Quantity(data=arr_zero, + dims=["IJ", "K"], + units="m", + gt4py_backend="numpy") + + + +# Create 2D input data +input_data = [field,p0] + +for arr in input_data: + print("2D FIELD: ", arr.shape) + +# Define the origin and domain to account for negative indexing +origin = (0, 0, 1) # Start at k=1 to allow access to k-1 +before = reshape_before(input_data) + +# Execute the stencil with the correct origin and domain +#print("3D FIELDS: ", before) +for arr in before: + print("3D FIELD: ", arr.shape) + +field=Quantity(data=before[0], + dims=["I", "J", "K"], + units="m", + gt4py_backend="numpy") +p0 = Quantity(data=before[1], + dims=["I", "J", "K"], + units="m", + gt4py_backend="numpy") +below = Quantity(data=np.zeros_like(field), + dims=["I", "J", "K"], + units="m", + gt4py_backend="numpy") +slope = Quantity(data=np.zeros_like(field), + dims=["I", "J", "K"], + units="m", + gt4py_backend="numpy") + + +slope_3d = calc_slope(field,p0,below,slope,origin=origin) +print("SLOPE 3D: ", slope.data.shape) + +after = reshape_after(outputs=slope.data) +print("2D FIELD: ", after.shape) + +''' \ No newline at end of file diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/types.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/types.py index aa8f1f7d3..7ad021060 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/types.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/pyMoist/types.py @@ -1,8 +1,7 @@ -import gt4py.cartesian.gtscript as gtscript - -import pyMoist.aer_activation_constants as constants +from gt4py.cartesian import gtscript from ndsl.dsl.typing import Float +import pyMoist.aer_activation_constants as constants # Global space FloatField_NModes = gtscript.Field[gtscript.IJK, (Float, (constants.n_modes))] diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/ruff.toml b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/ruff.toml new file mode 100644 index 000000000..7a2eeb444 --- /dev/null +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/ruff.toml @@ -0,0 +1,9 @@ +line-length = 100 + +[lint] +select = ["C","E","F","I","N", "FA", "G", "Q", "PL", "RUF"] +ignore = ["C901", "D101","D102","D103","D105","D107","D203","D213","D406","D407", "F841","PLR2004"] + + +[lint.per-file-ignores] +"__init__.py" = ["F401"] diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/setup.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/setup.py index 9826ee2f1..845d83e77 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/setup.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/setup.py @@ -5,11 +5,15 @@ from setuptools import find_namespace_packages, setup - with open("README.md", encoding="utf-8") as readme_file: readme = readme_file.read() -test_requirements = ["pytest", "pytest-subtests", "serialbox", "coverage"] +test_requirements = [ + "pytest", + "pytest-subtests", + "serialbox", + "coverage", +] ndsl_requirements = ["ndsl @ git+https://github.com/NOAA-GFDL/NDSL.git@2024.04.00"] develop_requirements = test_requirements + ndsl_requirements + ["pre-commit"] diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/conftest.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/conftest.py index 072a2874e..9e8223d7f 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/conftest.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/conftest.py @@ -1,8 +1,6 @@ -import savepoint - import ndsl.stencils.testing.conftest -from ndsl.stencils.testing.conftest import * # noqa: F403,F401 - +import savepoint +from ndsl.stencils.testing.conftest import * # noqa: F403 -# Point to an __init__.py where all the TestX are improted +# Point to an __init__.py where all the TestX are imported ndsl.stencils.testing.conftest.translate = savepoint # type: ignore diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/__init__.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/__init__.py index 3b60c03e4..2c23954a4 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/__init__.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/__init__.py @@ -1,2 +1,3 @@ from .translate_aer_activation import TranslateAerActivation from .translate_radiation_coupling import TranslateRadCouple +from .translate_slope import TranslateSlope diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_aer_activation.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_aer_activation.py index 292ffd78f..051a7ceea 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_aer_activation.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_aer_activation.py @@ -1,12 +1,20 @@ from ndsl import Namelist, Quantity, StencilFactory from ndsl.constants import X_DIM, Y_DIM, Z_DIM from ndsl.dsl.typing import Float -from ndsl.stencils.testing.translate import TranslateFortranData2Py +from ndsl.stencils.testing.translate import ( + TranslateFortranData2Py, +) + from pyMoist.aer_activation import AerActivation class TranslateAerActivation(TranslateFortranData2Py): - def __init__(self, grid, namelist: Namelist, stencil_factory: StencilFactory): + def __init__( + self, + grid, + namelist: Namelist, + stencil_factory: StencilFactory, + ): super().__init__(grid, stencil_factory) self.stencil_factory = stencil_factory self.quantity_factory = grid.quantity_factory @@ -14,7 +22,7 @@ def __init__(self, grid, namelist: Namelist, stencil_factory: StencilFactory): self.max_error = 1e-9 self.nmodes_quantity_factory = AerActivation.make_nmodes_quantity_factory( - self.quantity_factory + self.quantity_factory, ) # FloatField Inputs @@ -90,7 +98,7 @@ def compute(self, inputs): self.stencil_factory, self.quantity_factory, int(inputs["n_modes"]), - USE_AERSOL_NN=True, + use_aersol_nn=True, ) # Outputs diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_radiation_coupling.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_radiation_coupling.py index 0bed5c7d6..d25a8f676 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_radiation_coupling.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_radiation_coupling.py @@ -1,5 +1,8 @@ from ndsl import Namelist, StencilFactory -from ndsl.stencils.testing.translate import TranslateFortranData2Py +from ndsl.stencils.testing.translate import ( + TranslateFortranData2Py, +) + from pyMoist.radiation_coupling import RadiationCoupling diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_redistribute_clouds.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_redistribute_clouds.py index 5af53ce1a..5af25df5b 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_redistribute_clouds.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_redistribute_clouds.py @@ -1,5 +1,8 @@ from ndsl import Namelist, StencilFactory -from ndsl.stencils.testing.translate import TranslateFortranData2Py +from ndsl.stencils.testing.translate import ( + TranslateFortranData2Py, +) + from pyMoist.redistribute_clouds import RedistributeClouds @@ -13,7 +16,6 @@ def __init__( super().__init__(grid, stencil_factory) self.compute_func = RedistributeClouds( self.stencil_factory, - self.grid.quantity_factory, ) self.max_error = 1e-9 diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_slope.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_slope.py new file mode 100644 index 000000000..0819ea4fb --- /dev/null +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/translate_slope.py @@ -0,0 +1,77 @@ +from ndsl import Namelist, StencilFactory, QuantityFactory +from ndsl.constants import X_DIM, Y_DIM, Z_DIM +from ndsl.stencils.testing.translate import TranslateFortranData2Py +from pyMoist.slope import Slope +import numpy as np + + +class TranslateSlope(TranslateFortranData2Py): + def __init__( + self, + grid, + namelist: Namelist, + stencil_factory: StencilFactory, + ): + super().__init__(grid, stencil_factory) + self.compute_func = Slope( + self.stencil_factory, + self.grid.quantity_factory, + ) + + self.max_error = 1e-9 + + print(grid.__dict__) + + # FloatField Inputs + self.in_vars["data_vars"] = { + "thl0_test": {}, + "pmid0_test": {}, + } + + print(self.in_vars["data_vars"]) + + # FloatField Outputs + self.out_vars = { + "ssthl0_test": self.grid.compute_dict(), + } + + def reshape_before(self,inputs): + # Reshape input fields from (i*j, k) to (i, j, k) + i, j, k = self.grid.nic, self.grid.njc, self.grid.npz + reshaped_inputs = {key: np.reshape(inputs[key], (i, j, k)).astype(np.float32) for key in inputs} + + # Create a new array with halo of 3 in i and j dimensions + halo_arrays = {} + for key, array in reshaped_inputs.items(): + new_array = np.zeros((i+6, j+6, k), dtype=np.float32) + new_array[3:-3, 3:-3, :] = array + + halo_arrays[key] = new_array + + return halo_arrays + + def reshape_after(self,outputs): + # Reshape output fields from (i, j, k) back to (i*j, k) + i, j, k = self.grid.nic, self.grid.njc, self.grid.npz + reshaped_outputs = [np.reshape(outputs[key], (i, j, k)).astype(np.float32) for key in outputs] + return reshaped_outputs + + + # Calculated Outputs + def compute(self, inputs): + + inputs_2D = self.reshape_before(inputs) + print("Reshaped 2D fields to 3D") + + outputs = { + "ssthl0_test": self.grid.quantity_factory.zeros(dims=[X_DIM, Y_DIM, Z_DIM], units="unknown"), + } + + self.compute_func(**inputs_2D,**outputs) + print("Calculated slope on 3D fields") + + outputs_2D = self.reshape_after(outputs["ssthl0_test"].view[:,:,:]) + print("Reshaped back to 2D") + + return {"ssthl0_test": outputs_2D + } diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/run_tests.sh b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/run_tests.sh index 949b178a2..bb0b43953 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/run_tests.sh +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/run_tests.sh @@ -5,6 +5,6 @@ python -m pytest -v -s -x\ --pdb \ --data_path=../../test_data/geos_11.5.2/moist \ --backend=dace:cpu \ - --which_modules=AerActivation \ + --which_modules=Slope \ --grid=default \ .. diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/test_translate.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/test_translate.py index 8dadf15a9..789837924 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/test_translate.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/test_translate.py @@ -1 +1 @@ -from ndsl.stencils.testing.test_translate import * # noqa: F403,F401 +from ndsl.stencils.testing.test_translate import * # noqa: F403