From 42c6fe12bf7f422b6b0b73aa3b69ef42ae299d08 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 11 May 2020 17:05:51 -0600 Subject: [PATCH 1/2] Fix non-ascii encoding in a bunch of files (all comments) --- physics/cires_ugwp.F90 | 4 ++-- physics/drag_suite.F90 | 8 ++++---- physics/gwdps.f | 8 ++++---- physics/micro_mg_utils.F90 | 2 +- physics/samfdeepcnv.f | 2 +- physics/ugwp_driver_v0.F | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/physics/cires_ugwp.F90 b/physics/cires_ugwp.F90 index b694b1420..b0ebb5313 100644 --- a/physics/cires_ugwp.F90 +++ b/physics/cires_ugwp.F90 @@ -6,8 +6,8 @@ !! "Unified": a) all GW effects due to both dissipation/breaking; b) identical GW solvers for all GW sources; c) ability to replace solvers. !! Unified Formalism: !! 1. GW Sources: Stochastic and physics based mechanisms for GW-excitations in the lower atmosphere, calibrated by the high-res analyses/forecasts, and observations (3 types of GW sources: orography, convection, fronts/jets). -!! 2. GW Propagation: Unified solver for “propagation, dissipation and breaking” excited from all type of GW sources. -!! 3. GW Effects: Unified representation of GW impacts on the ‘resolved’ flow for all sources (energy-balanced schemes for momentum, heat and mixing). +!! 2. GW Propagation: Unified solver for "propagation, dissipation and breaking" excited from all type of GW sources. +!! 3. GW Effects: Unified representation of GW impacts on the "resolved" flow for all sources (energy-balanced schemes for momentum, heat and mixing). !! https://www.weather.gov/media/sti/nggps/Presentations%202017/02%20NGGPS_VYUDIN_2017_.pdf module cires_ugwp diff --git a/physics/drag_suite.F90 b/physics/drag_suite.F90 index 080bee156..0189785e3 100644 --- a/physics/drag_suite.F90 +++ b/physics/drag_suite.F90 @@ -90,7 +90,7 @@ end subroutine drag_suite_init !! the GWD scheme has the same physical basis as in Alpert (1987) with the addition !! of enhancement factors for the amplitude, G, and mountain shape details !! in G(Fr) to account for effects from the mountain blocking. A factor, -!! E m’, is an enhancement factor on the stress in the Alpert '87 scheme. +!! E m', is an enhancement factor on the stress in the Alpert '87 scheme. !! The E ranges from no enhancement to an upper limit of 3, E=E(OA)[1-3], !! and is a function of OA, the Orographic Asymmetry defined in KA (1995) as !! @@ -105,9 +105,9 @@ end subroutine drag_suite_init !! !! !! where Nx is the number of grid intervals for the large scale domain being -!! considered. So the term, E(OA)m’/ \f$ \Delta X \f$ in Kim's scheme represents -!! a multiplier on G shown in Alpert's eq (1), where m’ is the number of mountains -!! in a sub-grid scale box. Kim increased the complexity of m’ making it a +!! considered. So the term, E(OA)m'/ \f$ \Delta X \f$ in Kim's scheme represents +!! a multiplier on G shown in Alpert's eq (1), where m' is the number of mountains +!! in a sub-grid scale box. Kim increased the complexity of m' making it a !! function of the fractional area of the sub-grid mountain and the asymmetry !! and convexity statistics which are found from running a gravity wave !! model for a large number of cases: diff --git a/physics/gwdps.f b/physics/gwdps.f index 9454b967d..96ce0205b 100644 --- a/physics/gwdps.f +++ b/physics/gwdps.f @@ -87,7 +87,7 @@ end subroutine gwdps_init !! the GWD scheme has the same physical basis as in Alpert (1987) with the addition !! of enhancement factors for the amplitude, G, and mountain shape details !! in G(Fr) to account for effects from the mountain blocking. A factor, -!! E m’, is an enhancement factor on the stress in the Alpert '87 scheme. +!! E m', is an enhancement factor on the stress in the Alpert '87 scheme. !! The E ranges from no enhancement to an upper limit of 3, E=E(OA)[1-3], !! and is a function of OA, the Orographic Asymmetry defined in Kim and Arakawa (1995) !! \cite kim_and_arakawa_1995 as @@ -103,9 +103,9 @@ end subroutine gwdps_init !! \; (x_{j} \; - \; \bar{x} )^2}{N_{x}} } !!\f] !! where \f$N_{x}\f$ is the number of grid intervals for the large scale domain being -!! considered. So the term, E(OA)m’/ \f$ \Delta X \f$ in Kim's scheme represents -!! a multiplier on G shown in Alpert's eq (1), where m’ is the number of mountains -!! in a sub-grid scale box. Kim increased the complexity of m’ making it a +!! considered. So the term, E(OA)m'/ \f$ \Delta X \f$ in Kim's scheme represents +!! a multiplier on G shown in Alpert's eq (1), where m' is the number of mountains +!! in a sub-grid scale box. Kim increased the complexity of m' making it a !! function of the fractional area of the sub-grid mountain and the asymmetry !! and convexity statistics which are found from running a gravity wave !! model for a large number of cases: diff --git a/physics/micro_mg_utils.F90 b/physics/micro_mg_utils.F90 index 51178813c..5754eeed7 100644 --- a/physics/micro_mg_utils.F90 +++ b/physics/micro_mg_utils.F90 @@ -2656,7 +2656,7 @@ end subroutine graupel_rime_splintering ! prdg(i) = epsg*(q(i)-qvi(i))/abi ! !! make sure not pushed into ice supersat/subsat -!! put this in main mg3 code…..check for it… +!! put this in main mg3 code ... check for it ... !! formula from reisner 2 scheme !! diff --git a/physics/samfdeepcnv.f b/physics/samfdeepcnv.f index 83e1efb80..cec54c905 100644 --- a/physics/samfdeepcnv.f +++ b/physics/samfdeepcnv.f @@ -63,7 +63,7 @@ end subroutine samfdeepcnv_finalize !! + 2) For the "dynamic control", using a reference cloud work function, estimate the change in cloud work function due to the large-scale dynamics. Following the quasi-equilibrium assumption, calculate the cloud base mass flux required to keep the large-scale convective destabilization in balance with the stabilization effect of the convection. !! -# For grid sizes smaller than the threshold value (currently 8 km): !! + 1) compute the cloud base mass flux using the cumulus updraft velocity averaged ove the whole cloud depth. -!! -# For scale awareness, the updraft fraction (sigma) is obtained as a function of cloud base entrainment. Then, the final cloud base mass flux is obtained by the original mass flux multiplied by the (1−sigma) 2 . +!! -# For scale awareness, the updraft fraction (sigma) is obtained as a function of cloud base entrainment. Then, the final cloud base mass flux is obtained by the original mass flux multiplied by the (1-sigma) 2. !! -# For the "feedback control", calculate updated values of the state variables by multiplying the cloud base mass flux and the tendencies calculated per unit cloud base mass flux from the static control. !! !! \section samfdeep_detailed GFS samfdeepcnv Detailed Algorithm diff --git a/physics/ugwp_driver_v0.F b/physics/ugwp_driver_v0.F index 637eb8d4a..fec6d4e6a 100644 --- a/physics/ugwp_driver_v0.F +++ b/physics/ugwp_driver_v0.F @@ -267,7 +267,7 @@ end subroutine cires_ugwp_driver_v0 !! subgrid-scale orography effects in FV3GFS, EMC reinstalled the !! original gwdps-code with updated efficiency factors for the mountain !! blocking and OGW drag. The GFS OGW is described in the separate section -!! (\ref gfs_gwdps) and its “call” moved into UGWP-driver subroutine. +!! (\ref gfs_gwdps) and its "call" moved into UGWP-driver subroutine. !! This combination of NGW and OGW schemes was tested in the FV3GFS-L127 !! medium-range forecasts (15-30 days) for C96, C192, C384 and C768 !! resolutions and work in progress to introduce the optimal choice for From 151a38e796c1fd6a85c41ce8d22a791e1bbf2e2f Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 11 May 2020 15:55:26 -0600 Subject: [PATCH 2/2] Add GitHub workflow for basic checks, add tool to check for ASCII encoding of Fortran source files and metadata files --- .github/workflows/basic_checks.yml | 33 ++++++++++++++++++++++++++++++ tools/check_encoding.py | 25 ++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/workflows/basic_checks.yml create mode 100755 tools/check_encoding.py diff --git a/.github/workflows/basic_checks.yml b/.github/workflows/basic_checks.yml new file mode 100644 index 000000000..219c53bf4 --- /dev/null +++ b/.github/workflows/basic_checks.yml @@ -0,0 +1,33 @@ +name: Basic checks for CCPP physics schemes + +on: [push, pull_request] + +jobs: + build: + + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Init submodules + run: git submodule update --init --recursive + #- name: Update packages + # run: | + # /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + # #brew install autoconf automake coreutils gcc@9 libtool mpich gnu-sed wget + # brew install automake coreutils mpich gnu-sed + - name: Check for ASCII encoding + run: ./tools/check_encoding.py + #run: | + #export CC=gcc-9 + #export FC=gfortran-9 + #export CXX=g++-9 + #mkdir build + #cd build + #cmake -DCMAKE_INSTALL_PREFIX=$PWD/../install .. 2>&1 | tee log.cmake + #make -j8 2>&1 | tee log.make + #cd .. + #ls -l install/bin/ESMF_Info + #ls -l install/bin/wgrib2 + #cat install/share/nceplibs-external.cmake.config diff --git a/tools/check_encoding.py b/tools/check_encoding.py new file mode 100755 index 000000000..cf4f568d4 --- /dev/null +++ b/tools/check_encoding.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +#import chardet +import os +import sys + + +SUFFICES = [ '.f', '.F', '.f90', '.F90', '.meta' ] + +for root, dirs, files in os.walk(os.getcwd()): + print root, dirs, files + for file in files: + suffix = os.path.splitext(file)[1] + print file, suffix + if suffix in SUFFICES: + with open(os.path.join(root, file)) as f: + contents = f.read() + try: + contents.decode('ascii') + except UnicodeDecodeError: + for line in contents.split('\n'): + try: + line.decode('ascii') + except UnicodeDecodeError: + raise Exception('Detected non-ascii characters in file {}, line: "{}"'.format(os.path.join(root, file), line))