diff --git a/CMakeLists.txt b/CMakeLists.txt index d704dda6..41cb54f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,7 @@ ecbuild_add_option( FEATURE OUTPUT_MANAGER ecbuild_add_option( FEATURE OUTPUT_MANAGER_ENCODER_REPORT CONDITION HAVE_OUTPUT_MANAGER - DEFAULT ON + DEFAULT OFF DESCRIPTION "Enable generation of the encoding report" ) ecbuild_add_option( FEATURE OUTPUT_MANAGER_TOOL @@ -116,7 +116,6 @@ ecbuild_add_option( FEATURE OUTPUT_MANAGER_TOOL DESCRIPTION "Enable generation of standalone tool" ) ### export package info - set( MULTIO_CONFIG_DIR share/multio/config ) set( MULTIO_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src ) set( MULTIO_LIBRARIES multio ) diff --git a/src/ecom/CMakeLists.txt b/src/ecom/CMakeLists.txt index d7a64852..986f332c 100644 --- a/src/ecom/CMakeLists.txt +++ b/src/ecom/CMakeLists.txt @@ -1,5 +1,8 @@ if ( HAVE_OUTPUT_MANAGER ) +# Install samples in the proper directory +set( MULTIO_SAMPLE_DIR share/ecom/samples ) + # Update on new big features set(OUTPUT_MANAGER_MAJOR 0) @@ -412,6 +415,9 @@ ecbuild_add_executable( endif() +# Add the samples subdirectory +add_subdirectory( samples ) + #set_target_properties( ecom PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/module/ecom ) #target_include_directories( ecom PUBLIC $ ) diff --git a/src/ecom/containers/circular_buffer_mod.F90 b/src/ecom/containers/circular_buffer_mod.F90 index fb2cff7b..36d18ada 100644 --- a/src/ecom/containers/circular_buffer_mod.F90 +++ b/src/ecom/containers/circular_buffer_mod.F90 @@ -27,58 +27,41 @@ MODULE CIRCULAR_BUFFER_MOD !> @brief data structure that contains all the relevant fields needed to define a circular buffer TYPE :: CIRCULARBUFFER_T - INTEGER(KIND=JPIB_K), ALLOCATABLE, DIMENSION(:) :: BUFFER - INTEGER(KIND=JPIB_K) :: HEAD = 1 - INTEGER(KIND=JPIB_K) :: TAIL = 1 - INTEGER(KIND=JPIB_K) :: SIZE = 0 - INTEGER(KIND=JPIB_K) :: CAPACITY=-99 + PRIVATE + INTEGER(KIND=JPIB_K), ALLOCATABLE, DIMENSION(:) :: BUFFER_ + INTEGER(KIND=JPIB_K) :: HEAD_ = 1 + INTEGER(KIND=JPIB_K) :: TAIL_ = 1 + INTEGER(KIND=JPIB_K) :: SIZE_ = 0 + INTEGER(KIND=JPIB_K) :: CAPACITY_=-99 + CONTAINS + PROCEDURE, PUBLIC, PASS :: INIT => CB_INIT + PROCEDURE, PUBLIC, PASS :: ENQUEUE => CB_ENQUEUE + PROCEDURE, PUBLIC, PASS :: DEQUEUE => CB_DEQUEUE + PROCEDURE, PUBLIC, PASS :: GET => CB_GET + PROCEDURE, PUBLIC, PASS :: GET_ALL => CB_GET_ALL + PROCEDURE, PUBLIC, PASS :: SIZE => CB_SIZE + PROCEDURE, PUBLIC, PASS :: IS_EMPTY => CB_IS_EMPTY + PROCEDURE, PUBLIC, PASS :: FREE => CB_FREE END TYPE - !> @brief node in a list that contains pointer to circular buffers. - TYPE :: CB_LIST_NODE_T - CLASS(CIRCULARBUFFER_T), POINTER :: CB_ => NULL() - TYPE(CB_LIST_NODE_T), POINTER :: NEXT_ => NULL() - TYPE(CB_LIST_NODE_T), POINTER :: PREV_ => NULL() - END TYPE - - !> @brief List of circular buffers - TYPE :: CB_LIST_T - TYPE(CB_LIST_NODE_T), POINTER :: HEAD_ => NULL() - TYPE(CB_LIST_NODE_T), POINTER :: TAIL_ => NULL() - INTEGER(KIND=JPIB_K) :: SIZE = 0 - END TYPE - - ! Whitelist of public symbols (datatypes) PUBLIC :: CIRCULARBUFFER_T - PUBLIC :: CB_LIST_T - - ! Whitelist of public symbols (precedures) - PUBLIC :: CB_INIT - PUBLIC :: CB_ENQUEUE - PUBLIC :: CB_SIZE - PUBLIC :: CB_GET - PUBLIC :: CB_GET_ALL - PUBLIC :: CB_NEW - PUBLIC :: CB_FREE_ALL CONTAINS + !> -!> @brief Allocates a new circular buffer. +!> @brief Initializes a circular buffer with the specified capacity. !> -!> This function allocates memory for a new circular buffer with the specified capacity. -!> The circular buffer structure is initialized, and memory is allocated to hold elements -!> based on the specified capacity. +!> This subroutine initializes a circular buffer with the specified capacity. +!> It allocates memory for the circular buffer and sets its capacity. !> -!> @param [out] THIS The circular buffer structure to be initialized. +!> @param [out] THIS The circular buffer structure to be initialized. !> @param [in] CAPACITY The capacity of the circular buffer. !> -!> @return PCB Pointer to the newly allocated circular buffer. -!> -#define PP_PROCEDURE_TYPE 'FUNCTION' -#define PP_PROCEDURE_NAME 'CB_NEW' -FUNCTION CB_NEW(THIS, CAPACITY) RESULT(PCB) +#define PP_PROCEDURE_TYPE 'SUBROUTINE' +#define PP_PROCEDURE_NAME 'CB_INIT' +SUBROUTINE CB_INIT(THIS, CAPACITY) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K @@ -89,11 +72,8 @@ FUNCTION CB_NEW(THIS, CAPACITY) RESULT(PCB) IMPLICIT NONE ! Dummy arguments - TYPE(CB_LIST_T), INTENT(OUT) :: THIS - INTEGER(KIND=JPIB_K), INTENT(IN) :: CAPACITY - - ! Local variables - CLASS(CIRCULARBUFFER_T), POINTER :: PCB + CLASS(CIRCULARBUFFER_T), INTENT(INOUT) :: THIS + INTEGER(KIND=JPIB_K), INTENT(IN) :: CAPACITY ! Local variables declared by the preprocessor for tracing purposes PP_TRACE_DECL_VARS @@ -101,97 +81,12 @@ FUNCTION CB_NEW(THIS, CAPACITY) RESULT(PCB) ! Trace begin of procedure PP_TRACE_ENTER_PROCEDURE() - ! Initialisation - NULLIFY( PCB ) - - ! Allocation - IF ( .NOT. ASSOCIATED(THIS%HEAD_) ) THEN - ALLOCATE( THIS%HEAD_ ) - THIS%TAIL_ => THIS%HEAD_ - ALLOCATE( THIS%HEAD_%CB_ ) - CALL CB_INIT( THIS%HEAD_%CB_, CAPACITY ) - PCB => THIS%TAIL_%CB_ - THIS%SIZE = 1 - NULLIFY(THIS%HEAD_%PREV_) - NULLIFY(THIS%HEAD_%NEXT_) - ELSE - ALLOCATE( THIS%TAIL_%NEXT_ ) - THIS%TAIL_%NEXT_%PREV_ => THIS%TAIL_ - THIS%TAIL_ => THIS%TAIL_%NEXT_ - NULLIFY(THIS%TAIL_%NEXT_) - PCB => THIS%TAIL_%CB_ - THIS%SIZE = THIS%SIZE + 1 - ENDIF - - ! Trace end of procedure (on success) - PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() - - ! Exit point on success - RETURN - -END FUNCTION CB_NEW -#undef PP_PROCEDURE_NAME -#undef PP_PROCEDURE_TYPE - - -!> -!> @brief Frees memory allocated for all circular buffers. -!> -!> This subroutine frees the memory allocated for all circular buffers in the list. -!> It deallocates memory associated with each circular buffer and resets the list. -!> -!> @param [out] THIS The circular buffer list structure to be freed. -!> -#define PP_PROCEDURE_TYPE 'SUBROUTINE' -#define PP_PROCEDURE_NAME 'CB_FREE_ALL' -SUBROUTINE CB_FREE_ALL(THIS) - - ! Symbols imported by the preprocessor for tracing purposes - PP_TRACE_USE_VARS - -IMPLICIT NONE - - ! Dummy arguments - TYPE(CB_LIST_T), INTENT(OUT) :: THIS - - ! Local variables - TYPE(CB_LIST_NODE_T), POINTER :: CURR - - ! Local variables declared by the preprocessor for tracing purposes - PP_TRACE_DECL_VARS - - ! Trace begin of procedure - PP_TRACE_ENTER_PROCEDURE() + ! Free memory just to avoid memory leaks + CALL THIS%FREE() - IF ( ASSOCIATED(THIS%HEAD_) ) THEN - - DO - - IF ( .NOT.ASSOCIATED(THIS%TAIL_) ) THEN - EXIT - ENDIF - - CURR => THIS%TAIL_ - THIS%TAIL_ => THIS%TAIL_%PREV_ - IF ( ASSOCIATED(THIS%TAIL_) ) THEN - NULLIFY(THIS%TAIL_%NEXT_) - ENDIF - - DEALLOCATE( CURR%CB_ ) - ! Paranoid operation - NULLIFY( CURR%CB_ ) - DEALLOCATE( CURR ) - NULLIFY(CURR) - - THIS%SIZE = THIS%SIZE - 1 - - ENDDO - - NULLIFY(THIS%TAIL_) - NULLIFY(THIS%HEAD_) - THIS%SIZE = 0 - - ENDIF + ! Initialize the circular buffer + THIS%CAPACITY_ = CAPACITY + ALLOCATE( THIS%BUFFER_(CAPACITY) ) ! Trace end of procedure (on success) PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() @@ -199,7 +94,7 @@ SUBROUTINE CB_FREE_ALL(THIS) ! Exit point on success RETURN -END SUBROUTINE CB_FREE_ALL +END SUBROUTINE CB_INIT #undef PP_PROCEDURE_NAME #undef PP_PROCEDURE_TYPE @@ -214,11 +109,8 @@ END SUBROUTINE CB_FREE_ALL !> @param [in] CAPACITY The capacity of the circular buffer. !> #define PP_PROCEDURE_TYPE 'SUBROUTINE' -#define PP_PROCEDURE_NAME 'CB_INIT' -SUBROUTINE CB_INIT(THIS, CAPACITY) - - ! Symbols imported from other modules within the project. - USE :: OM_CORE_MOD, ONLY: JPIB_K +#define PP_PROCEDURE_NAME 'CB_FREE' +SUBROUTINE CB_FREE( THIS ) ! Symbols imported by the preprocessor for tracing purposes PP_TRACE_USE_VARS @@ -226,8 +118,7 @@ SUBROUTINE CB_INIT(THIS, CAPACITY) IMPLICIT NONE ! Dummy arguments - TYPE(CIRCULARBUFFER_T), INTENT(OUT) :: THIS - INTEGER(KIND=JPIB_K), INTENT(IN) :: CAPACITY + CLASS(CIRCULARBUFFER_T), INTENT(INOUT) :: THIS ! Local variables declared by the preprocessor for tracing purposes PP_TRACE_DECL_VARS @@ -235,8 +126,13 @@ SUBROUTINE CB_INIT(THIS, CAPACITY) ! Trace begin of procedure PP_TRACE_ENTER_PROCEDURE() - THIS%CAPACITY = CAPACITY - ALLOCATE( THIS%BUFFER(CAPACITY) ) + THIS%HEAD_ = 1 + THIS%TAIL_ = 1 + THIS%SIZE_ = 0 + THIS%CAPACITY_=-99 + IF ( ALLOCATED(THIS%BUFFER_) ) THEN + DEALLOCATE(THIS%BUFFER_) + ENDIF ! Trace end of procedure (on success) PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() @@ -244,7 +140,7 @@ SUBROUTINE CB_INIT(THIS, CAPACITY) ! Exit point on success RETURN -END SUBROUTINE CB_INIT +END SUBROUTINE CB_FREE #undef PP_PROCEDURE_NAME #undef PP_PROCEDURE_TYPE @@ -271,8 +167,8 @@ SUBROUTINE CB_ENQUEUE(THIS, VALUE) IMPLICIT NONE ! Dummy arguments - TYPE(CIRCULARBUFFER_T), INTENT(INOUT) :: THIS - INTEGER(KIND=JPIB_K), INTENT(IN) :: VALUE + CLASS(CIRCULARBUFFER_T), INTENT(INOUT) :: THIS + INTEGER(KIND=JPIB_K), INTENT(IN) :: VALUE ! Local variables INTEGER(KIND=JPIB_K) :: TMP @@ -285,16 +181,16 @@ SUBROUTINE CB_ENQUEUE(THIS, VALUE) PP_TRACE_ENTER_PROCEDURE() ! If the buffer is full then remove the last element - IF (THIS%SIZE .EQ. THIS%CAPACITY) THEN + IF (THIS%SIZE_ .EQ. THIS%CAPACITY_) THEN EX = CB_DEQUEUE( THIS, TMP ) ENDIF ! Add element to the buffer - THIS%BUFFER(THIS%HEAD) = VALUE + THIS%BUFFER_(THIS%HEAD_) = VALUE ! Update head and tail - THIS%HEAD = MOD(THIS%HEAD, THIS%CAPACITY) + 1 - THIS%SIZE = THIS%SIZE + 1 + THIS%HEAD_ = MOD(THIS%HEAD_, THIS%CAPACITY_) + 1 + THIS%SIZE_ = THIS%SIZE_ + 1 ! Trace end of procedure (on success) PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() @@ -331,8 +227,8 @@ FUNCTION CB_DEQUEUE(THIS, VALUE) RESULT(EX) IMPLICIT NONE ! Dummy arguments - TYPE(CIRCULARBUFFER_T), INTENT(INOUT) :: THIS - INTEGER(KIND=JPIB_K), INTENT(OUT) :: VALUE + CLASS(CIRCULARBUFFER_T), INTENT(INOUT) :: THIS + INTEGER(KIND=JPIB_K), INTENT(OUT) :: VALUE ! Function result LOGICAL :: EX @@ -343,14 +239,14 @@ FUNCTION CB_DEQUEUE(THIS, VALUE) RESULT(EX) ! Trace begin of procedure PP_TRACE_ENTER_PROCEDURE() - IF ( THIS%SIZE .EQ. 0 ) THEN + IF ( THIS%SIZE_ .EQ. 0 ) THEN EX = .FALSE. VALUE = -9999 ELSE EX = .TRUE. - VALUE = THIS%BUFFER(THIS%TAIL) - THIS%TAIL = MOD(THIS%TAIL, THIS%CAPACITY) + 1 - THIS%SIZE = THIS%SIZE - 1 + VALUE = THIS%BUFFER_(THIS%TAIL_) + THIS%TAIL_ = MOD(THIS%TAIL_, THIS%CAPACITY_) + 1 + THIS%SIZE_ = THIS%SIZE_ - 1 ENDIF ! Trace end of procedure (on success) @@ -395,9 +291,9 @@ FUNCTION CB_GET(THIS, I, VALUE) RESULT(EX) IMPLICIT NONE ! Dummy arguments - TYPE(CIRCULARBUFFER_T), INTENT(INOUT) :: THIS - INTEGER(KIND=JPIB_K), INTENT(IN) :: I - INTEGER(KIND=JPIB_K), INTENT(OUT) :: VALUE + CLASS(CIRCULARBUFFER_T), INTENT(IN) :: THIS + INTEGER(KIND=JPIB_K), INTENT(IN) :: I + INTEGER(KIND=JPIB_K), INTENT(OUT) :: VALUE ! Function result LOGICAL :: EX @@ -408,12 +304,12 @@ FUNCTION CB_GET(THIS, I, VALUE) RESULT(EX) ! Trace begin of procedure PP_TRACE_ENTER_PROCEDURE() - IF ( THIS%SIZE .EQ. 0 .OR. THIS%CAPACITY .LT. I) THEN + IF ( THIS%SIZE_ .EQ. 0 .OR. THIS%CAPACITY_ .LT. I) THEN EX = .FALSE. VALUE = -9999 ELSE EX = .TRUE. - VALUE = THIS%BUFFER(MOD(THIS%HEAD+THIS%CAPACITY-I-1,THIS%CAPACITY)+1) + VALUE = THIS%BUFFER_(MOD(THIS%HEAD_+THIS%CAPACITY_-I-1,THIS%CAPACITY_)+1) ENDIF ! Trace end of procedure (on success) @@ -450,9 +346,9 @@ FUNCTION CB_GET_ALL(THIS, SZ, VALUES) RESULT(EX) IMPLICIT NONE ! Dummy arguments - TYPE(CIRCULARBUFFER_T), INTENT(INOUT) :: THIS - INTEGER(KIND=JPIB_K), INTENT(OUT) :: SZ - INTEGER(KIND=JPIB_K), DIMENSION(:), INTENT(OUT) :: VALUES + CLASS(CIRCULARBUFFER_T), INTENT(IN) :: THIS + INTEGER(KIND=JPIB_K), INTENT(OUT) :: SZ + INTEGER(KIND=JPIB_K), DIMENSION(:), INTENT(OUT) :: VALUES ! Function result LOGICAL :: EX @@ -467,10 +363,10 @@ FUNCTION CB_GET_ALL(THIS, SZ, VALUES) RESULT(EX) PP_TRACE_ENTER_PROCEDURE() VALUES = -9999 - SZ = MIN( SIZE(VALUES), THIS%SIZE ) + SZ = MIN( SIZE(VALUES), THIS%SIZE_ ) DO I = 1, SZ EX = .TRUE. - VALUES(SZ-I+1) = THIS%BUFFER(MOD(THIS%HEAD+THIS%CAPACITY-I-1,THIS%CAPACITY)+1) + VALUES(SZ-I+1) = THIS%BUFFER_(MOD(THIS%HEAD_+THIS%CAPACITY_-I-1,THIS%CAPACITY_)+1) ENDDO ! Trace end of procedure (on success) @@ -507,7 +403,7 @@ FUNCTION CB_SIZE(THIS) RESULT(SIZE) IMPLICIT NONE ! Dummy arguments - TYPE(CIRCULARBUFFER_T), INTENT(IN) :: THIS + CLASS(CIRCULARBUFFER_T), INTENT(IN) :: THIS ! Function result INTEGER(KIND=JPIB_K) :: SIZE @@ -518,7 +414,7 @@ FUNCTION CB_SIZE(THIS) RESULT(SIZE) ! Trace begin of procedure PP_TRACE_ENTER_PROCEDURE() - SIZE = THIS%SIZE + SIZE = THIS%SIZE_ ! Trace end of procedure (on success) PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() @@ -530,6 +426,47 @@ END FUNCTION CB_SIZE #undef PP_PROCEDURE_NAME #undef PP_PROCEDURE_TYPE + +!> +!> @brief True if the queue is empty +!> +!> @param [in] THIS The circular buffer structure. +!> +!> @return IS_EMPTY A flag that is true if the queue is empty +!> +#define PP_PROCEDURE_TYPE 'FUNCTION' +#define PP_PROCEDURE_NAME 'CB_IS_EMPTY' +FUNCTION CB_IS_EMPTY(THIS) RESULT(IS_EMPTY) + + ! Symbols imported by the preprocessor for tracing purposes + PP_TRACE_USE_VARS + +IMPLICIT NONE + + ! Dummy arguments + CLASS(CIRCULARBUFFER_T), INTENT(IN) :: THIS + + ! Function result + LOGICAL :: IS_EMPTY + + ! Local variables declared by the preprocessor for tracing purposes + PP_TRACE_DECL_VARS + + ! Trace begin of procedure + PP_TRACE_ENTER_PROCEDURE() + + IS_EMPTY = (THIS%SIZE_.EQ.0) + + ! Trace end of procedure (on success) + PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() + + ! Exit point on success + RETURN + +END FUNCTION CB_IS_EMPTY +#undef PP_PROCEDURE_NAME +#undef PP_PROCEDURE_TYPE + END MODULE CIRCULAR_BUFFER_MOD #undef PP_SECTION_NAME #undef PP_SECTION_TYPE diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_m_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_m_mod.F90 index 9c0cc283..653ea9db 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_m_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_m_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_GG_M_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_M='gg_ml' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_M='gg_ml' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_M='multio-gg-ml-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_GG_M_ENCODER @@ -252,7 +253,8 @@ SUBROUTINE ENCODER_GRIB1_GG_M_INITIALISE( THIS, MODEL_PARAMS, METADATA_KIND, MIO CALL GG_GEOMETRY_PRESET_GRIBX_ATM( MODEL_PARAMS, THIS%SAMPLE_ ) - CALL VERTICAL_LEVELS_PRESET_GRIBX_ATM( MODEL_PARAMS, THIS%SAMPLE_ ) + ! TODO + ! CALL VERTICAL_LEVELS_PRESET_GRIBX_ATM( MODEL_PARAMS, THIS%SAMPLE_ ) ! Trace end of procedure (on success) PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_p_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_p_mod.F90 index c7d63496..1a8ed6eb 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_p_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_p_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_GG_P_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_P='gg_sfc_grib1' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_P='gg_sfc_grib1' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_P='multio-gg-sfc-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_GG_P_ENCODER diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_s_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_s_mod.F90 index 32b8e0d2..b523ec16 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_s_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_s_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_GG_S_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_S='gg_sfc_grib1' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_S='gg_sfc_grib1' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_S='multio-gg-sfc-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_GG_S_ENCODER diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_t_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_t_mod.F90 index 1b655478..fd3b658b 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_t_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_t_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_GG_T_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_T='gg_sfc_grib1' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_T='gg_sfc_grib1' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_T='multio-gg-sfc-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_GG_T_ENCODER diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_v_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_v_mod.F90 index c746f9a9..a509e3e7 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_v_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_v_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_GG_V_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_V='gg_sfc_grib1' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_V='gg_sfc_grib1' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_V='multio-gg-sfc-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_GG_V_ENCODER diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_wi_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_wi_mod.F90 index d17344ea..71643755 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_wi_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_wi_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_GG_WI_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_WI='gg_sfc_grib1' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_WI='gg_sfc_grib1' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_WI='multio-gg-sfc-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_GG_WI_ENCODER diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_ws_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_ws_mod.F90 index 170ee9b1..068ad85c 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_gg_ws_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_gg_ws_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_GG_WS_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_WS='gg_sfc_grib1' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_WS='gg_sfc_grib1' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_GG_WS='multio-gg-sfc-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_GG_WS_ENCODER diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_m_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_m_mod.F90 index 631f8587..f4526002 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_m_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_m_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_SH_M_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_M='sh_ml' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_M='sh_ml' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_M='multio-sh-ml-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_SH_M_ENCODER @@ -252,7 +253,8 @@ SUBROUTINE ENCODER_GRIB1_SH_M_INITIALISE( THIS, MODEL_PARAMS, METADATA_KIND, MIO CALL SH_GEOMETRY_PRESET_GRIBX_ATM( MODEL_PARAMS, THIS%SAMPLE_ ) - CALL VERTICAL_LEVELS_PRESET_GRIBX_ATM( MODEL_PARAMS, THIS%SAMPLE_ ) + ! TODO + ! CALL VERTICAL_LEVELS_PRESET_GRIBX_ATM( MODEL_PARAMS, THIS%SAMPLE_ ) ! Trace end of procedure (on success) PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_p_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_p_mod.F90 index c424b12e..193639f0 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_p_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_p_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_SH_P_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_P='sh_sfc' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_P='sh_sfc' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_P='multio-sh-sfc-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_SH_P_ENCODER diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_s_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_s_mod.F90 index 097aca9f..c014b7d9 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_s_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_s_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_SH_S_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_S='sh_sfc' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_S='sh_sfc' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_S='multio-sh-sfc-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_SH_S_ENCODER diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_t_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_t_mod.F90 index 9a153765..cdbcc286 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_t_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_t_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_SH_T_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_T='sh_sfc' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_T='sh_sfc' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_T='multio-sh-sfc-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_SH_T_ENCODER diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_v_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_v_mod.F90 index 1e76f944..11d3a6dc 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_v_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_v_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_SH_V_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_V='sh_sfc' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_V='sh_sfc' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_V='multio-sh-sfc-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_SH_V_ENCODER diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_wi_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_wi_mod.F90 index 65e94ab4..26287156 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_wi_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_wi_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_SH_WI_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_WI='sh_sfc' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_WI='sh_sfc' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_WI='multio-sh-sfc-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_SH_WI_ENCODER diff --git a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_ws_mod.F90 b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_ws_mod.F90 index 4f02d33d..b7ae4f4e 100644 --- a/src/ecom/encoders/grib1/grib_encoder_grib1_sh_ws_mod.F90 +++ b/src/ecom/encoders/grib1/grib_encoder_grib1_sh_ws_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB1_SH_WS_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_WS='sh_sfc' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_WS='sh_sfc' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB1_SH_WS='multio-sh-sfc-grib1' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB1_SH_WS_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_m_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_m_mod.F90 index 7a88490b..b623aa1b 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_m_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_m_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_GG_M_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_M='gg_ml' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_M='gg_ml' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_M='multio-gg-ml-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_GG_M_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_p_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_p_mod.F90 index 124a1581..e68b7cd0 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_p_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_p_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_GG_P_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_P='gg_sfc_grib2' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_P='gg_sfc_grib2' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_P='multio-gg-sfc-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_GG_P_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_s_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_s_mod.F90 index 45d8d5d6..1954f035 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_s_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_s_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_GG_S_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_S='gg_sfc_grib2' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_S='gg_sfc_grib2' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_S='multio-gg-sfc-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_GG_S_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_t_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_t_mod.F90 index 167d6e5b..4fa49469 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_t_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_t_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_GG_T_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_T='gg_sfc_grib2' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_T='gg_sfc_grib2' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_T='multio-gg-sfc-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_GG_T_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_v_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_v_mod.F90 index 3d40440c..22f781cc 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_v_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_v_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_GG_V_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_V='gg_sfc_grib2' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_V='gg_sfc_grib2' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_V='multio-gg-sfc-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_GG_V_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_wi_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_wi_mod.F90 index a6dded53..fa16daf7 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_wi_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_wi_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_GG_WI_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_WI='gg_sfc_grib2' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_WI='gg_sfc_grib2' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_WI='multio-gg-sfc-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_GG_WI_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_ws_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_ws_mod.F90 index 1c37852c..a32e94f5 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_gg_ws_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_gg_ws_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_GG_WS_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_WS='gg_sfc_grib2' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_WS='gg_sfc_grib2' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_GG_WS='multio-gg-sfc-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_GG_WS_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_m_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_m_mod.F90 index c44977dc..97a8e2ea 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_m_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_m_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_SH_M_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_M='sh_ml' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_M='sh_ml' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_M='multio-sh-ml-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_SH_M_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_p_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_p_mod.F90 index e7812444..fef75d90 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_p_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_p_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_SH_P_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_P='sh_ml' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_P='sh_ml' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_P='multio-sh-sfc-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_SH_P_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_s_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_s_mod.F90 index b8182ac4..f41b9ea0 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_s_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_s_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_SH_S_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_S='sh_ml' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_S='sh_ml' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_S='multio-sh-sfc-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_SH_S_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_t_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_t_mod.F90 index ed547c55..00c6e34b 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_t_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_t_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_SH_T_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_T='sh_ml' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_T='sh_ml' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_T='multio-sh-sfc-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_SH_T_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_v_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_v_mod.F90 index f006692c..c82c2d0b 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_v_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_v_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_SH_V_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_V='sh_ml' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_V='sh_ml' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_V='multio-sh-sfc-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_SH_V_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_wi_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_wi_mod.F90 index cf6bead8..8f90d598 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_wi_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_wi_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_SH_WI_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_WI='gg_sfc_grib2' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_WI='gg_sfc_grib2' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_WI='multio-sh-sfc-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_SH_WI_ENCODER diff --git a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_ws_mod.F90 b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_ws_mod.F90 index 2b30547a..2cfbebf8 100644 --- a/src/ecom/encoders/grib2/grib_encoder_grib2_sh_ws_mod.F90 +++ b/src/ecom/encoders/grib2/grib_encoder_grib2_sh_ws_mod.F90 @@ -39,7 +39,8 @@ MODULE GRIB_ENCODER_GRIB2_SH_WS_MOD END TYPE ! Name of the grib sample to be loaded -CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_WS='gg_sfc_grib2' +! CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_WS='gg_sfc_grib2' +CHARACTER(LEN=*), PARAMETER :: SAMPLE_NAME_GRIB2_SH_WS='multio-sh-sfc-grib2' ! Whitelist of public symbols PUBLIC :: MAKE_GRIB2_SH_WS_ENCODER diff --git a/src/ecom/encoders/grib_encoder_manager_mod.F90 b/src/ecom/encoders/grib_encoder_manager_mod.F90 index 33284ffe..30c1d2c4 100644 --- a/src/ecom/encoders/grib_encoder_manager_mod.F90 +++ b/src/ecom/encoders/grib_encoder_manager_mod.F90 @@ -38,6 +38,9 @@ MODULE GRIB_ENCODER_MANAGER_MOD ! Default visibility PRIVATE +!> @brief Unit used to log fields that do not need to be encoded +INTEGER(KIND=JPIB_K) :: LOG_UNIT = -99 +LOGICAL :: LMESSAGEHIST = .FALSE. !> @brief Container for the Encoders !> @@ -487,7 +490,7 @@ END SUBROUTINE UTILS_FREE !> #define PP_PROCEDURE_TYPE 'SUBROUTINE' #define PP_PROCEDURE_NAME 'MAKE_ENCODERS' -SUBROUTINE MAKE_ENCODERS( CFG, MODEL_PARAMS, METADATA_KIND, MIOH ) +SUBROUTINE MAKE_ENCODERS( CFG, MODEL_PARAMS, METADATA_KIND, VERBOSE, MIOH ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: MODEL_PAR_T @@ -525,6 +528,7 @@ SUBROUTINE MAKE_ENCODERS( CFG, MODEL_PARAMS, METADATA_KIND, MIOH ) TYPE(FCKIT_CONFIGURATION), INTENT(IN) :: CFG TYPE(MODEL_PAR_T), INTENT(IN) :: MODEL_PARAMS CHARACTER(LEN=*), INTENT(IN) :: METADATA_KIND + LOGICAL, INTENT(IN) :: VERBOSE TYPE(MULTIO_HANDLE), OPTIONAL, INTENT(IN) :: MIOH ! Local variables @@ -550,6 +554,14 @@ SUBROUTINE MAKE_ENCODERS( CFG, MODEL_PARAMS, METADATA_KIND, MIOH ) ERRIDX = 0 ERRMSG = '' + ! Logging fields to be encoded + IF ( VERBOSE ) THEN + LMESSAGEHIST=.TRUE. + OPEN(NEWUNIT=LOG_UNIT, FILE='check_valid_message_history.log', STATUS='UNKNOWN', ACTION='WRITE', FORM='FORMATTED') + ELSE + LMESSAGEHIST=.FALSE. + ENDIF + ! Configure the encoder manager CALL SUENCODER_MANAGER( CFG, MODEL_PARAMS ) @@ -900,6 +912,7 @@ SUBROUTINE DESTROY_ENCODERS( ) ! Local variables INTEGER(KIND=JPIB_K) :: I + LOGICAL :: EX ! Local variables declared by the preprocessor for debugging purposes PP_DEBUG_DECL_VARS @@ -910,6 +923,12 @@ SUBROUTINE DESTROY_ENCODERS( ) ! Trace begin of procedure PP_TRACE_ENTER_PROCEDURE() + ! Logging fields to be encoded + INQUIRE(UNIT=LOG_UNIT, OPENED=EX) + IF ( EX ) THEN + CLOSE(UNIT=LOG_UNIT) + ENDIF + ! Destroy all the encoders IF ( ALLOCATED(ENCODERS) ) THEN @@ -1044,15 +1063,15 @@ END SUBROUTINE CONTAINER_CREATE #define PP_PROCEDURE_TYPE 'FUNCTION' #define PP_PROCEDURE_NAME 'ENCODE_ATM' -FUNCTION ENCODE_ATM( MODEL_PARAMS, GRIB_INFO, TIME_HIST, MSG, METADATA ) RESULT(EX) +FUNCTION ENCODE_ATM( MODEL_PARAMS, ENCODING_INFO, MSG, TIME_HIST, METADATA ) RESULT(EX) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: MODEL_PAR_T USE :: OM_CORE_MOD, ONLY: OM_ATM_MSG_T USE :: OM_CORE_MOD, ONLY: CURR_TIME_T - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: TIME_RUNTIME_UTILS_MOD, ONLY: COMPUTE_CURRENT_TIME USE :: METADATA_BASE_MOD, ONLY: METADATA_BASE_A USE :: GRIB_ENCODER_INDEXER_MOD, ONLY: ENCODER_IDX @@ -1068,9 +1087,9 @@ FUNCTION ENCODE_ATM( MODEL_PARAMS, GRIB_INFO, TIME_HIST, MSG, METADATA ) RESULT( ! Dummy arguments TYPE(MODEL_PAR_T), INTENT(IN) :: MODEL_PARAMS - TYPE(GRIB_INFO_T), INTENT(IN) :: GRIB_INFO - TYPE(TIME_HISTORY_T), INTENT(IN) :: TIME_HIST + TYPE(ENCODING_INFO_T), INTENT(INOUT) :: ENCODING_INFO TYPE(OM_ATM_MSG_T), INTENT(IN) :: MSG + TYPE(TIME_HISTORY_T), INTENT(OUT) :: TIME_HIST CLASS(METADATA_BASE_A), POINTER, INTENT(INOUT) :: METADATA ! Function result @@ -1078,7 +1097,9 @@ FUNCTION ENCODE_ATM( MODEL_PARAMS, GRIB_INFO, TIME_HIST, MSG, METADATA ) RESULT( ! Local variables INTEGER(KIND=JPIB_K) :: IDX + INTEGER(KIND=JPIB_K) :: PREVSTEP TYPE(CURR_TIME_T) :: CURR_TIME + LOGICAL :: TMP ! Local variables declared by the preprocessor for debugging purposes PP_DEBUG_DECL_VARS @@ -1093,18 +1114,81 @@ FUNCTION ENCODE_ATM( MODEL_PARAMS, GRIB_INFO, TIME_HIST, MSG, METADATA ) RESULT( ! Error handling PP_DEBUG_CRITICAL_COND_THROW( .NOT.ALLOCATED(ENCODERS), 1 ) - IF ( COMPUTE_CURRENT_TIME( MODEL_PARAMS, GRIB_INFO, TIME_HIST, CURR_TIME ) ) THEN + ! Get the previous emission step for the current message + IF ( ENCODING_INFO%TIME_HISTORY%IS_EMPTY() ) THEN + PREVSTEP = -1; + ELSE + TMP = ENCODING_INFO%TIME_HISTORY%GET( 1, PREVSTEP ) + ENDIF + + IF ( COMPUTE_CURRENT_TIME( MODEL_PARAMS, ENCODING_INFO, MSG%ISTEP_, TIME_HIST, CURR_TIME ) ) THEN ! Get the encoder index - IDX = ENCODER_IDX( GRIB_INFO, MSG ) + IDX = ENCODER_IDX( ENCODING_INFO%GRIB_INFO, MSG ) ! Call the encoder - EX = ENCODERS(IDX)%ENCODE_ATM( MODEL_PARAMS, GRIB_INFO, TIME_HIST, CURR_TIME, MSG, METADATA ) - + EX = ENCODERS(IDX)%ENCODE_ATM( MODEL_PARAMS, ENCODING_INFO%GRIB_INFO, TIME_HIST, CURR_TIME, MSG, METADATA ) + + IF ( LMESSAGEHIST ) THEN + IF ( ENCODING_INFO%TIME_HISTORY%IS_EMPTY() ) THEN + WRITE(LOG_UNIT,'(2L10,9I10)') & +& .TRUE., & +& ENCODING_INFO%GRIB_INFO%IS_STEP0_VALID_, & +& MSG%PARAM_ID_, & +& MSG%IUID_, & +& MSG%IPREF_, & +& PREVSTEP, & +& MSG%ISTEP_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_STATISTICAL_PROCESS_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_TIME_RANGE_, & +& ENCODING_INFO%GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_ + ELSE + WRITE(LOG_UNIT,'(2L10,9I10)') & +& .TRUE., & +& ENCODING_INFO%GRIB_INFO%IS_STEP0_VALID_, & +& MSG%PARAM_ID_, & +& MSG%IUID_, & +& MSG%IPREF_, & +& PREVSTEP, & +& MSG%ISTEP_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_STATISTICAL_PROCESS_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_TIME_RANGE_, & +& ENCODING_INFO%GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_ + ENDIF + ENDIF ELSE + IF ( LMESSAGEHIST ) THEN + IF ( ENCODING_INFO%TIME_HISTORY%IS_EMPTY() ) THEN + WRITE(LOG_UNIT,'(2L10,9I10)') & +& .FALSE., & +& ENCODING_INFO%GRIB_INFO%IS_STEP0_VALID_, & +& MSG%PARAM_ID_, & +& MSG%IUID_, & +& MSG%IPREF_, & +& PREVSTEP, & +& MSG%ISTEP_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_STATISTICAL_PROCESS_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_TIME_RANGE_, & +& ENCODING_INFO%GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_ + ELSE + WRITE(LOG_UNIT,'(2L10,9I10)') & +& .FALSE., & +& ENCODING_INFO%GRIB_INFO%IS_STEP0_VALID_, & +& MSG%PARAM_ID_, & +& MSG%IUID_, & +& MSG%IPREF_, & +& PREVSTEP, & +& MSG%ISTEP_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_STATISTICAL_PROCESS_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_TIME_RANGE_, & +& ENCODING_INFO%GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_ + ENDIF + ENDIF EX = .FALSE. ENDIF + CALL FLUSH(LOG_UNIT) + ! Trace end of procedure (on success) PP_METADATA_EXIT_PROCEDURE( METADATA ) PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() @@ -1146,15 +1230,15 @@ END FUNCTION ENCODE_ATM #define PP_PROCEDURE_TYPE 'FUNCTION' #define PP_PROCEDURE_NAME 'ENCODE_WAM' -FUNCTION ENCODE_WAM( MODEL_PARAMS, GRIB_INFO, TIME_HIST, MSG, METADATA ) RESULT(EX) +FUNCTION ENCODE_WAM( MODEL_PARAMS, ENCODING_INFO, MSG, TIME_HIST, METADATA ) RESULT(EX) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: MODEL_PAR_T USE :: OM_CORE_MOD, ONLY: OM_WAM_MSG_T USE :: OM_CORE_MOD, ONLY: CURR_TIME_T - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: TIME_RUNTIME_UTILS_MOD, ONLY: COMPUTE_CURRENT_TIME USE :: METADATA_BASE_MOD, ONLY: METADATA_BASE_A USE :: GRIB_ENCODER_INDEXER_MOD, ONLY: ENCODER_IDX @@ -1170,9 +1254,9 @@ FUNCTION ENCODE_WAM( MODEL_PARAMS, GRIB_INFO, TIME_HIST, MSG, METADATA ) RESULT( ! Dummy arguments TYPE(MODEL_PAR_T), INTENT(IN) :: MODEL_PARAMS - TYPE(GRIB_INFO_T), INTENT(IN) :: GRIB_INFO - TYPE(TIME_HISTORY_T), INTENT(IN) :: TIME_HIST + TYPE(ENCODING_INFO_T), INTENT(INOUT) :: ENCODING_INFO TYPE(OM_WAM_MSG_T), INTENT(IN) :: MSG + TYPE(TIME_HISTORY_T), INTENT(OUT) :: TIME_HIST CLASS(METADATA_BASE_A), POINTER, INTENT(INOUT) :: METADATA ! Function result @@ -1180,7 +1264,9 @@ FUNCTION ENCODE_WAM( MODEL_PARAMS, GRIB_INFO, TIME_HIST, MSG, METADATA ) RESULT( ! Local variables INTEGER(KIND=JPIB_K) :: IDX + INTEGER(KIND=JPIB_K) :: PREVSTEP TYPE(CURR_TIME_T) :: CURR_TIME + LOGICAL :: TMP ! Local variables declared by the preprocessor for debugging purposes PP_DEBUG_DECL_VARS @@ -1195,18 +1281,83 @@ FUNCTION ENCODE_WAM( MODEL_PARAMS, GRIB_INFO, TIME_HIST, MSG, METADATA ) RESULT( ! Error handling PP_DEBUG_CRITICAL_COND_THROW( .NOT.ALLOCATED(ENCODERS), 1 ) - IF ( COMPUTE_CURRENT_TIME( MODEL_PARAMS, GRIB_INFO, TIME_HIST, CURR_TIME ) ) THEN + ! Get the previous emission step for the current message + IF ( ENCODING_INFO%TIME_HISTORY%IS_EMPTY() ) THEN + PREVSTEP = -1; + ELSE + TMP = ENCODING_INFO%TIME_HISTORY%GET( 1, PREVSTEP ) + ENDIF + + + IF ( COMPUTE_CURRENT_TIME( MODEL_PARAMS, ENCODING_INFO, MSG%ISTEP_, TIME_HIST, CURR_TIME ) ) THEN ! Get the encoder index - IDX = ENCODER_IDX( GRIB_INFO, MSG ) + IDX = ENCODER_IDX( ENCODING_INFO%GRIB_INFO, MSG ) ! Call the encoder - EX = ENCODERS(IDX)%ENCODE_WAM( MODEL_PARAMS, GRIB_INFO, TIME_HIST, CURR_TIME, MSG, METADATA ) - + EX = ENCODERS(IDX)%ENCODE_WAM( MODEL_PARAMS, ENCODING_INFO%GRIB_INFO, TIME_HIST, CURR_TIME, MSG, METADATA ) + + IF ( LMESSAGEHIST ) THEN + IF ( ENCODING_INFO%TIME_HISTORY%IS_EMPTY() ) THEN + WRITE(LOG_UNIT,'(2L10,9I10)') & +& .TRUE., & +& ENCODING_INFO%GRIB_INFO%IS_STEP0_VALID_, & +& MSG%PARAM_ID_, & +& MSG%IUID_, & +& MSG%IPREF_, & +& PREVSTEP, & +& MSG%ISTEP_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_STATISTICAL_PROCESS_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_TIME_RANGE_, & +& ENCODING_INFO%GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_ + ELSE + WRITE(LOG_UNIT,'(2L10,9I10)') & +& .TRUE., & +& ENCODING_INFO%GRIB_INFO%IS_STEP0_VALID_, & +& MSG%PARAM_ID_, & +& MSG%IUID_, & +& MSG%IPREF_, & +& PREVSTEP, & +& MSG%ISTEP_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_STATISTICAL_PROCESS_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_TIME_RANGE_, & +& ENCODING_INFO%GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_ + ENDIF + ENDIF ELSE + IF ( LMESSAGEHIST ) THEN + IF ( ENCODING_INFO%TIME_HISTORY%IS_EMPTY() ) THEN + WRITE(LOG_UNIT,'(2L10,9I10)') & +& .FALSE., & +& ENCODING_INFO%GRIB_INFO%IS_STEP0_VALID_, & +& MSG%PARAM_ID_, & +& MSG%IUID_, & +& MSG%IPREF_, & +& PREVSTEP, & +& MSG%ISTEP_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_STATISTICAL_PROCESS_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_TIME_RANGE_, & +& ENCODING_INFO%GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_ + ELSE + WRITE(LOG_UNIT,'(2L10,9I10)') & +& .FALSE., & +& ENCODING_INFO%GRIB_INFO%IS_STEP0_VALID_, & +& MSG%PARAM_ID_, & +& MSG%IUID_, & +& MSG%IPREF_, & +& PREVSTEP, & +& MSG%ISTEP_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_STATISTICAL_PROCESS_, & +& ENCODING_INFO%GRIB_INFO%TYPE_OF_TIME_RANGE_, & +& ENCODING_INFO%GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_ + ENDIF + ENDIF + ! TODO: Log encoded and not encoded fields EX = .FALSE. ENDIF + CALL FLUSH(LOG_UNIT) + ! Trace end of procedure (on success) PP_METADATA_EXIT_PROCEDURE( METADATA ) PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() diff --git a/src/ecom/encoders/utils/runtime/time_runtime_utils_mod.F90 b/src/ecom/encoders/utils/runtime/time_runtime_utils_mod.F90 index 4ff85862..07191a93 100644 --- a/src/ecom/encoders/utils/runtime/time_runtime_utils_mod.F90 +++ b/src/ecom/encoders/utils/runtime/time_runtime_utils_mod.F90 @@ -199,16 +199,17 @@ END SUBROUTINE COMPUTE_REFERENCE_TIME #define PP_PROCEDURE_TYPE 'SUBROUTINE' #define PP_PROCEDURE_NAME 'COMPUTE_CURRENT_TIME' -FUNCTION COMPUTE_CURRENT_TIME( MODEL_PARAMS, GRIB_INFO, TIME_HIST, CURR_TIME ) RESULT(EX) +FUNCTION COMPUTE_CURRENT_TIME( MODEL_PARAMS, ENCODING_INFO, ISTEP, TIME_HIST, CURR_TIME ) RESULT(EX) ! Symbols imported from other modules within the project. - USE :: OM_CORE_MOD, ONLY: JPIB_K - USE :: OM_CORE_MOD, ONLY: JPRD_K - USE :: OM_CORE_MOD, ONLY: MODEL_PAR_T - USE :: OM_CORE_MOD, ONLY: OM_BASE_MSG_A - USE :: OM_CORE_MOD, ONLY: CURR_TIME_T - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T - USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T + USE :: OM_CORE_MOD, ONLY: JPIB_K + USE :: OM_CORE_MOD, ONLY: JPRD_K + USE :: OM_CORE_MOD, ONLY: MODEL_PAR_T + USE :: OM_CORE_MOD, ONLY: OM_BASE_MSG_A + USE :: OM_CORE_MOD, ONLY: CURR_TIME_T + USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T + USE :: OM_CORE_MOD, ONLY: UNDEF_PARAM_E + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T ! Symbols imported by the preprocessor for debugging purposes PP_DEBUG_USE_VARS @@ -219,16 +220,16 @@ FUNCTION COMPUTE_CURRENT_TIME( MODEL_PARAMS, GRIB_INFO, TIME_HIST, CURR_TIME ) R IMPLICIT NONE ! Dummy arguments - TYPE(MODEL_PAR_T), INTENT(IN) :: MODEL_PARAMS - TYPE(GRIB_INFO_T), INTENT(IN) :: GRIB_INFO - TYPE(TIME_HISTORY_T), INTENT(IN) :: TIME_HIST - TYPE(CURR_TIME_T), INTENT(OUT) :: CURR_TIME + TYPE(MODEL_PAR_T), INTENT(IN) :: MODEL_PARAMS + TYPE(ENCODING_INFO_T), INTENT(INOUT) :: ENCODING_INFO + INTEGER(KIND=JPIB_K), INTENT(IN) :: ISTEP + TYPE(TIME_HISTORY_T), INTENT(OUT) :: TIME_HIST + TYPE(CURR_TIME_T), INTENT(OUT) :: CURR_TIME ! Function result LOGICAL :: EX ! Local variables - INTEGER(KIND=JPIB_K) :: ISTEP INTEGER(KIND=JPIB_K) :: DATADATE INTEGER(KIND=JPIB_K) :: DATATIME INTEGER(KIND=JPIB_K) :: DYYYY @@ -237,6 +238,8 @@ FUNCTION COMPUTE_CURRENT_TIME( MODEL_PARAMS, GRIB_INFO, TIME_HIST, CURR_TIME ) R INTEGER(KIND=JPIB_K) :: THH INTEGER(KIND=JPIB_K) :: TMM INTEGER(KIND=JPIB_K) :: TSS + LOGICAL :: UPDATE_TIME_HISTORY + LOGICAL :: TMP ! Local variables declared by the preprocessor for debugging purposes PP_DEBUG_DECL_VARS @@ -265,31 +268,26 @@ FUNCTION COMPUTE_CURRENT_TIME( MODEL_PARAMS, GRIB_INFO, TIME_HIST, CURR_TIME ) R & CURR_TIME%SIM_REF_TIME(6) ) - - ! Get current step - ISTEP = TIME_HIST%HIST_(TIME_HIST%SIZE_) - - ! Compute Current time - ! This must be moved somewhere else since it is shared between - ! grib1 and grib2 - ! IF( MODEL_PARAMS%SIM_%LPPSTEPS ) THEN - ! CURR_TIME%TSTEP = 3600._JPRD_K - ! CURR_TIME%ISEC = INT( REAL(ISTEP,JPRD_K)*CURR_TIME%TSTEP, JPIB_K) - ! ELSE CURR_TIME%TSTEP = MODEL_PARAMS%SIM_%TSTEP CURR_TIME%ISEC = INT( REAL(ISTEP,JPRD_K)*CURR_TIME%TSTEP, JPIB_K) - ! ENDIF - ! IF( TRIM(MODEL_PARAMS%SIM_%CTYPE) .EQ. 'fc' ) THEN CURR_TIME%ISEC = CURR_TIME%ISEC + MODEL_PARAMS%SIM_%NSTEPINI*3600 - ! ENDIF + ! This was supposed to be different from 0 only for the VAREPS case ! which is not supported anymore CURR_TIME%ISEC0=0 ! Cehck if the field needs to be encoded - EX = TO_BE_ENCODED( GRIB_INFO, TIME_HIST, CURR_TIME ) + EX = TO_BE_ENCODED( ENCODING_INFO, ISTEP, CURR_TIME, UPDATE_TIME_HISTORY ) + + IF ( UPDATE_TIME_HISTORY ) THEN + CALL ENCODING_INFO%TIME_HISTORY%ENQUEUE( ISTEP ) + TMP = ENCODING_INFO%TIME_HISTORY%GET_ALL( TIME_HIST%SIZE_, TIME_HIST%HIST_(1:) ) + ELSE + TIME_HIST%SIZE_ = UNDEF_PARAM_E + TIME_HIST%HIST_ = UNDEF_PARAM_E + ENDIF ! Trace end of procedure (on success) PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() @@ -334,12 +332,13 @@ END FUNCTION COMPUTE_CURRENT_TIME #define PP_PROCEDURE_TYPE 'FUNCTION' #define PP_PROCEDURE_NAME 'TO_BE_ENCODED' -FUNCTION TO_BE_ENCODED( GRIB_INFO, TIME_HIST, CURR_TIME ) RESULT(CHECK) +FUNCTION TO_BE_ENCODED( ENCODING_INFO, ISTEP, CURR_TIME, UPDATE_TIME_HISTORY ) RESULT(CHECK) ! Symbols imported from other modules within the project. - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T - USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T - USE :: OM_CORE_MOD, ONLY: CURR_TIME_T + USE :: OM_CORE_MOD, ONLY: JPIB_K + USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T + USE :: OM_CORE_MOD, ONLY: CURR_TIME_T + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: OM_CORE_MOD, ONLY: TYPE_OF_TIME_RANGE_INSTANT_E USE :: OM_CORE_MOD, ONLY: TYPE_OF_TIME_RANGE_FROM_STEP0_E USE :: OM_CORE_MOD, ONLY: TYPE_OF_TIME_RANGE_FROM_LASTPP_E @@ -355,13 +354,19 @@ FUNCTION TO_BE_ENCODED( GRIB_INFO, TIME_HIST, CURR_TIME ) RESULT(CHECK) ! Dummy arguments - TYPE(GRIB_INFO_T), INTENT(IN) :: GRIB_INFO - TYPE(TIME_HISTORY_T), INTENT(IN) :: TIME_HIST - TYPE(CURR_TIME_T), INTENT(INOUT) :: CURR_TIME + TYPE(ENCODING_INFO_T), INTENT(IN) :: ENCODING_INFO + INTEGER(KIND=JPIB_K), INTENT(IN) :: ISTEP + TYPE(CURR_TIME_T), INTENT(INOUT) :: CURR_TIME + LOGICAL, INTENT(OUT) :: UPDATE_TIME_HISTORY ! Function result LOGICAL :: CHECK + ! Local variables + LOGICAL :: EX + INTEGER(KIND=JPIB_K) :: PREV_SEC + INTEGER(KIND=JPIB_K) :: PREV_STEP + ! Local variables declared by the preprocessor for debugging purposes PP_DEBUG_DECL_VARS @@ -371,42 +376,54 @@ FUNCTION TO_BE_ENCODED( GRIB_INFO, TIME_HIST, CURR_TIME ) RESULT(CHECK) ! Trace begin of procedure PP_TRACE_ENTER_PROCEDURE() - SELECT CASE (GRIB_INFO%TYPE_OF_TIME_RANGE_) - CASE (TYPE_OF_TIME_RANGE_INSTANT_E) - IF ( CURR_TIME%ISEC .EQ. CURR_TIME%ISEC0 ) THEN - CHECK = GRIB_INFO%IS_STEP0_VALID_ - CURR_TIME%IS_STEP_0 = .TRUE. - ELSE - CHECK = .TRUE. - CURR_TIME%IS_STEP_0 = .FALSE. - ENDIF - CASE (TYPE_OF_TIME_RANGE_FROM_STEP0_E) - IF ( CURR_TIME%ISEC .EQ. CURR_TIME%ISEC0 ) THEN - CHECK = GRIB_INFO%IS_STEP0_VALID_ - CURR_TIME%IS_STEP_0 = .TRUE. - ELSE - CHECK = .TRUE. - CURR_TIME%IS_STEP_0 = .FALSE. - ENDIF - CASE (TYPE_OF_TIME_RANGE_FROM_LASTPP_E) - IF ( CURR_TIME%ISEC .EQ. CURR_TIME%ISEC0 ) THEN - CHECK = GRIB_INFO%IS_STEP0_VALID_ - CURR_TIME%IS_STEP_0 = .TRUE. - ELSE - CHECK = .TRUE. - CURR_TIME%IS_STEP_0 = .FALSE. - ENDIF - CASE (TYPE_OF_TIME_RANGE_FIXED_SIZE_E) - IF ( CURR_TIME%ISEC - GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_ .LT. CURR_TIME%ISEC0 ) THEN - CHECK = GRIB_INFO%IS_STEP0_VALID_ - CURR_TIME%IS_STEP_0 = .TRUE. - ELSE + ASSOCIATE ( GRIB_INFO => ENCODING_INFO%GRIB_INFO, TIME_HISTORY => ENCODING_INFO%TIME_HISTORY ) + + IF ( TIME_HISTORY%IS_EMPTY() ) THEN + UPDATE_TIME_HISTORY = .TRUE. + SELECT CASE (GRIB_INFO%TYPE_OF_TIME_RANGE_) + CASE (TYPE_OF_TIME_RANGE_INSTANT_E, TYPE_OF_TIME_RANGE_FROM_STEP0_E, TYPE_OF_TIME_RANGE_FROM_LASTPP_E) + IF ( CURR_TIME%ISEC .EQ. CURR_TIME%ISEC0 ) THEN + CHECK = GRIB_INFO%IS_STEP0_VALID_ + CURR_TIME%IS_STEP_0 = .TRUE. + ELSE + CHECK = .TRUE. + CURR_TIME%IS_STEP_0 = .FALSE. + ENDIF + CASE (TYPE_OF_TIME_RANGE_FIXED_SIZE_E) + IF ( CURR_TIME%ISEC - GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_ .LT. CURR_TIME%ISEC0 ) THEN + CHECK = GRIB_INFO%IS_STEP0_VALID_ + CURR_TIME%IS_STEP_0 = .TRUE. + ELSE + CHECK = .TRUE. + CURR_TIME%IS_STEP_0 = .FALSE. + END IF + CASE DEFAULT + PP_DEBUG_CRITICAL_THROW( 1 ) + END SELECT + ELSE + SELECT CASE (GRIB_INFO%TYPE_OF_TIME_RANGE_) + CASE (TYPE_OF_TIME_RANGE_INSTANT_E,TYPE_OF_TIME_RANGE_FROM_STEP0_E,TYPE_OF_TIME_RANGE_FROM_LASTPP_E) + UPDATE_TIME_HISTORY = .TRUE. CHECK = .TRUE. CURR_TIME%IS_STEP_0 = .FALSE. - END IF - CASE DEFAULT - PP_DEBUG_CRITICAL_THROW( 1 ) - END SELECT + CASE (TYPE_OF_TIME_RANGE_FIXED_SIZE_E) + EX = TIME_HISTORY%GET(1_JPIB_K,PREV_STEP) + PREV_SEC = INT( REAL(PREV_STEP,JPRD_K)*CURR_TIME%TSTEP, JPIB_K) + IF ( CURR_TIME%ISEC - GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_ .LT. PREV_SEC ) THEN + UPDATE_TIME_HISTORY = .FALSE. + CHECK = .FALSE. + CURR_TIME%IS_STEP_0 = .TRUE. + ELSE + UPDATE_TIME_HISTORY = .TRUE. + CHECK = .TRUE. + CURR_TIME%IS_STEP_0 = .FALSE. + END IF + CASE DEFAULT + PP_DEBUG_CRITICAL_THROW( 1 ) + END SELECT + ENDIF + + END ASSOCIATE PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() @@ -426,7 +443,7 @@ FUNCTION TO_BE_ENCODED( GRIB_INFO, TIME_HIST, CURR_TIME ) RESULT(CHECK) SELECT CASE(ERRIDX) CASE (1) TMP=REPEAT(' ',32) - WRITE(TMP,*) GRIB_INFO%TYPE_OF_TIME_RANGE_ + WRITE(TMP,*) ENCODING_INFO%GRIB_INFO%TYPE_OF_TIME_RANGE_ PP_DEBUG_CREATE_ERROR_MSG( STR, 'Unknknown type of timerange: '//TRIM(ADJUSTL(TMP))//')' ) CASE DEFAULT PP_DEBUG_CREATE_ERROR_MSG( STR, 'Unhandled error' ) diff --git a/src/ecom/flavours/gribx2multio_bin_output_manager_mod.F90 b/src/ecom/flavours/gribx2multio_bin_output_manager_mod.F90 index 820ae244..86cc3e9a 100644 --- a/src/ecom/flavours/gribx2multio_bin_output_manager_mod.F90 +++ b/src/ecom/flavours/gribx2multio_bin_output_manager_mod.F90 @@ -127,8 +127,12 @@ SUBROUTINE GRIBX2MULTIO_BIN_READ_CFG_FROM_YAML( THIS, CFG ) ! Symbols imported from other libraries USE :: FCKIT_CONFIGURATION_MODULE, ONLY: FCKIT_CONFIGURATION + USE :: GRIB_API, ONLY: GRIB_SET_SAMPLES_PATH + USE :: GRIB_API, ONLY: GRIB_SUCCESS + USE :: GRIB_API, ONLY: GRIB_GET_ERROR_STRING ! Symbols imported from other modules within the project. + USE :: OM_CORE_MOD, ONLY: JPIM_K USE :: OM_GENERAL_UTILS_MOD, ONLY: OM_REPLACE_ENVVAR_IN_STRING USE :: OM_GENERAL_UTILS_MOD, ONLY: TOLOWER @@ -145,8 +149,10 @@ SUBROUTINE GRIBX2MULTIO_BIN_READ_CFG_FROM_YAML( THIS, CFG ) TYPE(FCKIT_CONFIGURATION), INTENT(IN) :: CFG ! Local variables + INTEGER(KIND=JPIM_K) :: KRET TYPE(FCKIT_CONFIGURATION) :: GRIBX2MULTIO_BIN_CFG CHARACTER(LEN=:), ALLOCATABLE :: CLTMP + CHARACTER(LEN=1024) :: CTMP_PATH LOGICAL :: LTMP LOGICAL :: EX @@ -175,6 +181,19 @@ SUBROUTINE GRIBX2MULTIO_BIN_READ_CFG_FROM_YAML( THIS, CFG ) PP_DEBUG_CRITICAL_THROW( 4 ) ENDIF + IF ( ALLOCATED(CLTMP) ) DEALLOCATE(CLTMP) + IF ( GRIBX2MULTIO_BIN_CFG%GET( 'samples-path', CLTMP ) ) THEN + PP_DEBUG_CRITICAL_COND_THROW( .NOT.ALLOCATED(CLTMP), 1 ) + PP_DEBUG_CRITICAL_COND_THROW( LEN(CLTMP).GT.LEN(CTMP_PATH), 2 ) + CTMP_PATH=REPEAT( ' ', LEN(CTMP_PATH) ) + CALL OM_REPLACE_ENVVAR_IN_STRING( CLTMP, CTMP_PATH ) + IF ( ALLOCATED(CLTMP) ) DEALLOCATE( CLTMP ) + CALL GRIB_SET_SAMPLES_PATH( TRIM(CTMP_PATH), STATUS=KRET ) + PP_DEBUG_CRITICAL_COND_THROW( KRET.NE.GRIB_SUCCESS, 5 ) + ELSE + PP_DEBUG_CRITICAL_THROW( 6 ) + ENDIF + ! Read the verbose flag from YAML file IF ( GRIBX2MULTIO_BIN_CFG%GET( 'verbose', LTMP ) ) THEN THIS%VERBOSE_ = LTMP @@ -199,7 +218,7 @@ SUBROUTINE GRIBX2MULTIO_BIN_READ_CFG_FROM_YAML( THIS, CFG ) ! Deallocate memory for sub-configuration CALL GRIBX2MULTIO_BIN_CFG%FINAL() ELSE - PP_DEBUG_CRITICAL_THROW( 5 ) + PP_DEBUG_CRITICAL_THROW( 7 ) ENDIF ! Trace end of procedure (on success) @@ -216,6 +235,7 @@ SUBROUTINE GRIBX2MULTIO_BIN_READ_CFG_FROM_YAML( THIS, CFG ) ! Error handling variables CHARACTER(LEN=:), ALLOCATABLE :: STR + CHARACTER(LEN=4096) :: GRIB_ERROR ! HAndle different errors SELECT CASE(ERRIDX) @@ -228,6 +248,12 @@ SUBROUTINE GRIBX2MULTIO_BIN_READ_CFG_FROM_YAML( THIS, CFG ) CASE (4) PP_DEBUG_CREATE_ERROR_MSG( STR, '"multio-plans-file" key expected in YAML' ) CASE (5) + GRIB_ERROR = REPEAT(' ', 4096) + CALL GRIB_GET_ERROR_STRING( KRET, GRIB_ERROR ) + PP_DEBUG_CREATE_ERROR_MSG_GRIB( STR, 'Unable to set samples path', KRET, GRIB_ERROR ) + CASE (6) + PP_DEBUG_CREATE_ERROR_MSG( STR, 'Unable to read "samples-path"' ) + CASE (7) PP_DEBUG_CREATE_ERROR_MSG( STR, '"gribx2multio-binary-output-manager" key expected in YAML' ) CASE DEFAULT PP_DEBUG_CREATE_ERROR_MSG( STR, 'Unhandled error' ) @@ -346,7 +372,7 @@ SUBROUTINE GRIBX2MULTIO_BIN_SETUP( THIS, YAMLFNAME, PROCESSOR_TOPO, MODEL_PARAMS CALL SUENCODING_INFO( CFG, PROCESSOR_TOPO, MODEL_PARAMS, THIS%VERBOSE_ ) ! Initialise all the encoders - CALL MAKE_ENCODERS( CFG, MODEL_PARAMS, 'GRIB' ) + CALL MAKE_ENCODERS( CFG, MODEL_PARAMS, 'GRIB', THIS%VERBOSE_ ) ! Destroy the fckit configuration object CALL CFG%FINAL() @@ -431,11 +457,11 @@ SUBROUTINE GRIBX2MULTIO_BIN_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRD_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_ATM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_ATM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -467,7 +493,7 @@ SUBROUTINE GRIBX2MULTIO_BIN_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) INTEGER(KIND=JPIB_K) :: KRET INTEGER(KIND=JPIB_K) :: STAT TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PGMD CHARACTER(LEN=:), ALLOCATABLE :: ERRMSG @@ -494,26 +520,25 @@ SUBROUTINE GRIBX2MULTIO_BIN_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) ! Configure the debug manager CALL OM_SET_CURRENT_MESSAGE_ATM( YDMSG, MSG_PRINT_ATM ) - ! Associate the pointers to the metadata - PGMD => THIS%GMD_ - PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) - CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PGMD => THIS%GMD_ + PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_ATM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PGMD ) ) THEN + IF ( ENCODE_ATM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PGMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) + CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF ! Set values into the grib handle CALL THIS%GMD_%SET( 'values', VALUES_DP(1:YDMSG%NVALUES_) ) @@ -590,11 +615,11 @@ SUBROUTINE GRIBX2MULTIO_BIN_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRM_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_ATM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_ATM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -626,7 +651,7 @@ SUBROUTINE GRIBX2MULTIO_BIN_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) INTEGER(KIND=JPIB_K) :: KRET INTEGER(KIND=JPIB_K) :: STAT TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PGMD CHARACTER(LEN=:), ALLOCATABLE :: ERRMSG @@ -653,27 +678,26 @@ SUBROUTINE GRIBX2MULTIO_BIN_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_SP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PGMD => THIS%GMD_ - PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING SINGLE PRECISION VALUES' ) - CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PGMD => THIS%GMD_ + PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_ATM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PGMD ) ) THEN + IF ( ENCODE_ATM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PGMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING SINGLE PRECISION VALUES' ) + CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF ! Set values into the grib handle CALL THIS%GMD_%SET( 'values', VALUES_SP(1:YDMSG%NVALUES_) ) @@ -751,11 +775,11 @@ SUBROUTINE GRIBX2MULTIO_BIN_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRD_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_WAM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_WAM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -787,7 +811,7 @@ SUBROUTINE GRIBX2MULTIO_BIN_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) INTEGER(KIND=JPIB_K) :: KRET INTEGER(KIND=JPIB_K) :: STAT TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PGMD CHARACTER(LEN=:), ALLOCATABLE :: ERRMSG @@ -814,27 +838,26 @@ SUBROUTINE GRIBX2MULTIO_BIN_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_DP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PGMD => THIS%GMD_ - PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE WAVE MESSAGE USING DOUBLE PRECISION VALUES' ) - CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PGMD => THIS%GMD_ + PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_WAM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PGMD ) ) THEN + IF ( ENCODE_WAM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PGMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE WAVE MESSAGE USING DOUBLE PRECISION VALUES' ) + CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF ! Set values into the grib handle CALL THIS%GMD_%SET( 'values', VALUES_DP(1:YDMSG%NVALUES_) ) @@ -914,11 +937,11 @@ SUBROUTINE GRIBX2MULTIO_BIN_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRM_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_WAM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_WAM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -950,7 +973,7 @@ SUBROUTINE GRIBX2MULTIO_BIN_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) INTEGER(KIND=JPIB_K) :: KRET INTEGER(KIND=JPIB_K) :: STAT TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PGMD CHARACTER(LEN=:), ALLOCATABLE :: ERRMSG @@ -977,27 +1000,26 @@ SUBROUTINE GRIBX2MULTIO_BIN_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_SP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PGMD => THIS%GMD_ - PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE WAVE MESSAGE USING SINGLE PRECISION VALUES' ) - CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PGMD => THIS%GMD_ + PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_WAM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PGMD ) ) THEN + IF ( ENCODE_WAM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PGMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE WAVE MESSAGE USING SINGLE PRECISION VALUES' ) + CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF ! Set values into the grib handle CALL THIS%GMD_%SET( 'values', VALUES_SP(1:YDMSG%NVALUES_) ) diff --git a/src/ecom/flavours/gribx2multio_raw_output_manager_mod.F90 b/src/ecom/flavours/gribx2multio_raw_output_manager_mod.F90 index e8147831..f8caae45 100644 --- a/src/ecom/flavours/gribx2multio_raw_output_manager_mod.F90 +++ b/src/ecom/flavours/gribx2multio_raw_output_manager_mod.F90 @@ -131,8 +131,12 @@ SUBROUTINE GRIBX2MULTIO_RAW_READ_CFG_FROM_YAML( THIS, CFG ) ! Symbols imported from other libraries USE :: FCKIT_CONFIGURATION_MODULE, ONLY: FCKIT_CONFIGURATION + USE :: GRIB_API, ONLY: GRIB_SET_SAMPLES_PATH + USE :: GRIB_API, ONLY: GRIB_SUCCESS + USE :: GRIB_API, ONLY: GRIB_GET_ERROR_STRING ! Symbols imported from other modules within the project. + USE :: OM_CORE_MOD, ONLY: JPIM_K USE :: OM_GENERAL_UTILS_MOD, ONLY: OM_REPLACE_ENVVAR_IN_STRING USE :: OM_GENERAL_UTILS_MOD, ONLY: TOLOWER @@ -149,8 +153,10 @@ SUBROUTINE GRIBX2MULTIO_RAW_READ_CFG_FROM_YAML( THIS, CFG ) TYPE(FCKIT_CONFIGURATION), INTENT(IN) :: CFG ! Local variables + INTEGER(KIND=JPIM_K) :: KRET TYPE(FCKIT_CONFIGURATION) :: GRIBX2MULTIO_RAW_CFG CHARACTER(LEN=:), ALLOCATABLE :: CLTMP + CHARACTER(LEN=1024) :: CTMP_PATH LOGICAL :: LTMP LOGICAL :: EX @@ -179,6 +185,19 @@ SUBROUTINE GRIBX2MULTIO_RAW_READ_CFG_FROM_YAML( THIS, CFG ) PP_DEBUG_CRITICAL_THROW( 4 ) ENDIF + IF ( ALLOCATED(CLTMP) ) DEALLOCATE(CLTMP) + IF ( GRIBX2MULTIO_RAW_CFG%GET( 'samples-path', CLTMP ) ) THEN + PP_DEBUG_CRITICAL_COND_THROW( .NOT.ALLOCATED(CLTMP), 1 ) + PP_DEBUG_CRITICAL_COND_THROW( LEN(CLTMP).GT.LEN(CTMP_PATH), 2 ) + CTMP_PATH=REPEAT( ' ', LEN(CTMP_PATH) ) + CALL OM_REPLACE_ENVVAR_IN_STRING( CLTMP, CTMP_PATH ) + IF ( ALLOCATED(CLTMP) ) DEALLOCATE( CLTMP ) + CALL GRIB_SET_SAMPLES_PATH( TRIM(CTMP_PATH), STATUS=KRET ) + PP_DEBUG_CRITICAL_COND_THROW( KRET.NE.GRIB_SUCCESS, 5 ) + ELSE + PP_DEBUG_CRITICAL_THROW( 6 ) + ENDIF + ! Read the verbose flag from YAML file IF ( GRIBX2MULTIO_RAW_CFG%GET( 'verbose', LTMP ) ) THEN THIS%VERBOSE_ = LTMP @@ -203,7 +222,7 @@ SUBROUTINE GRIBX2MULTIO_RAW_READ_CFG_FROM_YAML( THIS, CFG ) ! Deallocate memory for sub-configuration CALL GRIBX2MULTIO_RAW_CFG%FINAL() ELSE - PP_DEBUG_CRITICAL_THROW( 5 ) + PP_DEBUG_CRITICAL_THROW( 7 ) ENDIF ! Trace end of procedure (on success) @@ -220,6 +239,7 @@ SUBROUTINE GRIBX2MULTIO_RAW_READ_CFG_FROM_YAML( THIS, CFG ) ! Error handling variables CHARACTER(LEN=:), ALLOCATABLE :: STR + CHARACTER(LEN=4096) :: GRIB_ERROR ! HAndle different errors SELECT CASE(ERRIDX) @@ -232,6 +252,12 @@ SUBROUTINE GRIBX2MULTIO_RAW_READ_CFG_FROM_YAML( THIS, CFG ) CASE (4) PP_DEBUG_CREATE_ERROR_MSG( STR, '"multio-plans-file" key expected in YAML' ) CASE (5) + GRIB_ERROR = REPEAT(' ', 4096) + CALL GRIB_GET_ERROR_STRING( KRET, GRIB_ERROR ) + PP_DEBUG_CREATE_ERROR_MSG_GRIB( STR, 'Unable to set samples path', KRET, GRIB_ERROR ) + CASE (6) + PP_DEBUG_CREATE_ERROR_MSG( STR, 'Unable to read "samples-path"' ) + CASE (7) PP_DEBUG_CREATE_ERROR_MSG( STR, '"gribx2multio-binary-output-manager" key expected in YAML' ) CASE DEFAULT PP_DEBUG_CREATE_ERROR_MSG( STR, 'Unhandled error' ) @@ -352,7 +378,7 @@ SUBROUTINE GRIBX2MULTIO_RAW_SETUP( THIS, YAMLFNAME, PROCESSOR_TOPO, MODEL_PARAMS CALL SUENCODING_INFO( CFG, PROCESSOR_TOPO, MODEL_PARAMS, THIS%VERBOSE_ ) ! Initialise all the encoders - CALL MAKE_ENCODERS( CFG, MODEL_PARAMS, 'GRIB' ) + CALL MAKE_ENCODERS( CFG, MODEL_PARAMS, 'GRIB', THIS%VERBOSE_ ) ! Destroy the fckit configuration object CALL CFG%FINAL() @@ -440,11 +466,11 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRD_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_ATM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_ATM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -478,7 +504,7 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) ! Local variables TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PGMD TYPE(MULTIO_METADATA), POINTER :: MMD @@ -505,29 +531,28 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_DP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PGMD => THIS%GMD_ - PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) - CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PGMD => THIS%GMD_ + PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_ATM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PGMD ) ) THEN + IF ( ENCODE_ATM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PGMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) + CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF - IF ( GRIB_INFO%DIRECT_TO_FDB ) THEN + IF ( ENCODING_INFO%GRIB_INFO%DIRECT_TO_FDB ) THEN ! Set values into the grib handle CALL THIS%GMD_%SET( 'values', VALUES_DP(1:YDMSG%NVALUES_) ) @@ -558,14 +583,14 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) ! Destroy the metadata objects IF ( THIS%GMD_%INITIALIZED() ) THEN - IF ( THIS%SAVE_REPORT_ .AND. GRIB_INFO%DIRECT_TO_FDB ) THEN + IF ( THIS%SAVE_REPORT_ .AND. ENCODING_INFO%GRIB_INFO%DIRECT_TO_FDB ) THEN PP_METADATA_FINALISE_LOGGING( PGMD ) ENDIF CALL THIS%GMD_%DESTROY() ENDIF IF ( THIS%MMD_%INITIALIZED() ) THEN - IF ( THIS%SAVE_REPORT_ .AND. .NOT.GRIB_INFO%DIRECT_TO_FDB ) THEN + IF ( THIS%SAVE_REPORT_ .AND. .NOT.ENCODING_INFO%GRIB_INFO%DIRECT_TO_FDB ) THEN PP_METADATA_FINALISE_LOGGING( THIS%MMD_ ) ENDIF CALL THIS%MMD_%DESTROY() @@ -626,11 +651,11 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRM_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_ATM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_ATM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -664,7 +689,7 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) ! Local variables TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PGMD TYPE(MULTIO_METADATA), POINTER :: MMD @@ -692,29 +717,27 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_SP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PGMD => THIS%GMD_ - PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) - - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) - CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) + ! Associate the pointers to the metadata + PGMD => THIS%GMD_ + PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_ATM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PGMD ) ) THEN + IF ( ENCODE_ATM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PGMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) + CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF - IF ( GRIB_INFO%DIRECT_TO_FDB ) THEN + IF ( ENCODING_INFO%GRIB_INFO%DIRECT_TO_FDB ) THEN ! Set values into the grib handle CALL THIS%GMD_%SET( 'values', VALUES_SP(1:YDMSG%NVALUES_) ) @@ -743,13 +766,16 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) ! Destroy the metadata objects IF ( THIS%GMD_%INITIALIZED() ) THEN - IF ( THIS%SAVE_REPORT_ ) THEN + IF ( THIS%SAVE_REPORT_ .AND. ENCODING_INFO%GRIB_INFO%DIRECT_TO_FDB ) THEN PP_METADATA_FINALISE_LOGGING( PGMD ) ENDIF CALL THIS%GMD_%DESTROY() ENDIF IF ( THIS%MMD_%INITIALIZED() ) THEN + IF ( THIS%SAVE_REPORT_ .AND. .NOT.ENCODING_INFO%GRIB_INFO%DIRECT_TO_FDB ) THEN + PP_METADATA_FINALISE_LOGGING( THIS%MMD_ ) + ENDIF CALL THIS%MMD_%DESTROY() ENDIF @@ -808,11 +834,11 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRD_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_WAM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_WAM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -847,7 +873,7 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) ! Local variables TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PGMD TYPE(MULTIO_METADATA), POINTER :: MMD @@ -874,31 +900,29 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_DP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PGMD => THIS%GMD_ - PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) - CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PGMD => THIS%GMD_ + PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_WAM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PGMD ) ) THEN + IF ( ENCODE_WAM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PGMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) + CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF - IF ( GRIB_INFO%DIRECT_TO_FDB ) THEN + IF ( ENCODING_INFO%GRIB_INFO%DIRECT_TO_FDB ) THEN ! Set values into the grib handle CALL THIS%GMD_%SET( 'values', VALUES_DP(1:YDMSG%NVALUES_) ) @@ -927,13 +951,16 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) ! Destroy the metadata objects IF ( THIS%GMD_%INITIALIZED() ) THEN - IF ( THIS%SAVE_REPORT_ ) THEN + IF ( THIS%SAVE_REPORT_ .AND. ENCODING_INFO%GRIB_INFO%DIRECT_TO_FDB ) THEN PP_METADATA_FINALISE_LOGGING( PGMD ) ENDIF CALL THIS%GMD_%DESTROY() ENDIF IF ( THIS%MMD_%INITIALIZED() ) THEN + IF ( THIS%SAVE_REPORT_ .AND. .NOT.ENCODING_INFO%GRIB_INFO%DIRECT_TO_FDB ) THEN + PP_METADATA_FINALISE_LOGGING( THIS%MMD_ ) + ENDIF CALL THIS%MMD_%DESTROY() ENDIF @@ -992,11 +1019,11 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRM_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_WAM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_WAM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -1030,7 +1057,7 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) ! Local variables TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PGMD TYPE(MULTIO_METADATA), POINTER :: MMD @@ -1057,29 +1084,28 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_SP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PGMD => THIS%GMD_ - PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) - CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PGMD => THIS%GMD_ + PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_WAM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PGMD ) ) THEN + IF ( ENCODE_WAM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PGMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) + CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF - IF ( GRIB_INFO%DIRECT_TO_FDB ) THEN + IF ( ENCODING_INFO%GRIB_INFO%DIRECT_TO_FDB ) THEN ! Set values into the grib handle CALL THIS%GMD_%SET( 'values', VALUES_SP(1:YDMSG%NVALUES_) ) @@ -1108,13 +1134,16 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) ! Destroy the metadata objects IF ( THIS%GMD_%INITIALIZED() ) THEN - IF ( THIS%SAVE_REPORT_ ) THEN + IF ( THIS%SAVE_REPORT_ .AND. ENCODING_INFO%GRIB_INFO%DIRECT_TO_FDB ) THEN PP_METADATA_FINALISE_LOGGING( PGMD ) ENDIF CALL THIS%GMD_%DESTROY() ENDIF IF ( THIS%MMD_%INITIALIZED() ) THEN + IF ( THIS%SAVE_REPORT_ .AND. .NOT.ENCODING_INFO%GRIB_INFO%DIRECT_TO_FDB ) THEN + PP_METADATA_FINALISE_LOGGING( THIS%MMD_ ) + ENDIF CALL THIS%MMD_%DESTROY() ENDIF diff --git a/src/ecom/flavours/gribx_binary_output_manager_mod.F90 b/src/ecom/flavours/gribx_binary_output_manager_mod.F90 index 5081ce70..8a027883 100644 --- a/src/ecom/flavours/gribx_binary_output_manager_mod.F90 +++ b/src/ecom/flavours/gribx_binary_output_manager_mod.F90 @@ -136,8 +136,13 @@ SUBROUTINE GRIBX_BINARY_READ_CFG_FROM_YAML( THIS, CFG ) ! Symbols imported from other libraries USE :: FCKIT_CONFIGURATION_MODULE, ONLY: FCKIT_CONFIGURATION + USE :: GRIB_API, ONLY: GRIB_SET_SAMPLES_PATH + USE :: GRIB_API, ONLY: GRIB_SUCCESS + USE :: GRIB_API, ONLY: GRIB_GET_ERROR_STRING ! Symbols imported from other modules within the project. + USE :: OM_CORE_MOD, ONLY: JPIM_K + USE :: OM_GENERAL_UTILS_MOD, ONLY: OM_REPLACE_ENVVAR_IN_STRING USE :: OM_GENERAL_UTILS_MOD, ONLY: TOLOWER ! Symbols imported by the preprocessor for debugging purposes @@ -153,8 +158,10 @@ SUBROUTINE GRIBX_BINARY_READ_CFG_FROM_YAML( THIS, CFG ) TYPE(FCKIT_CONFIGURATION), INTENT(IN) :: CFG ! Local variables + INTEGER(KIND=JPIM_K) :: KRET TYPE(FCKIT_CONFIGURATION) :: GRIBX_BIN_CFG CHARACTER(LEN=:), ALLOCATABLE :: CLTMP + CHARACTER(LEN=1024) :: CTMP_PATH LOGICAL :: LTMP ! Local variables declared by the preprocessor for debugging purposes @@ -176,12 +183,27 @@ SUBROUTINE GRIBX_BINARY_READ_CFG_FROM_YAML( THIS, CFG ) IF ( GRIBX_BIN_CFG%GET( 'path', CLTMP ) ) THEN PP_DEBUG_CRITICAL_COND_THROW( .NOT.ALLOCATED(CLTMP), 1 ) PP_DEBUG_CRITICAL_COND_THROW( LEN(CLTMP).GT.LEN(THIS%FIELDS_FILE_), 2 ) - WRITE(THIS%FIELDS_FILE_,'(A,A,I8.8,A)') TRIM(CLTMP), '_', THIS%TOPOLOGY_%MYPROC_IO, '.grib' + CTMP_PATH=REPEAT( ' ', LEN(CTMP_PATH) ) + CALL OM_REPLACE_ENVVAR_IN_STRING( CLTMP, CTMP_PATH ) + WRITE(THIS%FIELDS_FILE_,'(A,A,I8.8,A)') TRIM(CTMP_PATH), '_', THIS%TOPOLOGY_%MYPROC_IO, '.grib' IF ( ALLOCATED(CLTMP) ) DEALLOCATE( CLTMP ) ELSE WRITE(THIS%FIELDS_FILE_,'(A,I8.8,A)') 'allfields_', THIS%TOPOLOGY_%MYPROC_IO, '.grib' ENDIF + IF ( ALLOCATED(CLTMP) ) DEALLOCATE(CLTMP) + IF ( GRIBX_BIN_CFG%GET( 'samples-path', CLTMP ) ) THEN + PP_DEBUG_CRITICAL_COND_THROW( .NOT.ALLOCATED(CLTMP), 1 ) + PP_DEBUG_CRITICAL_COND_THROW( LEN(CLTMP).GT.LEN(CTMP_PATH), 2 ) + CTMP_PATH=REPEAT( ' ', LEN(CTMP_PATH) ) + CALL OM_REPLACE_ENVVAR_IN_STRING( CLTMP, CTMP_PATH ) + IF ( ALLOCATED(CLTMP) ) DEALLOCATE( CLTMP ) + CALL GRIB_SET_SAMPLES_PATH( TRIM(CTMP_PATH), STATUS=KRET ) + PP_DEBUG_CRITICAL_COND_THROW( KRET.NE.GRIB_SUCCESS, 3 ) + ELSE + PP_DEBUG_CRITICAL_THROW( 4 ) + ENDIF + ! Read from YAML file the flag to enable track time testing IF ( GRIBX_BIN_CFG%GET( 'flush-every-message', LTMP ) ) THEN THIS%FLUSH_EVERY_MESSAGE_ = LTMP @@ -235,6 +257,7 @@ SUBROUTINE GRIBX_BINARY_READ_CFG_FROM_YAML( THIS, CFG ) ! Error handling variables CHARACTER(LEN=:), ALLOCATABLE :: STR + CHARACTER(LEN=4096) :: GRIB_ERROR ! HAndle different errors SELECT CASE(ERRIDX) @@ -242,6 +265,12 @@ SUBROUTINE GRIBX_BINARY_READ_CFG_FROM_YAML( THIS, CFG ) PP_DEBUG_CREATE_ERROR_MSG( STR, 'Allocatable character not allocated after reading operation' ) CASE (2) PP_DEBUG_CREATE_ERROR_MSG( STR, 'Fields file name too long: "'//TRIM(ADJUSTL(THIS%FIELDS_FILE_))//'"' ) + CASE (3) + GRIB_ERROR = REPEAT(' ', 4096) + CALL GRIB_GET_ERROR_STRING( KRET, GRIB_ERROR ) + PP_DEBUG_CREATE_ERROR_MSG_GRIB( STR, 'Unable to set samples path', KRET, GRIB_ERROR ) + CASE (4) + PP_DEBUG_CREATE_ERROR_MSG( STR, 'Unable to read "samples-path"' ) CASE DEFAULT PP_DEBUG_CREATE_ERROR_MSG( STR, 'Unhandled error' ) END SELECT @@ -365,7 +394,7 @@ SUBROUTINE GRIBX_BIN_SETUP( THIS, YAMLFNAME, PROCESSOR_TOPO, MODEL_PARAMS ) CALL SUENCODING_INFO( CFG, PROCESSOR_TOPO, MODEL_PARAMS, THIS%VERBOSE_ ) ! Initialise all the encoders - CALL MAKE_ENCODERS( CFG, MODEL_PARAMS, 'GRIB' ) + CALL MAKE_ENCODERS( CFG, MODEL_PARAMS, 'GRIB', THIS%VERBOSE_ ) ! Destroy the fckit configuration object CALL CFG%FINAL() @@ -459,11 +488,11 @@ SUBROUTINE GRIBX_BIN_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) USE :: OM_CORE_MOD, ONLY: JPIM_K USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRD_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_ATM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_ATM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -500,7 +529,7 @@ SUBROUTINE GRIBX_BIN_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) INTEGER(KIND=JPIB_K) :: UNIT INTEGER(KIND=JPIM_K) :: KRET TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PGMD ! Local variables declared by the preprocessor for debugging purposes @@ -526,27 +555,26 @@ SUBROUTINE GRIBX_BIN_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_DP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PGMD => THIS%GMD_ - PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) - CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PGMD => THIS%GMD_ + PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_ATM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PGMD ) ) THEN + IF ( ENCODE_ATM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PGMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) + CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF ! ! Set global size and values into the grib handle @@ -651,11 +679,11 @@ SUBROUTINE GRIBX_BIN_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) USE :: OM_CORE_MOD, ONLY: JPIM_K USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRM_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_ATM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_ATM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -692,7 +720,7 @@ SUBROUTINE GRIBX_BIN_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) INTEGER(KIND=JPIB_K) :: UNIT INTEGER(KIND=JPIM_K) :: KRET TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PGMD ! Local variables declared by the preprocessor for debugging purposes @@ -718,27 +746,26 @@ SUBROUTINE GRIBX_BIN_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_SP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PGMD => THIS%GMD_ - PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING SINGLE PRECISION VALUES' ) - CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PGMD => THIS%GMD_ + PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_ATM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PGMD ) ) THEN + IF ( ENCODE_ATM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PGMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING SINGLE PRECISION VALUES' ) + CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF ! ! Set global size and values into the grib handle @@ -848,11 +875,11 @@ SUBROUTINE GRIBX_BIN_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) USE :: OM_CORE_MOD, ONLY: JPIM_K USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRD_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_WAM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_WAM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -889,7 +916,7 @@ SUBROUTINE GRIBX_BIN_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) INTEGER(KIND=JPIB_K) :: UNIT INTEGER(KIND=JPIM_K) :: KRET TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PGMD ! Local variables declared by the preprocessor for debugging purposes @@ -915,27 +942,26 @@ SUBROUTINE GRIBX_BIN_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_DP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PGMD => THIS%GMD_ - PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE WAVE MESSAGE USING DOUBLE PRECISION VALUES' ) - CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PGMD => THIS%GMD_ + PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_WAM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PGMD ) ) THEN + IF ( ENCODE_WAM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PGMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE WAVE MESSAGE USING DOUBLE PRECISION VALUES' ) + CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF ! ! Set global size and values into the grib handle @@ -1041,11 +1067,11 @@ SUBROUTINE GRIBX_BIN_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) USE :: OM_CORE_MOD, ONLY: JPIM_K USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRM_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_WAM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_WAM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -1083,7 +1109,7 @@ SUBROUTINE GRIBX_BIN_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) INTEGER(KIND=JPIB_K) :: UNIT INTEGER(KIND=JPIM_K) :: KRET TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PGMD ! Local variables declared by the preprocessor for debugging purposes @@ -1110,27 +1136,26 @@ SUBROUTINE GRIBX_BIN_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_SP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PGMD => THIS%GMD_ - PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE WAVE MESSAGE USING DOUBLE PRECISION VALUES' ) - CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PGMD => THIS%GMD_ + PP_METADATA_INIT_LOGGING( PGMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_WAM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PGMD ) ) THEN + IF ( ENCODE_WAM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PGMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE WAVE MESSAGE USING DOUBLE PRECISION VALUES' ) + CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF ! ! Set global size and values into the grib handle diff --git a/src/ecom/flavours/multio_raw_output_manager_mod.F90 b/src/ecom/flavours/multio_raw_output_manager_mod.F90 index 19836c70..142145c8 100644 --- a/src/ecom/flavours/multio_raw_output_manager_mod.F90 +++ b/src/ecom/flavours/multio_raw_output_manager_mod.F90 @@ -346,7 +346,7 @@ SUBROUTINE MULTIO_RAW_SETUP( THIS, YAMLFNAME, PROCESSOR_TOPO, MODEL_PARAMS ) CALL MULTIO_NEW( THIS%MIO_, THIS%MULTIO_CONFIG_FILE_ ) ! Initialise all the encoders - CALL MAKE_ENCODERS( CFG, MODEL_PARAMS, 'MULTIO', THIS%MIO_ ) + CALL MAKE_ENCODERS( CFG, MODEL_PARAMS, 'MULTIO', THIS%VERBOSE_, THIS%MIO_ ) ! Destroy the fckit configuration object CALL CFG%FINAL() @@ -434,11 +434,11 @@ SUBROUTINE MULTIO_RAW_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRD_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_ATM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_ATM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -471,7 +471,7 @@ SUBROUTINE MULTIO_RAW_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) ! Local variables TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PMMD TYPE(MULTIO_METADATA), POINTER :: MMD @@ -496,32 +496,31 @@ SUBROUTINE MULTIO_RAW_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) CALL OM_SET_CURRENT_MESSAGE_ATM( YDMSG, MSG_PRINT_ATM ) ! Error handling - PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_DP).LT.YDMSG%NVALUES_, 1 ) - - ! Associate the pointers to the metadata - PMMD => THIS%MMD_ - PP_METADATA_INIT_LOGGING( PMMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) + PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_DP).LT.YDMSG%NVALUES_, 1 ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) - CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PMMD => THIS%MMD_ + PP_METADATA_INIT_LOGGING( PMMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_ATM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PMMD ) ) THEN + IF ( ENCODE_ATM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PMMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING DOUBLE PRECISION VALUES' ) + CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF ! Write Edition - CALL THIS%MMD_%SET( 'gribEdition', GRIB_INFO%REQUESTED_ENCODING ) + CALL THIS%MMD_%SET( 'gribEdition', ENCODING_INFO%GRIB_INFO%REQUESTED_ENCODING ) ! Get the multio Metadata MMD => THIS%MMD_%GET_MULTIO_METADATA() @@ -597,11 +596,11 @@ SUBROUTINE MULTIO_RAW_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRM_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_ATM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_ATM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -634,7 +633,7 @@ SUBROUTINE MULTIO_RAW_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) ! Local variables TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PMMD TYPE(MULTIO_METADATA), POINTER :: MMD @@ -661,30 +660,29 @@ SUBROUTINE MULTIO_RAW_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_SP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PMMD => THIS%MMD_ - PP_METADATA_INIT_LOGGING( PMMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING SINGLE PRECISION VALUES' ) - CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PMMD => THIS%MMD_ + PP_METADATA_INIT_LOGGING( PMMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_ATM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PMMD ) ) THEN + IF ( ENCODE_ATM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PMMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE ATMOSPHERE MESSAGE USING SINGLE PRECISION VALUES' ) + CALL MSG_PRINT_ATM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF ! Write Edition - CALL THIS%MMD_%SET( 'gribEdition', GRIB_INFO%REQUESTED_ENCODING ) + CALL THIS%MMD_%SET( 'gribEdition', ENCODING_INFO%GRIB_INFO%REQUESTED_ENCODING ) ! Get the multio Metadata MMD => THIS%MMD_%GET_MULTIO_METADATA() @@ -760,11 +758,11 @@ SUBROUTINE MULTIO_RAW_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRD_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_WAM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_WAM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -797,7 +795,7 @@ SUBROUTINE MULTIO_RAW_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) ! Local variables TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PMMD TYPE(MULTIO_METADATA), POINTER :: MMD @@ -824,30 +822,29 @@ SUBROUTINE MULTIO_RAW_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_DP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PMMD => THIS%MMD_ - PP_METADATA_INIT_LOGGING( PMMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE WAVE MESSAGE USING DOUBLE PRECISION VALUES' ) - CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PMMD => THIS%MMD_ + PP_METADATA_INIT_LOGGING( PMMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_WAM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PMMD ) ) THEN + IF ( ENCODE_WAM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PMMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE WAVE MESSAGE USING DOUBLE PRECISION VALUES' ) + CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF ! Write Edition - CALL THIS%MMD_%SET( 'gribEdition', GRIB_INFO%REQUESTED_ENCODING ) + CALL THIS%MMD_%SET( 'gribEdition', ENCODING_INFO%GRIB_INFO%REQUESTED_ENCODING ) ! Get the multio Metadata MMD => THIS%MMD_%GET_MULTIO_METADATA() @@ -923,11 +920,11 @@ SUBROUTINE MULTIO_RAW_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRM_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_WAM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_WAM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -960,7 +957,7 @@ SUBROUTINE MULTIO_RAW_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) ! Local variables TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO CLASS(METADATA_BASE_A), POINTER :: PMMD TYPE(MULTIO_METADATA), POINTER :: MMD @@ -987,30 +984,29 @@ SUBROUTINE MULTIO_RAW_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) ! Error handling PP_DEBUG_CRITICAL_COND_THROW( SIZE(VALUES_SP).LT.YDMSG%NVALUES_, 1 ) - ! Associate the pointers to the metadata - PMMD => THIS%MMD_ - PP_METADATA_INIT_LOGGING( PMMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) - ! Get encoding info PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) - ! If needed log message - IF ( THIS%VERBOSE_ ) THEN - CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE WAVE MESSAGE USING SINGLE PRECISION VALUES' ) - CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) - CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) - ENDIF + ! Associate the pointers to the metadata + PMMD => THIS%MMD_ + PP_METADATA_INIT_LOGGING( PMMD, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ ) ! ! Encode throws an error if an error happens, and return false if the field does not need to be emitted - IF ( ENCODE_WAM( THIS%MODEL_PAR_, GRIB_INFO, TIME_HIST, YDMSG, PMMD ) ) THEN + IF ( ENCODE_WAM( THIS%MODEL_PAR_, ENCODING_INFO, YDMSG, TIME_HIST, PMMD ) ) THEN + + ! If needed log message + IF ( THIS%VERBOSE_ ) THEN + CALL LOG_CURR_TIME( THIS%LOG_UNIT_, 'WRITE WAVE MESSAGE USING SINGLE PRECISION VALUES' ) + CALL MSG_PRINT_WAM( YDMSG, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) + CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) + ENDIF ! Write Edition - CALL THIS%MMD_%SET( 'gribEdition', GRIB_INFO%REQUESTED_ENCODING ) + CALL THIS%MMD_%SET( 'gribEdition', ENCODING_INFO%GRIB_INFO%REQUESTED_ENCODING ) ! Get the multio Metadata MMD => THIS%MMD_%GET_MULTIO_METADATA() diff --git a/src/ecom/flavours/noop_output_manager_mod.F90 b/src/ecom/flavours/noop_output_manager_mod.F90 index ce7db6d6..7cbb3a4a 100644 --- a/src/ecom/flavours/noop_output_manager_mod.F90 +++ b/src/ecom/flavours/noop_output_manager_mod.F90 @@ -376,13 +376,13 @@ SUBROUTINE NOOP_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRD_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: OM_ATM_MSG_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_ATM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO USE :: MSG_UTILS_MOD, ONLY: MSG_PRINT_ATM USE :: OM_GENERAL_UTILS_MOD, ONLY: LOG_CURR_TIME + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -405,7 +405,8 @@ SUBROUTINE NOOP_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) ! Local variables TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO + LOGICAL :: EX ! Local variables declared by the preprocessor for debugging purposes PP_LOG_DECL_VARS @@ -432,11 +433,14 @@ SUBROUTINE NOOP_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP ) IF ( THIS%TEST_ENCODING_INFO_ ) THEN PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) + + CALL ENCODING_INFO%TIME_HISTORY%ENQUEUE( YDMSG%ISTEP_ ) + EX = ENCODING_INFO%TIME_HISTORY%GET_ALL( TIME_HIST%SIZE_, TIME_HIST%HIST_(1:) ) + IF ( THIS%VERBOSE_ ) THEN PP_LOG_DEVELOP_STR( 'Log the grib informations' ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) PP_LOG_DEVELOP_STR( 'Log the postprocessing history of the field' ) CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) ENDIF @@ -499,13 +503,13 @@ SUBROUTINE NOOP_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRM_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: OM_ATM_MSG_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_ATM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO USE :: MSG_UTILS_MOD, ONLY: MSG_PRINT_ATM USE :: OM_GENERAL_UTILS_MOD, ONLY: LOG_CURR_TIME + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -528,7 +532,8 @@ SUBROUTINE NOOP_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) ! Local variables TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO + LOGICAL :: EX ! Local variables declared by the preprocessor for debugging purposes PP_LOG_DECL_VARS @@ -555,11 +560,14 @@ SUBROUTINE NOOP_WRITE_ATM_SP( THIS, YDMSG, VALUES_SP ) IF ( THIS%TEST_ENCODING_INFO_ ) THEN PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) + + CALL ENCODING_INFO%TIME_HISTORY%ENQUEUE( YDMSG%ISTEP_ ) + EX = ENCODING_INFO%TIME_HISTORY%GET_ALL( TIME_HIST%SIZE_, TIME_HIST%HIST_(1:) ) + IF ( THIS%VERBOSE_ ) THEN PP_LOG_DEVELOP_STR( 'Log the grib informations' ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) PP_LOG_DEVELOP_STR( 'Log the postprocessing history of the field' ) CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) ENDIF @@ -622,13 +630,13 @@ SUBROUTINE NOOP_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRD_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_WAM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_WAM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO USE :: MSG_UTILS_MOD, ONLY: MSG_PRINT_WAM USE :: OM_GENERAL_UTILS_MOD, ONLY: LOG_CURR_TIME + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -651,7 +659,8 @@ SUBROUTINE NOOP_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) ! Local variables TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO + LOGICAL :: EX ! Local variables declared by the preprocessor for debugging purposes PP_LOG_DECL_VARS @@ -678,11 +687,14 @@ SUBROUTINE NOOP_WRITE_WAM_DP( THIS, YDMSG, VALUES_DP ) IF ( THIS%TEST_ENCODING_INFO_ ) THEN PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) + + CALL ENCODING_INFO%TIME_HISTORY%ENQUEUE( YDMSG%ISTEP_ ) + EX = ENCODING_INFO%TIME_HISTORY%GET_ALL( TIME_HIST%SIZE_, TIME_HIST%HIST_(1:) ) + IF ( THIS%VERBOSE_ ) THEN PP_LOG_DEVELOP_STR( 'Log the grib informations' ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) PP_LOG_DEVELOP_STR( 'Log the postprocessing history of the field' ) CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) ENDIF @@ -749,13 +761,13 @@ SUBROUTINE NOOP_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: JPRM_K - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: OM_WAM_MSG_T USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_MESSAGE_WAM USE :: OM_CORE_MOD, ONLY: OM_RESET_ENCODING_INFO USE :: MSG_UTILS_MOD, ONLY: MSG_PRINT_WAM USE :: OM_GENERAL_UTILS_MOD, ONLY: LOG_CURR_TIME + USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_T USE :: ENCODING_INFO_MOD, ONLY: ENCODING_INFO_ACCESS_OR_CREATE USE :: ENCODING_INFO_MOD, ONLY: GRIB_INFO_PRINT USE :: ENCODING_INFO_MOD, ONLY: TRACK_TIME_PRINT @@ -778,7 +790,8 @@ SUBROUTINE NOOP_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) ! Local variables TYPE(TIME_HISTORY_T) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO + TYPE(ENCODING_INFO_T), POINTER :: ENCODING_INFO + LOGICAL :: EX ! Local variables declared by the preprocessor for debugging purposes PP_LOG_DECL_VARS @@ -805,11 +818,14 @@ SUBROUTINE NOOP_WRITE_WAM_SP( THIS, YDMSG, VALUES_SP ) IF ( THIS%TEST_ENCODING_INFO_ ) THEN PP_LOG_DEVELOP_STR( 'Collect grib info of the current field' ) CALL ENCODING_INFO_ACCESS_OR_CREATE( THIS%MODEL_PAR_, YDMSG%PARAM_ID_, YDMSG%IPREF_, & -& YDMSG%IREPRES_, YDMSG%IUID_, YDMSG%ISTEP_, & -& GRIB_INFO, TIME_HIST ) +& YDMSG%IREPRES_, YDMSG%IUID_, ENCODING_INFO ) + + CALL ENCODING_INFO%TIME_HISTORY%ENQUEUE( YDMSG%ISTEP_ ) + EX = ENCODING_INFO%TIME_HISTORY%GET_ALL( TIME_HIST%SIZE_, TIME_HIST%HIST_(1:) ) + IF ( THIS%VERBOSE_ ) THEN PP_LOG_DEVELOP_STR( 'Log the grib informations' ) - CALL GRIB_INFO_PRINT( GRIB_INFO, THIS%LOG_UNIT_ ) + CALL GRIB_INFO_PRINT( ENCODING_INFO%GRIB_INFO, THIS%LOG_UNIT_ ) PP_LOG_DEVELOP_STR( 'Log the postprocessing history of the field' ) CALL TRACK_TIME_PRINT( TIME_HIST, THIS%LOG_UNIT_ ) ENDIF diff --git a/src/ecom/gg_ml.tmpl b/src/ecom/gg_ml.tmpl new file mode 100644 index 00000000..65338149 Binary files /dev/null and b/src/ecom/gg_ml.tmpl differ diff --git a/src/ecom/gg_sfc.tmpl b/src/ecom/gg_sfc.tmpl new file mode 100644 index 00000000..4f837106 Binary files /dev/null and b/src/ecom/gg_sfc.tmpl differ diff --git a/src/ecom/grib_info/encoding_info_mod.F90 b/src/ecom/grib_info/encoding_info_mod.F90 index 6c8b2e8d..1624717c 100644 --- a/src/ecom/grib_info/encoding_info_mod.F90 +++ b/src/ecom/grib_info/encoding_info_mod.F90 @@ -65,8 +65,10 @@ MODULE ENCODING_INFO_MOD ! RB-Trees used to track level for different fields CLASS(MAP_T), TARGET, ALLOCATABLE, DIMENSION(:,:,:) :: ENCODING_INFO +! Whitelist of public symbols (variables) +PUBLIC :: ENCODING_INFO_T -! Whitelist of public variables (precedures) +! Whitelist of public symbols (precedures) PUBLIC :: SUENCODING_INFO PUBLIC :: ENCODING_INFO_FREE PUBLIC :: ENCODING_INFO_ACCESS_OR_CREATE @@ -213,23 +215,19 @@ END SUBROUTINE SUENCODING_INFO !> #define PP_PROCEDURE_TYPE 'SUBROUTINE' #define PP_PROCEDURE_NAME 'ENCODING_INFO_ACCESS_OR_CREATE' -SUBROUTINE ENCODING_INFO_ACCESS_OR_CREATE( MODEL_PARAMS, PARAM_ID, PREFIX, REPRES, LEVEL, STEP, GRIB_INFO, TIME_HIST ) +SUBROUTINE ENCODING_INFO_ACCESS_OR_CREATE( MODEL_PARAMS, PARAM_ID, PREFIX, REPRES, LEVEL, EI ) ! Symbols imported from other modules within the project. USE :: OM_CORE_MOD, ONLY: JPIB_K USE :: OM_CORE_MOD, ONLY: MODEL_PAR_T - USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T - USE :: OM_CORE_MOD, ONLY: TIME_HISTORY_T USE :: OM_CORE_MOD, ONLY: LOOKUP_TABLE USE :: OM_CORE_MOD, ONLY: OM_SET_CURRENT_GRIB_INFO USE :: OM_CORE_MOD, ONLY: CAPACITY + USE :: OM_CORE_MOD, ONLY: GRIB_INFO_T USE :: MAP_MOD, ONLY: MAP_GET USE :: MAP_MOD, ONLY: MAP_INSERT USE :: MAP_MOD, ONLY: KEY_T USE :: YAML_RULES_MOD, ONLY: MATCH_RULES - USE :: CIRCULAR_BUFFER_MOD, ONLY: CB_ENQUEUE - USE :: CIRCULAR_BUFFER_MOD, ONLY: CB_INIT - USE :: CIRCULAR_BUFFER_MOD, ONLY: CB_GET_ALL USE :: YAML_RULES_MOD, ONLY: DEFINITIONS_T USE :: MSG_UTILS_MOD, ONLY: IPREFIX2ILEVTYPE USE :: YAML_TIME_ASSUMPTIONS_MOD, ONLY: MATCH_ASSUMPTIONS_RULES @@ -246,23 +244,21 @@ SUBROUTINE ENCODING_INFO_ACCESS_OR_CREATE( MODEL_PARAMS, PARAM_ID, PREFIX, REPRE IMPLICIT NONE ! Dummy arguments - TYPE(MODEL_PAR_T), INTENT(IN) :: MODEL_PARAMS - INTEGER(KIND=JPIB_K), INTENT(IN) :: PARAM_ID - INTEGER(KIND=JPIB_K), INTENT(IN) :: PREFIX - INTEGER(KIND=JPIB_K), INTENT(IN) :: REPRES - INTEGER(KIND=JPIB_K), INTENT(IN) :: LEVEL - INTEGER(KIND=JPIB_K), INTENT(IN) :: STEP - TYPE(TIME_HISTORY_T), INTENT(OUT) :: TIME_HIST - TYPE(GRIB_INFO_T), POINTER, INTENT(OUT) :: GRIB_INFO + TYPE(MODEL_PAR_T), INTENT(IN) :: MODEL_PARAMS + INTEGER(KIND=JPIB_K), INTENT(IN) :: PARAM_ID + INTEGER(KIND=JPIB_K), INTENT(IN) :: PREFIX + INTEGER(KIND=JPIB_K), INTENT(IN) :: REPRES + INTEGER(KIND=JPIB_K), INTENT(IN) :: LEVEL + TYPE(ENCODING_INFO_T), POINTER, INTENT(OUT) :: EI ! Local variables - TYPE(TIME_ASSUMPTIONS_T) :: TIME_ASSUMPTIONS - TYPE(LEVEL_ASSUMPTIONS_T) :: LEVEL_ASSUMPTIONS + TYPE(TIME_ASSUMPTIONS_T) :: TIME_ASSUMPTIONS + TYPE(LEVEL_ASSUMPTIONS_T) :: LEVEL_ASSUMPTIONS + TYPE(GRIB_INFO_T), POINTER :: GRIB_INFO INTEGER(KIND=JPIB_K) :: IDX INTEGER(KIND=JPIB_K) :: LEV_TYPE TYPE(DEFINITIONS_T) :: DEFINITIONS TYPE(KEY_T) :: KEY - TYPE(ENCODING_INFO_T), POINTER :: EI CLASS(*), POINTER :: VALUE LOGICAL :: EX @@ -295,12 +291,8 @@ SUBROUTINE ENCODING_INFO_ACCESS_OR_CREATE( MODEL_PARAMS, PARAM_ID, PREFIX, REPRE CLASS IS ( ENCODING_INFO_T ) - ! Update time history - CALL CB_ENQUEUE( A%TIME_HISTORY, STEP ) - ! Set output variables - GRIB_INFO => A%GRIB_INFO - EX = CB_GET_ALL( A%TIME_HISTORY, TIME_HIST%SIZE_, TIME_HIST%HIST_(1:) ) + EI => A ! Add the curent grib info to the debug info CALL OM_SET_CURRENT_GRIB_INFO( A%GRIB_INFO, GRIB_INFO_PRINT ) @@ -351,17 +343,13 @@ SUBROUTINE ENCODING_INFO_ACCESS_OR_CREATE( MODEL_PARAMS, PARAM_ID, PREFIX, REPRE CALL TIME_ENCODING_TABLE_ENTRY( PARAM_ID, REPRES, LEV_TYPE, LEVEL, PREFIX, EI%GRIB_INFO ) ! Initialize and update time history - CALL CB_INIT( EI%TIME_HISTORY, CAPACITY ) - - CALL CB_ENQUEUE( EI%TIME_HISTORY, STEP ) + CALL EI%TIME_HISTORY%INIT( CAPACITY ) ! Match rules and assumptions VALUE => EI CALL MAP_INSERT( ENCODING_INFO(IDX,LEV_TYPE,REPRES), KEY, VALUE ) - EX = CB_GET_ALL( EI%TIME_HISTORY, TIME_HIST%SIZE_, TIME_HIST%HIST_(1:) ) - ! Add the curent grib info to the debug info CALL OM_SET_CURRENT_GRIB_INFO( EI%GRIB_INFO, GRIB_INFO_PRINT ) @@ -636,6 +624,7 @@ SUBROUTINE ENCODING_INFO_FREE_ALL() NULLIFY(EI_LIST%TAIL_%NEXT_) ENDIF + CALL CURR%EI_%TIME_HISTORY%FREE() DEALLOCATE( CURR%EI_ ) ! Paranoid operation NULLIFY( CURR%EI_ ) diff --git a/src/ecom/grib_info/yaml_rules_mod.F90 b/src/ecom/grib_info/yaml_rules_mod.F90 index 3acc84b2..baa804f7 100644 --- a/src/ecom/grib_info/yaml_rules_mod.F90 +++ b/src/ecom/grib_info/yaml_rules_mod.F90 @@ -1157,7 +1157,9 @@ SUBROUTINE READ_ENCODE_OPTIONS( CFG, ENCODE_OPTIONS, VERBOSE ) WRITE(ERROR_UNIT,*) 'Read bitsPerValue' ENDIF IF ( CFG%GET( 'bitsPerValue', CLTMP ) ) THEN - WRITE(ERROR_UNIT,*) 'Read bitsPerValue', TRIM(CLTMP) + IF ( VERBOSE ) THEN + WRITE(ERROR_UNIT,*) 'Read bitsPerValue', TRIM(CLTMP) + ENDIF IF ( IS_INTEGER(CLTMP) ) THEN READ(CLTMP,*) ITMP PP_DEBUG_CRITICAL_COND_THROW( ITMP.LT.1, 1 ) @@ -1532,12 +1534,9 @@ SUBROUTINE MATCH_RULES( PARAM_ID, LEV_TYPE, REPRES, LEVEL, DEFINITIONS ) ! Associate the rule definitions to the output variable DEFINITIONS = RULES(RID)%DEFINITIONS - ! Loggin rules match - IF ( CNT .EQ. 1 ) THEN - WRITE(*,*) ' + ENCODING_RULES_LOG: applied rule: '//TRIM(ADJUSTL(RMATCH))//') to field: '//TRIM(ADJUSTL(FLDSTR)) - ELSE - WRITE(*,*) ' + ENCODING_RULES_LOG: applied default rule to field: '//TRIM(ADJUSTL(FLDSTR)) - ENDIF + ! Logging + PP_LOG_DEVELOP_COND_STR( (CNT.EQ.1), '(A128)', ' + ENCODING_RULES_LOG: applied rule: '//TRIM(ADJUSTL(RMATCH))//') to field: '//TRIM(ADJUSTL(FLDSTR)) ) + PP_LOG_DEVELOP_COND_STR( (CNT.NE.1), '(A128)', ' + ENCODING_RULES_LOG: applied default rule to field: '//TRIM(ADJUSTL(FLDSTR)) ) ! Trace end of procedure (on success) PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() diff --git a/src/ecom/grib_info/yaml_time_assumptions_mod.F90 b/src/ecom/grib_info/yaml_time_assumptions_mod.F90 index 96e1ee50..be83d01f 100644 --- a/src/ecom/grib_info/yaml_time_assumptions_mod.F90 +++ b/src/ecom/grib_info/yaml_time_assumptions_mod.F90 @@ -141,7 +141,7 @@ SUBROUTINE INIT_TIME_ASSUMPTION_RULES( MAIN_CFG, VERBOSE ) ENDIF ! Check if the file exists - WRITE(*,*) 'Reading file: ', TRIM(ADJUSTL(YAMLFNAME)) + PP_LOG_DEVELOP_STR( 'Reading file: '//TRIM(ADJUSTL(YAMLFNAME)) ) INQUIRE(FILE=YAMLFNAME, EXIST=EX) PP_DEBUG_CRITICAL_COND_THROW( .NOT.EX, 1 ) @@ -2565,7 +2565,7 @@ SUBROUTINE MATCH_ASSUMPTIONS_RULES( PARAM_ID, LEV_TYPE, REPRES, LEVEL, IS_ENSAMB IF ( CNT.LT.1 ) THEN PP_DEBUG_CRITICAL_THROW( 5 ) ELSE - WRITE(*,*) 'ACCESSING RID: ', RID, SIZE(DEFAULT_ASSUMPTIONS) + ! WRITE(*,*) 'ACCESSING RID: ', RID, SIZE(DEFAULT_ASSUMPTIONS) TIME_ASSUMPTIONS = DEFAULT_ASSUMPTIONS(RID)%TIME_ASSUMPTIONS LEVEL_ASSUMPTIONS = DEFAULT_ASSUMPTIONS(RID)%LEVEL_ASSUMPTIONS ENDIF @@ -2575,13 +2575,16 @@ SUBROUTINE MATCH_ASSUMPTIONS_RULES( PARAM_ID, LEV_TYPE, REPRES, LEVEL, IS_ENSAMB LEVEL_ASSUMPTIONS = SPECIAL_ASSUMPTIONS(RID)%LEVEL_ASSUMPTIONS ENDIF + ! Logging + PP_LOG_DEVELOP_COND_STR( (CNT.EQ.1), '(A128)', ' + ASSUMPTIONS_RULES_LOG: applied rule: '//TRIM(ADJUSTL(RMATCH))//') to field: '//TRIM(ADJUSTL(FLDSTR)) ) + PP_LOG_DEVELOP_COND_STR( (CNT.NE.1), '(A128)', ' + ASSUMPTIONS_RULES_LOG: applied default rule to field: '//TRIM(ADJUSTL(FLDSTR)) ) ! Loggin rules match - IF ( CNT .EQ. 1 ) THEN - WRITE(*,*) ' + ASSUMPTIONS_RULES_LOG: applied rule: '//TRIM(ADJUSTL(RMATCH))//') to field: '//TRIM(ADJUSTL(FLDSTR)) - ELSE - WRITE(*,*) ' + ASSUMPTIONS_RULES_LOG: applied default rule to field: '//TRIM(ADJUSTL(FLDSTR)) - ENDIF + ! IF ( CNT .EQ. 1 ) THEN + ! WRITE(*,*) ' + ASSUMPTIONS_RULES_LOG: applied rule: '//TRIM(ADJUSTL(RMATCH))//') to field: '//TRIM(ADJUSTL(FLDSTR)) + ! ELSE + ! WRITE(*,*) ' + ASSUMPTIONS_RULES_LOG: applied default rule to field: '//TRIM(ADJUSTL(FLDSTR)) + ! ENDIF ! Trace end of procedure (on success) PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() diff --git a/src/ecom/include/standard/output_manager_preprocessor_logging_utils.h.in b/src/ecom/include/standard/output_manager_preprocessor_logging_utils.h.in index 441dcd77..108b5baf 100644 --- a/src/ecom/include/standard/output_manager_preprocessor_logging_utils.h.in +++ b/src/ecom/include/standard/output_manager_preprocessor_logging_utils.h.in @@ -12,4 +12,13 @@ WRITE(*,*) STR #define PP_LOG_DEVELOP_STR( STR ) #endif +#if 0 +#define PP_LOG_DEVELOP_COND_STR( COND, FMT, STR ) \ +IF ( COND ) THEN; \ +WRITE(*,FMT) STR; \ +ENDIF +#else +#define PP_LOG_DEVELOP_COND_STR( COND, FMT, STR ) +#endif + #endif diff --git a/src/ecom/include/standard/output_manager_preprocessor_utils.h.in b/src/ecom/include/standard/output_manager_preprocessor_utils.h.in index 9f7b2a0f..f03c1bd4 100644 --- a/src/ecom/include/standard/output_manager_preprocessor_utils.h.in +++ b/src/ecom/include/standard/output_manager_preprocessor_utils.h.in @@ -71,7 +71,7 @@ CALL METADATA%INIT_FROM_SAMPLE( SAMPLE_NAME, SAMPLE_HANDLE ) CALL METADATA%SET( KEY, VALUE ) #define PP_METADATA_SET_MISSING( METADATA, KEY ) \ -CALL METADATA%SET( KEY, VALUE ) +CALL METADATA%SET_MISSING( KEY ) #endif #endif diff --git a/src/ecom/samples/CMakeLists.txt b/src/ecom/samples/CMakeLists.txt new file mode 100644 index 00000000..3a322ed4 --- /dev/null +++ b/src/ecom/samples/CMakeLists.txt @@ -0,0 +1,8 @@ +file(GLOB samples_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.tmpl") + +install( + FILES ${samples_files} + DESTINATION ${MULTIO_SAMPLE_DIR} + PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) + + diff --git a/src/ecom/samples/multio-gg-ml-grib1.tmpl b/src/ecom/samples/multio-gg-ml-grib1.tmpl new file mode 100644 index 00000000..fde5a38b Binary files /dev/null and b/src/ecom/samples/multio-gg-ml-grib1.tmpl differ diff --git a/src/ecom/samples/multio-gg-ml-grib2.tmpl b/src/ecom/samples/multio-gg-ml-grib2.tmpl new file mode 100644 index 00000000..5629720e Binary files /dev/null and b/src/ecom/samples/multio-gg-ml-grib2.tmpl differ diff --git a/src/ecom/samples/multio-gg-sfc-grib1.tmpl b/src/ecom/samples/multio-gg-sfc-grib1.tmpl new file mode 100644 index 00000000..1dc39370 Binary files /dev/null and b/src/ecom/samples/multio-gg-sfc-grib1.tmpl differ diff --git a/src/ecom/samples/multio-gg-sfc-grib2.01.tmpl b/src/ecom/samples/multio-gg-sfc-grib2.01.tmpl new file mode 100644 index 00000000..ac236fe3 Binary files /dev/null and b/src/ecom/samples/multio-gg-sfc-grib2.01.tmpl differ diff --git a/src/ecom/samples/multio-gg-sfc-grib2.tmpl b/src/ecom/samples/multio-gg-sfc-grib2.tmpl new file mode 100644 index 00000000..567d9b01 Binary files /dev/null and b/src/ecom/samples/multio-gg-sfc-grib2.tmpl differ diff --git a/src/ecom/samples/multio-sh-ml-grib1.tmpl b/src/ecom/samples/multio-sh-ml-grib1.tmpl new file mode 100644 index 00000000..4a47fa5c Binary files /dev/null and b/src/ecom/samples/multio-sh-ml-grib1.tmpl differ diff --git a/src/ecom/samples/multio-sh-ml-grib2.tmpl b/src/ecom/samples/multio-sh-ml-grib2.tmpl new file mode 100644 index 00000000..99c9ee78 Binary files /dev/null and b/src/ecom/samples/multio-sh-ml-grib2.tmpl differ diff --git a/src/ecom/samples/multio-sh-sfc-grib1.tmpl b/src/ecom/samples/multio-sh-sfc-grib1.tmpl new file mode 100644 index 00000000..9d57171c Binary files /dev/null and b/src/ecom/samples/multio-sh-sfc-grib1.tmpl differ diff --git a/src/ecom/samples/multio-sh-sfc-grib2.tmpl b/src/ecom/samples/multio-sh-sfc-grib2.tmpl new file mode 100644 index 00000000..de81b182 Binary files /dev/null and b/src/ecom/samples/multio-sh-sfc-grib2.tmpl differ diff --git a/src/ecom/sh_ml.tmpl b/src/ecom/sh_ml.tmpl new file mode 100644 index 00000000..52858b87 Binary files /dev/null and b/src/ecom/sh_ml.tmpl differ diff --git a/src/ecom/sh_sfc.tmpl b/src/ecom/sh_sfc.tmpl new file mode 100644 index 00000000..957d49f9 Binary files /dev/null and b/src/ecom/sh_sfc.tmpl differ diff --git a/src/ecom/tool/om_tool_cfg_mod.F90 b/src/ecom/tool/om_tool_cfg_mod.F90 index d13f0129..2ac21389 100644 --- a/src/ecom/tool/om_tool_cfg_mod.F90 +++ b/src/ecom/tool/om_tool_cfg_mod.F90 @@ -232,43 +232,79 @@ SUBROUTINE PRINT_COMMAND_LINE_OPTIONS( CFG ) ! Dummy arguments TYPE(COMMAND_LINE_ARGS_T), INTENT(INOUT) :: CFG + ! Local variables + CHARACTER(LEN=1024) :: CTMP + CHARACTER(LEN=32) :: CINT + CHARACTER(LEN=32) :: CFMT + ! Print values of the configuration - WRITE(OUTPUT_UNIT,*) ' + DryRun :: ', CFG%DRYRUN - WRITE(OUTPUT_UNIT,*) ' + Verbose :: ', CFG%VERBOSE - WRITE(OUTPUT_UNIT,*) ' + Big endian read :: ', CFG%BIG_ENDIAN_READ - WRITE(OUTPUT_UNIT,*) ' + Output manager type :: ', TRIM(ADJUSTL(CFG%OUTPUT_MANAGER_TYPE)) - WRITE(OUTPUT_UNIT,*) ' + Input directory :: ', TRIM(ADJUSTL(CFG%INPUT_DIR)) - WRITE(OUTPUT_UNIT,*) ' + YAML configuration file :: ', TRIM(ADJUSTL(CFG%YAML_CONFIGURATION)) + + WRITE(OUTPUT_UNIT,*) ' ' + WRITE(OUTPUT_UNIT,'(A150)') REPEAT('-',150) + WRITE(OUTPUT_UNIT,*) ' ECOM :: Command line options' + WRITE(OUTPUT_UNIT,'(A150)') REPEAT('-',150) + WRITE(OUTPUT_UNIT,*) '+ DryRun :: ', CFG%DRYRUN + WRITE(OUTPUT_UNIT,*) '+ Verbose :: ', CFG%VERBOSE + WRITE(OUTPUT_UNIT,*) '+ Big endian read :: ', CFG%BIG_ENDIAN_READ + WRITE(OUTPUT_UNIT,*) '+ Output manager type :: ', TRIM(ADJUSTL(CFG%OUTPUT_MANAGER_TYPE)) + + CTMP=REPEAT(' ',LEN(CTMP)) + CINT=REPEAT(' ',32) + CFMT=REPEAT(' ',32) + CTMP=' + Input directory :: '//TRIM(ADJUSTL(CFG%INPUT_DIR)) + WRITE(CINT,'(I10)') LEN_TRIM(CTMP) + WRITE(CFMT,'(A)') '(A'//TRIM(ADJUSTL(CINT))//')' + WRITE(OUTPUT_UNIT,'(A)') TRIM(CTMP) + + CTMP=REPEAT(' ',LEN(CTMP)) + CINT=REPEAT(' ',32) + CFMT=REPEAT(' ',32) + CTMP=' + YAML configuration file :: '//TRIM(ADJUSTL(CFG%YAML_CONFIGURATION)) + WRITE(CINT,'(I10)') LEN_TRIM(CTMP) + WRITE(CFMT,'(A)') '(A'//TRIM(ADJUSTL(CINT))//')' + WRITE(OUTPUT_UNIT,'(A)') TRIM(CTMP) IF ( ALLOCATED( CFG%PARAM_ID) ) THEN - WRITE(OUTPUT_UNIT,*) ' + param ids :: ', CFG%PARAM_ID + CINT=REPEAT(' ',32) + WRITE(CINT,'(I10)') CFG%PARAM_ID + WRITE(OUTPUT_UNIT,*) '+ param ids :: '//TRIM(ADJUSTL(CINT)) ELSE - WRITE(OUTPUT_UNIT,*) ' + param ids :: all' + WRITE(OUTPUT_UNIT,*) '+ param ids :: all' ENDIF IF ( ALLOCATED( CFG%U_ID) ) THEN - WRITE(OUTPUT_UNIT,*) ' + levels ids :: ', CFG%U_ID + CINT=REPEAT(' ',32) + WRITE(CINT,'(I10)') CFG%U_ID + WRITE(OUTPUT_UNIT,*) '+ levels ids :: '//TRIM(ADJUSTL(CINT)) ELSE - WRITE(OUTPUT_UNIT,*) ' + levels ids :: all' + WRITE(OUTPUT_UNIT,*) '+ levels ids :: all' ENDIF IF ( ALLOCATED( CFG%STEP_ID) ) THEN - WRITE(OUTPUT_UNIT,*) ' + steps ids :: ', CFG%STEP_ID + CINT=REPEAT(' ',32) + WRITE(CINT,'(I10)') CFG%STEP_ID + WRITE(OUTPUT_UNIT,*) '+ steps ids :: '//TRIM(ADJUSTL(CINT)) ELSE - WRITE(OUTPUT_UNIT,*) ' + steps ids :: all' + WRITE(OUTPUT_UNIT,*) '+ steps ids :: all' ENDIF IF ( ALLOCATED( CFG%REPRES_ID) ) THEN - WRITE(OUTPUT_UNIT,*) ' + representation :: ', CFG%REPRES_ID + CINT=REPEAT(' ',32) + WRITE(CINT,'(I10)') CFG%REPRES_ID + WRITE(OUTPUT_UNIT,*) '+ representation :: '//TRIM(ADJUSTL(CINT)) ELSE - WRITE(OUTPUT_UNIT,*) ' + representation :: all' + WRITE(OUTPUT_UNIT,*) '+ representation :: all' ENDIF IF ( ALLOCATED( CFG%PREFIX_ID) ) THEN - WRITE(OUTPUT_UNIT,*) ' + prefix :: ', CFG%PREFIX_ID + CINT=REPEAT(' ',32) + WRITE(CINT,'(I10)') CFG%PREFIX_ID + WRITE(OUTPUT_UNIT,*) '+ prefix :: '//TRIM(ADJUSTL(CINT)) ELSE - WRITE(OUTPUT_UNIT,*) ' + prefix :: all' + WRITE(OUTPUT_UNIT,*) '+ prefix :: all' ENDIF + WRITE(OUTPUT_UNIT,'(A150)') REPEAT('-',150) + WRITE(OUTPUT_UNIT,*) ' ' ! Exit point RETURN diff --git a/src/ecom/tool/om_tool_feed_prog.F90 b/src/ecom/tool/om_tool_feed_prog.F90 index 9335fa04..8b0e5bf7 100644 --- a/src/ecom/tool/om_tool_feed_prog.F90 +++ b/src/ecom/tool/om_tool_feed_prog.F90 @@ -90,9 +90,10 @@ PROGRAM OM_TOOL_PROG ! Parse command line options CALL PARSE_COMMAND_LINE_OPTIONS( CFG ) - ! Log teh configuration of hte tool - CALL PRINT_COMMAND_LINE_OPTIONS( CFG ) - + ! Log the configuration of hte tool + IF ( CFG%VERBOSE ) THEN + CALL PRINT_COMMAND_LINE_OPTIONS( CFG ) + ENDIF ! Set the verbosity of the hooks at begin and end of every function CALL SET_HOOK_VERBOSITY( .FALSE. ) @@ -122,8 +123,10 @@ PROGRAM OM_TOOL_PROG CALL TOC_READ_ALL( TRIM(CFG%INPUT_DIR), TOC, YLOMP%SIM_%NPROC_IO, CFG%BIG_ENDIAN_READ, CFG%VERBOSE ) ENDIF - WRITE(OUTPUT_UNIT,'(A150)') REPEAT('-',150) - WRITE(OUTPUT_UNIT,'(A20,A10,A10,A10,A10,A10,A10,A4,A20,A10)') ' message type', 'paramId', 'level/uid', 'step', 'proc', 'repres', 'prefix', ' ', 'crepres', 'clevtype' + IF ( CFG%VERBOSE ) THEN + WRITE(OUTPUT_UNIT,'(A150)') REPEAT('-',150) + WRITE(OUTPUT_UNIT,'(A20,A10,A10,A10,A10,A10,A10,A4,A20,A10)') ' message type', 'paramId', 'level/uid', 'step', 'proc', 'repres', 'prefix', ' ', 'crepres', 'clevtype' + ENDIF ! Loop over the toc entries FeederLoop: DO TOCID = 1, SIZE(TOC) diff --git a/src/ecom/tool/om_tool_utils_mod.F90 b/src/ecom/tool/om_tool_utils_mod.F90 index abb15dac..ec2591cf 100644 --- a/src/ecom/tool/om_tool_utils_mod.F90 +++ b/src/ecom/tool/om_tool_utils_mod.F90 @@ -131,17 +131,29 @@ SUBROUTINE READ_ATM_MESSAGE( DIRECTORY, PROC_ID, MSG_ID, ADDR, YDMSG, BIG_ENDIAN LOGICAL, INTENT(IN) :: VERBOSE ! Local variables + CHARACTER(LEN=32) :: CFMT + CHARACTER(LEN=32) :: CINT CHARACTER(LEN=1024) :: LOC_DIR CHARACTER(LEN=1024) :: MSGFNAME INTEGER(KIND=JPIB_K) :: MSGUNIT INTEGER(KIND=JPIB_K) :: STAT ! Read the message - LOC_DIR = REPEAT( ' ', 1024 ) + IF ( VERBOSE ) THEN + CFMT=REPEAT(' ',32) + CINT=REPEAT(' ',32) + ENDIF + + LOC_DIR=REPEAT( ' ', 1024 ) WRITE(LOC_DIR,'(A,A,I6.6,A)') TRIM(DIRECTORY), '/io_serv.', PROC_ID, '.d' CALL MSG_CREATE_NAME( TRIM(LOC_DIR), MSG_ID, PROC_ID, MSGFNAME ) - WRITE(*,*) ' =========================================================' - WRITE(*,*) TRIM(MSGFNAME) + + IF ( VERBOSE ) THEN + WRITE(CINT,'(I10)') LEN_TRIM(MSGFNAME) + WRITE(CFMT,'(A)') '(A'//TRIM(ADJUSTL(CINT))//')' + WRITE(*,CFMT) TRIM(MSGFNAME) + ENDIF + CALL MSG_ROPEN( MSGFNAME, MSGUNIT, BIG_ENDIAN_READ ) CALL MSG_READ_ATM( MSGUNIT, YDMSG, ADDR, VERBOSE ) CALL MSG_CLOSE( MSGUNIT ) @@ -174,17 +186,29 @@ SUBROUTINE READ_WAM_MESSAGE( DIRECTORY, PROC_ID, MSG_ID, ADDR, YDMSG, BIG_ENDIAN LOGICAL, INTENT(IN) :: VERBOSE ! Local variables + CHARACTER(LEN=32) :: CFMT + CHARACTER(LEN=32) :: CINT CHARACTER(LEN=1024) :: LOC_DIR CHARACTER(LEN=1024) :: MSGFNAME INTEGER(KIND=JPIB_K) :: MSGUNIT INTEGER(KIND=JPIB_K) :: STAT ! Read the message + IF ( VERBOSE ) THEN + CFMT=REPEAT(' ',32) + CINT=REPEAT(' ',32) + ENDIF + LOC_DIR = REPEAT( ' ', 1024 ) WRITE(LOC_DIR,'(A,A,I6.6,A)') TRIM(DIRECTORY), '/io_serv.', PROC_ID, '.d' CALL MSG_CREATE_NAME( TRIM(LOC_DIR), MSG_ID, PROC_ID, MSGFNAME ) - WRITE(*,*) ' =========================================================' - WRITE(*,*) TRIM(MSGFNAME) + + IF ( VERBOSE ) THEN + WRITE(CINT,'(I10)') LEN_TRIM(MSGFNAME) + WRITE(CFMT,'(A)') '(A'//TRIM(ADJUSTL(CINT))//')' + WRITE(*,CFMT) TRIM(MSGFNAME) + ENDIF + CALL MSG_ROPEN( MSGFNAME, MSGUNIT, BIG_ENDIAN_READ ) CALL MSG_READ_WAM( MSGUNIT, YDMSG, ADDR, VERBOSE ) CALL MSG_CLOSE( MSGUNIT ) diff --git a/src/multio/api/c/multio_capi.cc b/src/multio/api/c/multio_capi.cc index 32315460..29a0bf6a 100644 --- a/src/multio/api/c/multio_capi.cc +++ b/src/multio/api/c/multio_capi.cc @@ -295,7 +295,7 @@ int multio_config_set_failure_handler(multio_configuration_t* cc, multio_failure auto f = cc->failureContext.get(); f->handler = handler; f->usercontext = usercontext; - eckit::Log::info() << "MultIO setting failure handler callable" << std::endl; + // eckit::Log::debug() << "MultIO setting failure handler callable" << std::endl; }, cc); #else @@ -313,7 +313,7 @@ int multio_handle_set_failure_handler(multio_handle_t* mio, multio_failure_handl auto f = mio->failureContext.get(); f->handler = handler; f->usercontext = usercontext; - eckit::Log::info() << "MultIO setting failure handler callable" << std::endl; + // eckit::Log::debug() << "MultIO setting failure handler callable" << std::endl; }, mio); #else