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

Merge the RadMon data extract source code into rrfs_util. #46

Merged
merged 6 commits into from
Nov 2, 2023
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ add_subdirectory(update_bc)
add_subdirectory(ens_mean_recenter)
add_subdirectory(FV3_ensmean_recenter)
add_subdirectory(bufrsnd)
add_subdirectory(radmon)
add_subdirectory(rtma_minmaxtrh)
add_subdirectory(pm)
add_subdirectory(blending)
Expand Down
7 changes: 7 additions & 0 deletions radmon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model precise -assume byterecl -convert big_endian")

add_subdirectory(shared)
add_subdirectory(verf_radang.fd)
add_subdirectory(verf_radbcoef.fd)
add_subdirectory(verf_radbcor.fd)
add_subdirectory(verf_radtime.fd)
24 changes: 24 additions & 0 deletions radmon/shared/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
list(APPEND SRCS
kinds_radmon.F90
read_diag.f90
sparsearr.f90
)

set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/include")
add_library(radmonlib STATIC ${SRCS})
add_library(${PROJECT_NAME}::radmonlib ALIAS radmonlib)

target_compile_definitions(radmonlib PRIVATE "_REAL8_")
target_link_libraries(radmonlib PRIVATE NetCDF::NetCDF_Fortran)
target_link_libraries(radmonlib PRIVATE ncdiag::ncdiag_serial)
set_target_properties(radmonlib PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}")
target_include_directories(radmonlib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include DESTINATION ${CMAKE_INSTALL_PREFIX})

install(
TARGETS radmonlib
EXPORT ${PROJECT_NAME}Exports
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
112 changes: 112 additions & 0 deletions radmon/shared/kinds_radmon.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
module kinds_radmon
!$$$ module documentation block
! . . . .
! module: kinds
! prgmmr: treadon org: np23 date: 2004-08-15
!
! abstract: Module to hold specification kinds for variable declaration.
! This module is based on (copied from) Paul vanDelst's
! type_kinds module found in the community radiative transfer
! model
!
! module history log:
! 2004-08-15 treadon
! 2011-07-04 todling - define main precision during compilation
!
! Subroutines Included:
!
! Functions Included:
!
! remarks:
! The numerical data types defined in this module are:
! i_byte - specification kind for byte (1-byte) integer variable
! i_short - specification kind for short (2-byte) integer variable
! i_long - specification kind for long (4-byte) integer variable
! i_llong - specification kind for double long (8-byte) integer variable
! r_single - specification kind for single precision (4-byte) real variable
! r_double - specification kind for double precision (8-byte) real variable
! r_quad - specification kind for quad precision (16-byte) real variable
!
! i_kind - generic specification kind for default integer
! r_kind - generic specification kind for default floating point
!
!
! attributes:
! language: f90
! machine: ibm RS/6000 SP
!
!$$$ end documentation block
implicit none
private

! Integer type definitions below

! Integer types
integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer
integer, parameter, public :: i_short = selected_int_kind(4) ! short integer
integer, parameter, public :: i_long = selected_int_kind(8) ! long integer
integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer
integer, parameter, public :: i_llong = max( llong_t, i_long )

! Expected 8-bit byte sizes of the integer kinds
integer, parameter, public :: num_bytes_for_i_byte = 1
integer, parameter, public :: num_bytes_for_i_short = 2
integer, parameter, public :: num_bytes_for_i_long = 4
integer, parameter, public :: num_bytes_for_i_llong = 8

! Define arrays for default definition
integer, parameter, private :: num_i_kinds = 4
integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ &
i_byte, i_short, i_long, i_llong /)
integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ &
num_bytes_for_i_byte, num_bytes_for_i_short, &
num_bytes_for_i_long, num_bytes_for_i_llong /)

! Default values
! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND ***
integer, parameter, private :: default_integer = 3 ! 1=byte,
! 2=short,
! 3=long,
! 4=llong
integer, parameter, public :: i_kind = integer_types( default_integer )
integer, parameter, public :: num_bytes_for_i_kind = &
integer_byte_sizes( default_integer )


! Real definitions below

! Real types
integer, parameter, public :: r_single = selected_real_kind(6) ! single precision
integer, parameter, public :: r_double = selected_real_kind(15) ! double precision
integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision
integer, parameter, public :: r_quad = max( quad_t, r_double )

! Expected 8-bit byte sizes of the real kinds
integer, parameter, public :: num_bytes_for_r_single = 4
integer, parameter, public :: num_bytes_for_r_double = 8
integer, parameter, public :: num_bytes_for_r_quad = 16

! Define arrays for default definition
integer, parameter, private :: num_r_kinds = 3
integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ &
r_single, r_double, r_quad /)
integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ &
num_bytes_for_r_single, num_bytes_for_r_double, &
num_bytes_for_r_quad /)

! Default values
! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND ***
#ifdef _REAL4_
integer, parameter, private :: default_real = 1 ! 1=single,
#endif
#ifdef _REAL8_
integer, parameter, private :: default_real = 2 ! 2=double,
#endif
#ifdef _REAL16_
integer, parameter, private :: default_real = 3 ! 3=quad
#endif
integer, parameter, public :: r_kind = real_kinds( default_real )
integer, parameter, public :: num_bytes_for_r_kind = &
real_byte_sizes( default_real )

end module kinds_radmon
Loading