From 5196d55021462557896297b9491f2f4ba1100f51 Mon Sep 17 00:00:00 2001 From: "Benjamin T. Johnson" Date: Tue, 17 Dec 2024 11:14:59 -0500 Subject: [PATCH] zeroing out some of the stokes intializations (consistent with other variables), and fixing the stokes output formatting in CRTM_RTSolution_Inspect. --- src/CRTM_Forward_Module.f90 | 4 ++++ src/RTSolution/CRTM_RTSolution_Define.f90 | 24 ++++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/CRTM_Forward_Module.f90 b/src/CRTM_Forward_Module.f90 index 68c5d97f..f7412dc3 100644 --- a/src/CRTM_Forward_Module.f90 +++ b/src/CRTM_Forward_Module.f90 @@ -489,6 +489,9 @@ FUNCTION profile_solution (m, Opt, AncillaryInput) RESULT( Error_Status ) IF( Opt%n_Stokes > 0 ) THEN RTV(:)%n_Stokes = Opt%n_Stokes RTV_Clear(:)%n_Stokes = Opt%n_Stokes + ELSE + RTV(:)%n_Stokes = 0 + RTV_Clear(:)%n_Stokes = 0 END IF RTV(:)%RT_Algorithm_Id = Opt%RT_Algorithm_Id ! IF( Opt%RT_Algorithm_Id == RT_VMOM .and. RTV(1)%n_Stokes == 1) THEN @@ -1061,6 +1064,7 @@ FUNCTION profile_solution (m, Opt, AncillaryInput) RESULT( Error_Status ) ! mth_Azi = 0 is for an azimuth-averaged value (IR, MW) ! ...Initialise radiance RTSolution(ln,m)%Radiance = ZERO + RTSolution(ln,m)%Stokes = ZERO ! ...Fourier expansion over azimuth angle Azimuth_Fourier_Loop: DO mth_Azi = 0, RTV(nt)%n_Azi diff --git a/src/RTSolution/CRTM_RTSolution_Define.f90 b/src/RTSolution/CRTM_RTSolution_Define.f90 index f4871280..1c3958f6 100644 --- a/src/RTSolution/CRTM_RTSolution_Define.f90 +++ b/src/RTSolution/CRTM_RTSolution_Define.f90 @@ -237,7 +237,7 @@ MODULE CRTM_RTSolution_Define ! Radiative transfer results for a single channel REAL(fp) :: Radiance = ZERO REAL(fp) :: Brightness_Temperature = ZERO - REAL(fp) :: Stokes(4) + REAL(fp) :: Stokes(4) = ZERO REAL(fp) :: Solar_Irradiance = ZERO REAL(fp) :: Reflectance = ZERO REAL(fp), ALLOCATABLE :: Reflectivity(:) ! K @@ -441,16 +441,16 @@ ELEMENTAL SUBROUTINE CRTM_RTSolution_Zero( RTSolution ) RTSolution%Brightness_Temperature = ZERO RTSolution%Solar_Irradiance = ZERO RTSolution%Reflectance = ZERO - RTSolution%Stokes = ZERO + RTSolution%Stokes = ZERO ! Zero out the array data components IF ( CRTM_RTSolution_Associated(RTSolution) ) THEN - RTSolution%Upwelling_Radiance = ZERO - RTSolution%Upwelling_Overcast_Radiance = ZERO - RTSolution%Layer_Optical_Depth = ZERO - RTSolution%Single_Scatter_Albedo = ZERO - RTSolution%Reflectivity = ZERO - RTSolution%Reflectivity_Attenuated = ZERO + RTSolution%Upwelling_Radiance = ZERO + RTSolution%Upwelling_Overcast_Radiance = ZERO + RTSolution%Layer_Optical_Depth = ZERO + RTSolution%Single_Scatter_Albedo = ZERO + RTSolution%Reflectivity = ZERO + RTSolution%Reflectivity_Attenuated = ZERO END IF END SUBROUTINE CRTM_RTSolution_Zero @@ -498,6 +498,12 @@ SUBROUTINE Scalar_Inspect( RTSolution, Unit ) CHARACTER(len=*), PARAMETER :: fmt32 = '(3x,a,es13.6)' ! print in 32-bit precision CHARACTER(len=*), PARAMETER :: fmt = fmt64 ! choose 64-bit precision + CHARACTER(len=*), PARAMETER :: fmt64_4 = '(3x,a,4es22.15)' ! print in 64-bit precision + CHARACTER(len=*), PARAMETER :: fmt32_4 = '(3x,a,4es13.6)' ! print in 32-bit precision + CHARACTER(len=*), PARAMETER :: fmt_4 = fmt64_4 ! choose 64-bit precision + + + ! Setup fid = OUTPUT_UNIT IF ( PRESENT(Unit) ) THEN @@ -527,7 +533,7 @@ SUBROUTINE Scalar_Inspect( RTSolution, Unit ) WRITE(fid,fmt) "Brightness Temperature : ", RTSolution%Brightness_Temperature WRITE(fid,fmt) "Solar Irradiance : ", RTSolution%Solar_Irradiance WRITE(fid,fmt) "Reflectance : ", RTSolution%Reflectance - WRITE(fid,fmt) "Stokes : ", RTSolution%Stokes + WRITE(fid,fmt_4) "Stokes(1:4) : ", RTSolution%Stokes(1:4) IF ( CRTM_RTSolution_Associated(RTSolution) ) THEN WRITE(fid,'(3x,"n_Layers : ",i0)') RTSolution%n_Layers WRITE(fid,'(3x,"Upwelling Overcast Radiance :")')