From 3249963d240e26da2ec747cfef2b615215a99984 Mon Sep 17 00:00:00 2001 From: Raffaele Montuoro Date: Mon, 24 Jul 2023 23:47:55 +0000 Subject: [PATCH 1/3] Move process library macro definitions to new header file (Process.H). --- Process_Library/GOCART2G_Process.F90 | 11 +---------- Process_Library/Process.H | 10 ++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 Process_Library/Process.H diff --git a/Process_Library/GOCART2G_Process.F90 b/Process_Library/GOCART2G_Process.F90 index 6892082c..ac2f1ef0 100644 --- a/Process_Library/GOCART2G_Process.F90 +++ b/Process_Library/GOCART2G_Process.F90 @@ -1,13 +1,4 @@ -#define __SUCCESS__ 0 -#define __FAIL__ 1 -#define __VERIFY__(x) if(x/=0) then; if(present(rc)) rc=x; return; endif -#define __VERIFY_NO_OPT__(x) if(x/=0) then; rc=x; return; endif -#define __RC__ rc=status); __VERIFY__(status -#define __RC_NO_OPT__ rc=status); __VERIFY_NO_OPT__(status -#define __STAT__ stat=status); __VERIFY__(status -#define __IOSTAT__ iostat=status); __VERIFY__(status -#define __RETURN__(x) if (present(rc)) rc=x; return -#define __ASSERT__(expr) if(.not. (expr)) then; if (present(rc)) rc=-1; return; endif +#include "Process.H" !------------------------------------------------------------------------- ! ! !MODULE: GOCART2G_Process -- GOCART2G process library diff --git a/Process_Library/Process.H b/Process_Library/Process.H new file mode 100644 index 00000000..fa74ee6c --- /dev/null +++ b/Process_Library/Process.H @@ -0,0 +1,10 @@ +#define __SUCCESS__ 0 +#define __FAIL__ 1 +#define __VERIFY__(x) if(x/=0) then; if(present(rc)) rc=x; return; endif +#define __VERIFY_NO_OPT__(x) if(x/=0) then; rc=x; return; endif +#define __RC__ rc=status); __VERIFY__(status +#define __RC_NO_OPT__ rc=status); __VERIFY_NO_OPT__(status +#define __STAT__ stat=status); __VERIFY__(status +#define __IOSTAT__ iostat=status); __VERIFY__(status +#define __RETURN__(x) if (present(rc)) rc=x; return +#define __ASSERT__(expr) if(.not. (expr)) then; if (present(rc)) rc=-1; return; endif From 60ec5f7a608e123f16dc604f00a2f677c015a426 Mon Sep 17 00:00:00 2001 From: Raffaele Montuoro Date: Mon, 24 Jul 2023 23:58:12 +0000 Subject: [PATCH 2/3] Do not output error message for missing wavelengh/channel unless the optional rc argument is provided. --- Process_Library/GOCART2G_MieMod.F90 | 41 +++++++++++++++++------------ 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/Process_Library/GOCART2G_MieMod.F90 b/Process_Library/GOCART2G_MieMod.F90 index a595d8d4..15966ba2 100644 --- a/Process_Library/GOCART2G_MieMod.F90 +++ b/Process_Library/GOCART2G_MieMod.F90 @@ -1,3 +1,4 @@ +#include "Process.H" !BOP ! ! !MODULE: GOCART2G_MieMod --- Reader for aerosol mie tables @@ -540,13 +541,15 @@ integer function getChannel(this, wavelength, rc) result (ch) endif enddo - if (present(rc)) rc = 0 - - if (ch < 0) then - !$omp critical (GetCha) - print*, "wavelength of ",wavelength, " is an invalid value." - !$omp end critical (GetCha) - if (present(rc)) rc = -1 + if (present(rc)) then + if (ch > 0) then + rc = __SUCCESS__ + else + rc = __FAIL__ + !$omp critical (GetCha) + print*, "wavelength of ",wavelength, " is an invalid value." + !$omp end critical (GetCha) + endif endif end function getChannel @@ -558,18 +561,22 @@ real function getWavelength(this, ith_channel, rc) result (wavelength) real, parameter :: w_tol = 1.e-9 integer :: i - if (present(rc)) rc = 0 - if (ith_channel <=0 .or. ith_channel > this%nch ) then - !$omp critical (GetWav) - print*, "The channel of ",ith_channel, " is an invalid channel number." - !$omp end critical (GetWav) - if (present(rc)) rc = -1 - wavelength = -1. ! meanlingless nagative - return + wavelength = -1. ! meaningless negative + else + wavelength = this%wavelengths(ith_channel) endif - - wavelength = this%wavelengths(ith_channel) + + if (present(rc)) then + if (wavelength > 0) then + rc = __SUCCESS__ + else + rc = __FAIL__ + !$omp critical (GetWav) + print*, "The channel of ",ith_channel, " is an invalid channel number." + !$omp end critical (GetWav) + endif + endif end function getWavelength From 24d4be95b62f6d8925e2174b1f44d78cd82bd39a Mon Sep 17 00:00:00 2001 From: Raffaele Montuoro Date: Tue, 25 Jul 2023 20:01:20 +0000 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25023cc6..4c7558c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,10 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Silenced unwarranted error messages from wavelength/channel retrieval functions occurring when 470nm and/or 870nm channels are not included in GOCART resource file. + ### Added ### Changed +- Moved process library macros to header file. + ## [v2.2.1] - 2023-05-30 ### Fixed