Skip to content

Commit

Permalink
Merge pull request #66 from JCSDA/feature/cd_RTSout_netCDF
Browse files Browse the repository at this point in the history
Feature/cd rt sout net cdf
  • Loading branch information
BenjaminTJohnson authored Oct 3, 2023
2 parents 11c04f8 + 3b593f0 commit 23d6d2b
Show file tree
Hide file tree
Showing 3 changed files with 1,332 additions and 78 deletions.
74 changes: 54 additions & 20 deletions src/Build/libsrc/test/check_crtm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ PROGRAM check_crtm
!
! Module usage
USE CRTM_Module
USE CRTM_RTSolution_Define, ONLY: CRTM_RTSolution_WriteFile
! Disable all implicit typing
IMPLICIT NONE
! ============================================================================
Expand Down Expand Up @@ -113,6 +114,7 @@ PROGRAM check_crtm
CHARACTER(256) :: CloudCoeff_Format
CHARACTER(256) :: Aerosol_Scheme
CHARACTER(256) :: Cloud_Scheme
CHARACTER(256) :: output_nc_file
INTEGER :: err_stat, alloc_stat
INTEGER :: n_channels
INTEGER :: l, m, n, nc
Expand Down Expand Up @@ -254,6 +256,14 @@ PROGRAM check_crtm
CALL Display_Message( PROGRAM_NAME, message, FAILURE )
STOP
END IF

! The output structure
CALL CRTM_RTSolution_Create( rts, N_LAYERS )
IF ( ANY(.NOT. CRTM_RTSolution_Associated(rts)) ) THEN
Message = 'Error allocating CRTM RTSolution structures'
CALL Display_Message( PROGRAM_NAME, Message, FAILURE )
STOP 1
END IF
! ==========================================================================

! ==========================================================================
Expand Down Expand Up @@ -346,29 +356,53 @@ PROGRAM check_crtm
CALL Display_Message( PROGRAM_NAME, message, FAILURE )
STOP
END IF

! 8b. The AOD model
! ----------------------
err_stat = CRTM_AOD( atm , &
chinfo(n:n), &
rts )
IF ( err_stat /= SUCCESS ) THEN
Message = 'Error in CRTM AOD Model'
CALL Display_Message( PROGRAM_NAME, Message, FAILURE )
STOP 1
END IF
! ==========================================================================

! ============================================================================
! 8c. **** OUTPUT THE RESULTS TO SCREEN ****
!
! User should read the user guide or the source code of the routine
! CRTM_RTSolution_Inspect in the file CRTM_RTSolution_Define.f90 to
! select the needed variables for outputs. These variables are contained
! in the structure RTSolution.
DO m = 1, N_PROFILES
WRITE( *,'(//7x,"Profile ",i0," output for ",a )') m, TRIM(Sensor_Id(n))
DO l = 1, n_Channels
WRITE( *, '(/5x,"Channel ",i0," results")') chinfo(n)%Sensor_Channel(l)
CALL CRTM_RTSolution_Inspect(rts(l,m))
CALL CRTM_RTSolution_Inspect(rts_K(l,m))
CALL CRTM_Atmosphere_Inspect(atm_K(l,m))
CALL CRTM_Surface_Inspect(sfc_K(l,m))

END DO
CALL CRTM_Atmosphere_Inspect(atm(m))
CALL CRTM_Surface_Inspect(sfc(m))
END DO
! ============================================================================
! 8c. **** OUTPUT THE RESULTS TO SCREEN ****
!
! User should read the user guide or the source code of the routine
! CRTM_RTSolution_Inspect in the file CRTM_RTSolution_Define.f90 to
! select the needed variables for outputs. These variables are contained
! in the structure RTSolution.
DO m = 1, N_PROFILES
WRITE( *,'(//7x,"Profile ",i0," output for ",a )') m, TRIM(Sensor_Id(n))
DO l = 1, n_Channels
WRITE( *, '(/5x,"Channel ",i0," results")') chinfo(n)%Sensor_Channel(l)
CALL CRTM_RTSolution_Inspect(rts(l,m))
CALL CRTM_RTSolution_Inspect(rts_K(l,m))
CALL CRTM_Atmosphere_Inspect(atm_K(l,m))
CALL CRTM_Surface_Inspect(sfc_K(l,m))

END DO
CALL CRTM_Atmosphere_Inspect(atm(m))
CALL CRTM_Surface_Inspect(sfc(m))
END DO

! Uncomment to write crtm outputs in a netCDF file
! 8d. **** OUTPUT THE RESULTS TO NetCDF files ****
! output_nc_file = TRIM(SENSOR_ID(n))
! print *, 'start CRTM_RTSolution_WriteFile'
! err_stat = CRTM_RTSolution_WriteFile( &
! output_nc_file , & ! Input
! rts , & ! Input
! NetCDF=.TRUE. ) ! Optional Input
! IF ( err_stat /= SUCCESS ) THEN
! message = 'Error calling CRTM_RTSolution_WriteFile for '//TRIM(SENSOR_ID(n))
! CALL Display_Message( PROGRAM_NAME, message, FAILURE )
! STOP
! END IF

! ==========================================================================
! STEP 9. **** CLEAN UP FOR NEXT SENSOR ****
Expand Down
Loading

0 comments on commit 23d6d2b

Please sign in to comment.