Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence error messages in getChannel() and getWavelength(), and add header file in process library #249

Merged
merged 4 commits into from
Mar 7, 2024
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ 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.
- Add explicit `find_package()` calls for missing dependencies for MAPL for builds with spack-stack. Will eventually be fixed in MAPL in later versions
- Corrected the units of the gravimetric soil moisture to percent instead of fractional in the FENGSHA dust scheme.

Expand All @@ -29,6 +30,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `soil_moisture_factor` to the DU2G_instance_DU.rc (same name used in the K14 scheme) and DU2G_GridCompMod.F90 files for FENGSHA
- Add `soil_drylimit_factor` to the DU2G_instance_DU.rc and DU2G_GridCompMod.F90 files for FENGSHA

- Moved process library macros to header file.

## [v2.2.1] - 2023-05-30

### Fixed
Expand Down
41 changes: 24 additions & 17 deletions Process_Library/GOCART2G_MieMod.F90
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "Process.H"
!BOP
!
! !MODULE: GOCART2G_MieMod --- Reader for aerosol mie tables
Expand Down Expand Up @@ -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
tclune marked this conversation as resolved.
Show resolved Hide resolved
endif

end function getChannel
Expand All @@ -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
mathomp4 marked this conversation as resolved.
Show resolved Hide resolved

end function getWavelength

Expand Down
11 changes: 1 addition & 10 deletions Process_Library/GOCART2G_Process.F90
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 10 additions & 0 deletions Process_Library/Process.H
Original file line number Diff line number Diff line change
@@ -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
Loading