From fbc392e3e55733c65b7d36d93174025503197f44 Mon Sep 17 00:00:00 2001 From: Daniel Hupp Date: Mon, 5 Feb 2024 11:03:59 +0100 Subject: [PATCH] fix style --- ...lysis_increments_from_data_assimilation.py | 2 +- .../apply_4th_order_divergence_damping.py | 2 +- .../apply_rayleigh_damping_mechanism.py | 2 +- ...ute_results_for_thermodynamic_variables.py | 2 +- .../dycore/nh_solve/solve_nonhydro.py | 42 +++++++++---------- ...diagonal_matrix_for_w_back_substitution.py | 6 ++- ..._tridiagonal_matrix_for_w_forward_sweep.py | 2 +- 7 files changed, 30 insertions(+), 28 deletions(-) diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/add_analysis_increments_from_data_assimilation.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/add_analysis_increments_from_data_assimilation.py index e1f6490c31..b56d59ff9d 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/add_analysis_increments_from_data_assimilation.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/add_analysis_increments_from_data_assimilation.py @@ -27,7 +27,7 @@ def _add_analysis_increments_from_data_assimilation( exner_incr: Field[[CellDim, KDim], vpfloat], iau_wgt_dyn: wpfloat, ) -> tuple[Field[[CellDim, KDim], wpfloat], Field[[CellDim, KDim], wpfloat]]: - '''Formerly known as _mo_solve_nonhydro_stencil_50.''' + """Formerly known as _mo_solve_nonhydro_stencil_50.""" rho_incr_wp, exner_incr_wp = astype((rho_incr, exner_incr), wpfloat) z_rho_expl_wp = z_rho_expl + iau_wgt_dyn * rho_incr_wp diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/apply_4th_order_divergence_damping.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/apply_4th_order_divergence_damping.py index 1bf79f880a..5df5ea4b6a 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/apply_4th_order_divergence_damping.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/apply_4th_order_divergence_damping.py @@ -25,7 +25,7 @@ def _apply_4th_order_divergence_damping( z_graddiv2_vn: Field[[EdgeDim, KDim], vpfloat], vn: Field[[EdgeDim, KDim], wpfloat], ) -> Field[[EdgeDim, KDim], wpfloat]: - '''Formelry known as _mo_solve_nonhydro_4th_order_divdamp.''' + """Formelry known as _mo_solve_nonhydro_4th_order_divdamp.""" z_graddiv2_vn_wp = astype(z_graddiv2_vn, wpfloat) scal_divdamp = broadcast(scal_divdamp, (EdgeDim, KDim)) vn_wp = vn + (scal_divdamp * z_graddiv2_vn_wp) diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/apply_rayleigh_damping_mechanism.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/apply_rayleigh_damping_mechanism.py index 6ee7a9b899..77b079ea80 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/apply_rayleigh_damping_mechanism.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/apply_rayleigh_damping_mechanism.py @@ -25,7 +25,7 @@ def _apply_rayleigh_damping_mechanism( w_1: Field[[CellDim], wpfloat], w: Field[[CellDim, KDim], wpfloat], ) -> Field[[CellDim, KDim], wpfloat]: - '''Formerly known as _mo_solve_nonhydro_stencil_54.''' + """Formerly known as _mo_solve_nonhydro_stencil_54.""" z_raylfac = broadcast(z_raylfac, (CellDim, KDim)) w_wp = z_raylfac * w + (wpfloat("1.0") - z_raylfac) * w_1 return w_wp diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/compute_results_for_thermodynamic_variables.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/compute_results_for_thermodynamic_variables.py index 80b2894adb..38ac6556d1 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/compute_results_for_thermodynamic_variables.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/compute_results_for_thermodynamic_variables.py @@ -40,7 +40,7 @@ def _compute_results_for_thermodynamic_variables( Field[[CellDim, KDim], wpfloat], Field[[CellDim, KDim], wpfloat], ]: - '''Formerly known as _mo_solve_nonhydro_stencil_55.''' + """Formerly known as _mo_solve_nonhydro_stencil_55.""" inv_ddqz_z_full_wp, exner_ref_mc_wp, z_alpha_wp, z_beta_wp = astype( (inv_ddqz_z_full, exner_ref_mc, z_alpha, z_beta), wpfloat ) diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/nh_solve/solve_nonhydro.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/nh_solve/solve_nonhydro.py index 5dc440917b..0307d17065 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/nh_solve/solve_nonhydro.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/nh_solve/solve_nonhydro.py @@ -22,6 +22,9 @@ import icon4py.model.atmosphere.dycore.nh_solve.solve_nonhydro_program as nhsolve_prog import icon4py.model.common.constants as constants from icon4py.model.atmosphere.dycore.accumulate_prep_adv_fields import accumulate_prep_adv_fields +from icon4py.model.atmosphere.dycore.add_analysis_increments_from_data_assimilation import ( + add_analysis_increments_from_data_assimilation, +) from icon4py.model.atmosphere.dycore.add_analysis_increments_to_vn import ( add_analysis_increments_to_vn, ) @@ -37,9 +40,15 @@ from icon4py.model.atmosphere.dycore.apply_2nd_order_divergence_damping import ( apply_2nd_order_divergence_damping, ) +from icon4py.model.atmosphere.dycore.apply_4th_order_divergence_damping import ( + apply_4th_order_divergence_damping, +) from icon4py.model.atmosphere.dycore.apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure import ( apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure, ) +from icon4py.model.atmosphere.dycore.apply_rayleigh_damping_mechanism import ( + apply_rayleigh_damping_mechanism, +) from icon4py.model.atmosphere.dycore.apply_weighted_2nd_and_4th_order_divergence_damping import ( apply_weighted_2nd_and_4th_order_divergence_damping, ) @@ -53,6 +62,9 @@ from icon4py.model.atmosphere.dycore.compute_divergence_of_fluxes_of_rho_and_theta import ( compute_divergence_of_fluxes_of_rho_and_theta, ) +from icon4py.model.atmosphere.dycore.compute_dwdz_for_divergence_damping import ( + compute_dwdz_for_divergence_damping, +) from icon4py.model.atmosphere.dycore.compute_exner_from_rhotheta import compute_exner_from_rhotheta from icon4py.model.atmosphere.dycore.compute_graddiv2_of_vn import compute_graddiv2_of_vn from icon4py.model.atmosphere.dycore.compute_horizontal_gradient_of_exner_pressure_for_flat_coordinates import ( @@ -71,6 +83,9 @@ from icon4py.model.atmosphere.dycore.compute_pertubation_of_rho_and_theta import ( compute_pertubation_of_rho_and_theta, ) +from icon4py.model.atmosphere.dycore.compute_results_for_thermodynamic_variables import ( + compute_results_for_thermodynamic_variables, +) from icon4py.model.atmosphere.dycore.compute_rho_virtual_potential_temperatures_and_pressure_gradient import ( compute_rho_virtual_potential_temperatures_and_pressure_gradient, ) @@ -85,27 +100,6 @@ from icon4py.model.atmosphere.dycore.mo_math_gradients_grad_green_gauss_cell_dsl import ( mo_math_gradients_grad_green_gauss_cell_dsl, ) -from icon4py.model.atmosphere.dycore.apply_4th_order_divergence_damping import ( - apply_4th_order_divergence_damping, -) -from icon4py.model.atmosphere.dycore.add_analysis_increments_from_data_assimilation import ( - add_analysis_increments_from_data_assimilation, -) -from icon4py.model.atmosphere.dycore.solve_tridiagonal_matrix_for_w_forward_sweep import ( - solve_tridiagonal_matrix_for_w_forward_sweep, -) -from icon4py.model.atmosphere.dycore.solve_tridiagonal_matrix_for_w_back_substitution import ( - solve_tridiagonal_matrix_for_w_back_substitution, -) -from icon4py.model.atmosphere.dycore.apply_rayleigh_damping_mechanism import ( - apply_rayleigh_damping_mechanism, -) -from icon4py.model.atmosphere.dycore.compute_results_for_thermodynamic_variables import ( - compute_results_for_thermodynamic_variables, -) -from icon4py.model.atmosphere.dycore.compute_dwdz_for_divergence_damping import ( - compute_dwdz_for_divergence_damping, -) from icon4py.model.atmosphere.dycore.set_two_cell_kdim_fields_to_zero_vp import ( set_two_cell_kdim_fields_to_zero_vp, ) @@ -115,6 +109,12 @@ from icon4py.model.atmosphere.dycore.set_two_edge_kdim_fields_to_zero_wp import ( set_two_edge_kdim_fields_to_zero_wp, ) +from icon4py.model.atmosphere.dycore.solve_tridiagonal_matrix_for_w_back_substitution import ( + solve_tridiagonal_matrix_for_w_back_substitution, +) +from icon4py.model.atmosphere.dycore.solve_tridiagonal_matrix_for_w_forward_sweep import ( + solve_tridiagonal_matrix_for_w_forward_sweep, +) from icon4py.model.atmosphere.dycore.state_utils.states import ( DiagnosticStateNonHydro, InterpolationState, diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/solve_tridiagonal_matrix_for_w_back_substitution.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/solve_tridiagonal_matrix_for_w_back_substitution.py index 7d97437d84..919b612434 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/solve_tridiagonal_matrix_for_w_back_substitution.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/solve_tridiagonal_matrix_for_w_back_substitution.py @@ -20,8 +20,10 @@ @scan_operator(axis=KDim, forward=False, init=wpfloat("0.0")) -def _solve_tridiagonal_matrix_for_w_back_substitution_scan(w_state: wpfloat, z_q: vpfloat, w: wpfloat) -> wpfloat: - '''Formerly known as _mo_solve_nonhydro_stencil_53_scan.''' +def _solve_tridiagonal_matrix_for_w_back_substitution_scan( + w_state: wpfloat, z_q: vpfloat, w: wpfloat +) -> wpfloat: + """Formerly known as _mo_solve_nonhydro_stencil_53_scan.""" return w + w_state * astype(z_q, wpfloat) diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/solve_tridiagonal_matrix_for_w_forward_sweep.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/solve_tridiagonal_matrix_for_w_forward_sweep.py index e15e5611bf..b5390d64d3 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/solve_tridiagonal_matrix_for_w_forward_sweep.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/solve_tridiagonal_matrix_for_w_forward_sweep.py @@ -52,7 +52,7 @@ def _solve_tridiagonal_matrix_for_w_forward_sweep( dtime: wpfloat, cpd: wpfloat, ) -> tuple[Field[[CellDim, KDim], vpfloat], Field[[CellDim, KDim], wpfloat]]: - '''Formerly known as _mo_solve_nonhydro_stencil_52.''' + """Formerly known as _mo_solve_nonhydro_stencil_52.""" ddqz_z_half_wp = astype(ddqz_z_half, wpfloat) z_gamma_vp = astype(dtime * cpd * vwind_impl_wgt * theta_v_ic / ddqz_z_half_wp, vpfloat)