Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions .github/workflows/ndsl-checks.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: NDSL Lint & Translate Tests

on:
push:
paths: "./GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/**"
pull_request:
paths:
- '.github/workflows/ndsl-checks.yml'
- 'GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/**'
workflow_dispatch:

# cancel running jobs if theres a newer push
Expand All @@ -14,30 +16,29 @@ jobs:
main:
env:
DATA_PATH: ./test_data/11.5.2/TBC_C24_L72/moist
DATA_URL: "https://portal.nccs.nasa.gov/datashare/astg/smt/geos-fp/translate/11.5.2/x86_GNU/Moist/TBC_C24L72.tar.gz"
DATA_URL: "https://portal.nccs.nasa.gov/datashare/astg/smt/geos-fp/translate/11.5.2/x86_GNU/Moist/TBC_C24L72_20251208.tar.gz"
runs-on: ubuntu-latest
steps:
- name: Step Python 3.11
- name: Step Python 3.12
uses: actions/setup-python@v6
with:
python-version: '3.11'
python-version: '3.12'

- name: Install MPI
run: pip install mpich

- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: 'recursive'

- name: Install Python packages
run: |
pip install ./GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist[develop]
cd GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist
pip install .

- name: Run lint via pre-commit
run: |
cd GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist
pre-commit run --all-files
pre-commit run --all-files --show-diff-on-failure

- name: Build Documentation
run: |
Expand All @@ -48,15 +49,31 @@ jobs:
run: |
cd GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist
mkdir -p ${{ env.DATA_PATH }} && cd ${{ env.DATA_PATH }}
wget ${{ env.DATA_URL }}
tar -xzvf TBC_C24L72.tar.gz
wget --no-verbose ${{ env.DATA_URL }}
tar -xzf TBC_C24L72_20251208.tar.gz
# These don't have translate tests
rm Constants.MAPL-In.nc
rm Constants.ProcessLibrary-In.nc
rm GF2020_CumulusParameterization_TriggerFunctionConvection-In.nc
rm ComputeUwshcu-In.nc
rm AerActivation-In.nc
rm GF2020_CumulusParameterization_GetBuoyancy_1-In.nc
rm GF2020_CumulusParameterization_UpdraftCIN-In.nc
rm GF2020_CumulusParameterization_InCloudTemperature-In.nc
rm GF2020_CumulusParameterization_EnvironmentCloudLevels_1-In.nc
rm GF2020_CumulusParameterization_UpdraftInitialWorkfunctions-In.nc
rm GF2020_CumulusParameterization_MeltingProfile-In.nc

- name: Run regular unit tests
env:
EXP_NAME: 'gcm-fp'
run : |
cd GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist
pytests ./tests/numerical
pytest ./tests/numerical

- name: Run translate tests
env:
EXP_NAME: 'gcm-fp'
run: |
cd GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/
./run_all.sh ../../${{ env.DATA_PATH }} st:dace:cpu:KIJ
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# air_density

::: pyMoist.convection.GF_2020.air_density
::: pyMoist.convection.GF_2020.cumulus_parameterization.air_density
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# buoyancy

::: pyMoist.convection.GF_2020.buoyancy
::: pyMoist.convection.GF_2020.cumulus_parameterization.buoyancy
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# check_config

::: pyMoist.convection.GF_2020.check_config
::: pyMoist.convection.GF_2020.cumulus_parameterization.check_config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# config

::: pyMoist.convection.GF_2020.config
::: pyMoist.convection.GF_2020.cumulus_parameterization.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# constants

::: pyMoist.convection.GF_2020.constants
::: pyMoist.convection.GF_2020.cumulus_parameterization.constants
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# convective_tracers

::: pyMoist.convection.GF_2020.convective_tracers
::: pyMoist.convection.GF_2020.cumulus_parameterization.convective_tracers
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# cumulus_parameterization

::: pyMoist.convection.GF_2020.cumulus_parameterization
::: pyMoist.convection.GF_2020.cumulus_parameterization.cumulus_parameterization
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# diurnal_cycle

::: pyMoist.convection.GF_2020.diurnal_cycle
::: pyMoist.convection.GF_2020.cumulus_parameterization.diurnal_cycle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# downdraft

::: pyMoist.convection.GF_2020.downdraft
::: pyMoist.convection.GF_2020.cumulus_parameterization.downdraft
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# entrainment

::: pyMoist.convection.GF_2020.entrainment
::: pyMoist.convection.GF_2020.cumulus_parameterization.entrainment
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# environment

::: pyMoist.convection.GF_2020.environment
::: pyMoist.convection.GF_2020.cumulus_parameterization.environment
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# field_types

::: pyMoist.convection.GF_2020.field_types
::: pyMoist.convection.GF_2020.cumulus_parameterization.field_types
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# get_levels

::: pyMoist.convection.GF_2020.get_levels
::: pyMoist.convection.GF_2020.cumulus_parameterization.get_levels
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# kinetic_energy_to_heating

::: pyMoist.convection.GF_2020.kinetic_energy_to_heating
::: pyMoist.convection.GF_2020.cumulus_parameterization.kinetic_energy_to_heating
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# large_scale_forcing

::: pyMoist.convection.GF_2020.large_scale_forcing
::: pyMoist.convection.GF_2020.cumulus_parameterization.large_scale_forcing
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# locals

::: pyMoist.convection.GF_2020.locals
::: pyMoist.convection.GF_2020.cumulus_parameterization.locals
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# mass_conservation

::: pyMoist.convection.GF_2020.mass_conservation
::: pyMoist.convection.GF_2020.cumulus_parameterization.mass_conservation
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# moist_static_energy

::: pyMoist.convection.GF_2020.moist_static_energy
::: pyMoist.convection.GF_2020.cumulus_parameterization.moist_static_energy
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# plume_dependent_constants

::: pyMoist.convection.GF_2020.plume_dependent_constants
::: pyMoist.convection.GF_2020.cumulus_parameterization.plume_dependent_constants
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# precip

::: pyMoist.convection.GF_2020.precip
::: pyMoist.convection.GF_2020.cumulus_parameterization.precip
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# prepare_output

::: pyMoist.convection.GF_2020.prepare_output
::: pyMoist.convection.GF_2020.cumulus_parameterization.prepare_output
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# profiles

::: pyMoist.convection.GF_2020.profiles
::: pyMoist.convection.GF_2020.cumulus_parameterization.profiles
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# set_constants

::: pyMoist.convection.GF_2020.set_constants
::: pyMoist.convection.GF_2020.cumulus_parameterization.setup.set_constants
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# setup

::: pyMoist.convection.GF_2020.setup
::: pyMoist.convection.GF_2020.cumulus_parameterization.setup.setup
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# shared_functions

::: pyMoist.convection.GF_2020.shared_functions
::: pyMoist.convection.GF_2020.cumulus_parameterization.shared_functions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# shared_stencils

::: pyMoist.convection.GF_2020.shared_stencils
::: pyMoist.convection.GF_2020.cumulus_parameterization.shared_stencils
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# smoothing

::: pyMoist.convection.GF_2020.smoothing
::: pyMoist.convection.GF_2020.cumulus_parameterization.smoothing
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# sounding

::: pyMoist.convection.GF_2020.sounding
::: pyMoist.convection.GF_2020.cumulus_parameterization.sounding
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# state

::: pyMoist.convection.GF_2020.state
::: pyMoist.convection.GF_2020.cumulus_parameterization.state
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# triggers

::: pyMoist.convection.GF_2020.triggers
::: pyMoist.convection.GF_2020.cumulus_parameterization.triggers
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# updraft

::: pyMoist.convection.GF_2020.updraft
::: pyMoist.convection.GF_2020.cumulus_parameterization.updraft
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# vertical_discretization

::: pyMoist.convection.GF_2020.vertical_discretization
::: pyMoist.convection.GF_2020.cumulus_parameterization.vertical_discretization
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# GF_2020

::: pyMoist.fortran.param_interfaces.convection.GF_2020
::: pyMoist.fortran.param_interfaces.convection.GF2020_interface
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# GFDL_1M

::: pyMoist.fortran.param_interfaces.microphysics.GFDL_1M
::: pyMoist.fortran.param_interfaces.microphysics.GFDL1M_interface
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ nav:
- Home: index.md
- Top Level:
- "constants": top/constants.md
- "convective_tracers": top/convective_tracers.md
- "field_types": top/field_types.md
- Fortran interface:
- "geos_pymoist": fortran/geos_pymoist.md
- "Parametrization interfaces":
- "GF2020_interface": fortran/param_interfaces/convection/GF202_interface.md
- "UW_interface": fortran/param_interfaces/convection/UW_interface.md
- "GFDL_1M": fortran/param_interfaces/microphysics/GFDL1M_interface.md
- "Internals":
Expand Down Expand Up @@ -108,12 +110,19 @@ nav:
- "setup": microphysics/GFDL_1M/setup.md
- "state": microphysics/GFDL_1M/state.md
- "shared_stencils": microphysics/GFDL_1M/shared_stencils.md
- Universtiy of Washington Shallow Convection (UW):
- University of Washington Shallow Convection (UW):
- "compute_uwshcu": convection/UW/compute_uwshcu.md
- "config": convection/UW/config.md
- "locals": convection/UW/locals.md
- "state": convection/UW/state.md
- "uwshcu_functions": convection/UW/uwshcu_functions.md
- Grell-Freitas Deep Convection (GF 2020):
- "config": convection/GF_2020/config.md
- "finalize": convection/GF_2020/finalize.md
- "GF_2020": convection/GF_2020/GF_2020.md
- "locals": convection/GF_2020/locals.md
- "setup": convection/GF_2020/setup.md
- "state": convection/GF_2020/state.md
- Shared:
- "Interpolations": shared/interpolations.md
- "Numerical Recipes": shared/numerical_recipes.md
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from gt4py.cartesian.gtscript import FORWARD, PARALLEL, K, computation, interval
from ndsl.dsl.gt4py import FORWARD, PARALLEL, K, computation, interval
from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, Int, IntFieldIJ
from ndsl.stencils.column_operations import column_max_ddim

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from gt4py.cartesian.gtscript import BACKWARD, FORWARD, PARALLEL, computation, exp, interval
from ndsl.dsl.gt4py import function
from ndsl.dsl.gt4py import BACKWARD, FORWARD, PARALLEL, computation, exp, function, interval
from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, Int

import pyMoist.constants as constants
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from gt4py.cartesian.gtscript import BACKWARD, FORWARD, PARALLEL, K, computation, interval, sqrt
from ndsl.dsl.gt4py import BACKWARD, FORWARD, PARALLEL, K, computation, interval, sqrt
from ndsl.dsl.typing import BoolFieldIJ, FloatField, FloatFieldIJ, Int, IntFieldIJ
from ndsl.stencils.column_operations import column_max

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,6 @@ def update_state_with_tendencies(
convective_cloud_fraction: FloatField,
convective_rainwater_source: FloatField,
convective_precipitation_RAS: FloatField,
ese: GlobalTable_saturation_tables,
esx: GlobalTable_saturation_tables,
fraction_ice: FloatField,
):
Expand Down Expand Up @@ -875,7 +874,7 @@ def update_state_with_tendencies(

# fix convective cloud fraction
if FIX_CONVECTIVE_CLOUD:
saturation_humidity, _ = saturation_specific_humidity(t, p, ese, esx)
saturation_humidity, _ = saturation_specific_humidity(t, p, esx)

if convective_cloud_fraction < 1.0:
modification = (vapor - saturation_humidity * convective_cloud_fraction) / (1.0 - convective_cloud_fraction)
Expand Down Expand Up @@ -964,7 +963,6 @@ def __init__(
# NOTE: this is an orchestration workaround. Direct call to
# `self.tables.X` fails closure capture for
# argument reconstruction at call time
self._ese = saturation_tables.ese
self._esw = saturation_tables.esw
self._esx = saturation_tables.esx
self._estfrz = saturation_tables.frz
Expand Down Expand Up @@ -1329,7 +1327,6 @@ def __call__(
convective_cloud_fraction=state.convective_cloud_fraction,
convective_rainwater_source=state.convective_rainwater_source,
convective_precipitation_RAS=state.convective_precipitation_RAS,
ese=self._ese,
esx=self._esx,
fraction_ice=self.fraction_ice,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def compute_extra_inputs_from_state(
area: FloatFieldIJ,
modified_area: FloatFieldIJ,
convection_fraction: FloatFieldIJ,
ese: GlobalTable_saturation_tables,
esx: GlobalTable_saturation_tables,
):
"""
Expand Down Expand Up @@ -73,7 +72,6 @@ def compute_extra_inputs_from_state(
area (FloatFieldIJ)
modified_area (FloatFieldIJ)
convection_fraction (FloatFieldIJ)
ese (GlobalTable_saturation_tables)
esx (GlobalTable_saturation_tables)
"""
from __externals__ import GF_MIN_AREA, LHYDROSTATIC, STOCH_BOT, STOCH_TOP, STOCHASTIC_CONVECTION, k_end
Expand All @@ -96,12 +94,12 @@ def compute_extra_inputs_from_state(

with computation(FORWARD), interval(0, 1):
tpwi = vapor * mass
qsat, _ = saturation_specific_humidity(t, p, ese, esx)
qsat, _ = saturation_specific_humidity(t, p, esx)
tpwi_star = qsat * mass

with computation(FORWARD), interval(1, -1):
tpwi = tpwi + vapor * mass
qsat, _ = saturation_specific_humidity(t, p, ese, esx)
qsat, _ = saturation_specific_humidity(t, p, esx)
tpwi_star = tpwi_star + qsat * mass

with computation(FORWARD), interval(0, 1):
Expand Down Expand Up @@ -1327,7 +1325,6 @@ def __call__(
area=state.area,
modified_area=locals.derived_state.modified_area,
convection_fraction=state.convection_fraction,
ese=self.saturation_tables.ese,
esx=self.saturation_tables.esx,
)

Expand Down
Loading
Loading