Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
MircoValentiniECMWF committed Jul 14, 2024
1 parent 7dcfa9e commit 9c2e1cb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
8 changes: 7 additions & 1 deletion src/ecom/flavours/gribx2multio_raw_output_manager_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP )

ELSE

! Initialize loggin for multio metadata
PP_METADATA_INIT_LOGGING( THIS%MMD_, YDMSG%ISTEP_, YDMSG%PARAM_ID_, YDMSG%IUID_, YDMSG%IPREF_, YDMSG%IREPRES_ )

! Create multio metadata from a grib metadata
CALL THIS%MMD_%INIT_FROM_METADATA( PGMD )

Expand All @@ -555,13 +558,16 @@ SUBROUTINE GRIBX2MULTIO_RAW_WRITE_ATM_DP( THIS, YDMSG, VALUES_DP )

! Destroy the metadata objects
IF ( THIS%GMD_%INITIALIZED() ) THEN
IF ( THIS%SAVE_REPORT_ ) THEN
IF ( THIS%SAVE_REPORT_ .AND. 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
PP_METADATA_FINALISE_LOGGING( THIS%MMD_ )
ENDIF
CALL THIS%MMD_%DESTROY()
ENDIF

Expand Down
14 changes: 7 additions & 7 deletions src/ecom/grib_info/encoding_info_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ SUBROUTINE SUENCODING_INFO( CFG, PROCESSOR_TOPO, MODEL_PARAMS, VERBOSE )
CALL RULES_DIMS( MIN_PARAM_ID, MAX_PARAM_ID, NUM_PARAM_ID )

! Allocate encoding info
WRITE(*,*) 'Allocate maps: ', NUM_PARAM_ID, N_LEVTYPE_E, N_REPRES_E
! WRITE(*,*) 'Allocate maps: ', NUM_PARAM_ID, N_LEVTYPE_E, N_REPRES_E
ALLOCATE( ENCODING_INFO(NUM_PARAM_ID,N_LEVTYPE_E,N_REPRES_E), STAT=STAT, ERRMSG=ERRMSG )
PP_DEBUG_DEVELOP_COND_THROW( STAT.NE.0, 1 )

! Initialize all the maps
WRITE(*,*) 'Initialize maps'
! WRITE(*,*) 'Initialize maps'
DO I = 1, SIZE(ENCODING_INFO,1)
DO J = 1, SIZE(ENCODING_INFO,2)
DO K = 1, SIZE(ENCODING_INFO,3)
Expand Down Expand Up @@ -331,11 +331,11 @@ SUBROUTINE ENCODING_INFO_ACCESS_OR_CREATE( MODEL_PARAMS, PARAM_ID, PREFIX, REPRE
GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_ = TIME_ASSUMPTIONS%LENGTH_OF_TIME_RANGE_IN_SECONDS
GRIB_INFO%IS_STEP0_VALID_ = TIME_ASSUMPTIONS%EMIT_STEP_ZERO

WRITE(*,*) ' - PDT: ', GRIB_INFO%PRODUCT_DEFINITION_TEMPLATE_NUMBER_
WRITE(*,*) ' - TSP: ', GRIB_INFO%TYPE_OF_STATISTICAL_PROCESS_
WRITE(*,*) ' - TTR: ', GRIB_INFO%TYPE_OF_TIME_RANGE_
WRITE(*,*) ' - LTR: ', GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_
WRITE(*,*) ' - ES0: ', GRIB_INFO%IS_STEP0_VALID_
! WRITE(*,*) ' - PDT: ', GRIB_INFO%PRODUCT_DEFINITION_TEMPLATE_NUMBER_
! WRITE(*,*) ' - TSP: ', GRIB_INFO%TYPE_OF_STATISTICAL_PROCESS_
! WRITE(*,*) ' - TTR: ', GRIB_INFO%TYPE_OF_TIME_RANGE_
! WRITE(*,*) ' - LTR: ', GRIB_INFO%OVERALL_LENGTH_OF_TIME_RANGE_
! WRITE(*,*) ' - ES0: ', GRIB_INFO%IS_STEP0_VALID_

! Initialize and create grib info (Grib info is created using the definitions extracted from the rules and assumptions)
CALL INITIALIZE_GRIB_INFO( MODEL_PARAMS, PARAM_ID, PREFIX, LEV_TYPE, &
Expand Down
8 changes: 8 additions & 0 deletions src/ecom/tool/om_tool_feed_prog.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ PROGRAM OM_TOOL_PROG
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY: OUTPUT_UNIT
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY: REAL32
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY: REAL64
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_INT

! Symbols imported from other modules within the project.
USE :: OM_TOOL_UTILS_MOD, ONLY: SET_HOOK_VERBOSITY
Expand All @@ -23,6 +24,8 @@ PROGRAM OM_TOOL_PROG
USE :: OM_TOOL_CFG_MOD, ONLY: FREE_COMMAND_LINE_OPTIONS
USE :: OM_TOOL_CFG_MOD, ONLY: MATCH

USE :: MULTIO_API, ONLY: MULTIO_INITIALISE

! Symbols imported from the main library of the project.
USE :: OM_API_MOD, ONLY: IPREFIX2ILEVTYPE
USE :: OM_API_MOD, ONLY: ILEVTYPE2CLEVTYPE
Expand Down Expand Up @@ -66,6 +69,8 @@ PROGRAM OM_TOOL_PROG
TYPE(PROC_TOPO_T) :: YLTOPO
TYPE(MODEL_PAR_T) :: YLOMP
INTEGER(KIND=JPIB_K) :: TOCID

INTEGER(KIND=C_INT) :: ERR
TYPE(OM_ATM_MSG_T) :: YLATMMSG
TYPE(OM_WAM_MSG_T) :: YLWAMMSG
CHARACTER(LEN=2048) :: TOCFNAME
Expand All @@ -76,6 +81,9 @@ PROGRAM OM_TOOL_PROG
REAL(KIND=REAL32), POINTER, DIMENSION(:) :: VALUES_SP
REAL(KIND=REAL64), POINTER, DIMENSION(:) :: VALUES_DP

! Initialize multio
ERR = MULTIO_INITIALISE()

! Set the default values for the command line options
CALL INIT_COMMAND_LINE_OPTIONS( CFG )

Expand Down
3 changes: 3 additions & 0 deletions src/multio/api/c/multio_capi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ int multio_write_field_float(multio_handle_t* mio, multio_metadata_t* md, const
ASSERT(md);

md->set("precision", "single");
md->set("format", "raw");

eckit::Buffer field_vals{reinterpret_cast<const char*>(data), size * sizeof(float)};

Expand All @@ -620,6 +621,7 @@ int multio_write_field_double(multio_handle_t* mio, multio_metadata_t* md, const
ASSERT(md);

md->set("precision", "double");
md->set("format", "raw");

eckit::Buffer field_vals{reinterpret_cast<const char*>(data), size * sizeof(double)};

Expand All @@ -639,6 +641,7 @@ int multio_write_field_buffer(multio_handle_t* mio, multio_metadata_t* md, multi
ASSERT(mio);
ASSERT(md);
ASSERT(d);
md->set("format", "raw");
if (byte_size == 4) {
md->set("precision", "single");
}
Expand Down

0 comments on commit 9c2e1cb

Please sign in to comment.