Skip to content

Commit

Permalink
WIP added and populated sections
Browse files Browse the repository at this point in the history
  • Loading branch information
MircoValentiniECMWF committed Sep 19, 2024
1 parent ce9c1e0 commit 2d0e1f9
Show file tree
Hide file tree
Showing 42 changed files with 14,100 additions and 1,228 deletions.
27 changes: 12 additions & 15 deletions src/ecom/grib_info/grib2/grib2_encoder_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MODULE GRIB2_ENCODER_MOD

PROCEDURE, PUBLIC, PASS, NON_OVERRRIDABLE :: PRESET => GRIB2_MESSAGE_PRESET

PROCEDURE, PUBLIC, PASS, NON_OVERRRIDABLE :: GET_RUNTIME_OPS => GRIB2_MESSAGE_GET_RUNTIME_OPS
PROCEDURE, PUBLIC, PASS, NON_OVERRRIDABLE :: RUNTIME => GRIB2_MESSAGE_RUNTIME

PROCEDURE, PUBLIC, PASS, NON_OVERRRIDABLE :: FREE => GRIB2_MESSAGE_FREE

Expand All @@ -57,14 +57,14 @@ SUBROUTINE GRIB2_MESSAGE_INIT( THIS, PARAMS, CFG, VERBOSE )
LOGICAL, INTENT(IN) :: VERBOSE

! Initialize the sections
CALL SAMPLE_LOADER_FACTORY( THIS%SAMPLE_LOADER, PARAMS, CFG, VERBOSE )
CALL GRIB2_SECTIONS_FACTORY( THIS%SEC0, 0, PARAMS, CFG, VERBOSE )
CALL GRIB2_SECTIONS_FACTORY( THIS%SEC1, 1, PARAMS, CFG, VERBOSE )
CALL GRIB2_SECTIONS_FACTORY( THIS%SEC2, 2, PARAMS, CFG, VERBOSE )
CALL GRIB2_SECTIONS_FACTORY( THIS%SEC3, 3, PARAMS, CFG, VERBOSE )
CALL GRIB2_SECTIONS_FACTORY( THIS%SEC4, 4, PARAMS, CFG, VERBOSE )
CALL GRIB2_SECTIONS_FACTORY( THIS%SEC5, 5, PARAMS, CFG, VERBOSE )
CALL GRIB2_SECTIONS_FACTORY( THIS%SEC6, 6, PARAMS, CFG, VERBOSE )
! CALL SAMPLE_LOADER_FACTORY( THIS%SAMPLE_LOADER, PARAMS, CFG, VERBOSE )
CALL GRIB2_FACTORY( THIS%SEC0, 0, PARAMS, CFG, VERBOSE )
CALL GRIB2_FACTORY( THIS%SEC1, 1, PARAMS, CFG, VERBOSE )
CALL GRIB2_FACTORY( THIS%SEC2, 2, PARAMS, CFG, VERBOSE )
CALL GRIB2_FACTORY( THIS%SEC3, 3, PARAMS, CFG, VERBOSE )
CALL GRIB2_FACTORY( THIS%SEC4, 4, PARAMS, CFG, VERBOSE )
CALL GRIB2_FACTORY( THIS%SEC5, 5, PARAMS, CFG, VERBOSE )
CALL GRIB2_FACTORY( THIS%SEC6, 6, PARAMS, CFG, VERBOSE )

END SUBROUTINE GRIB2_MESSAGE_INIT

Expand All @@ -81,7 +81,7 @@ SUBROUTINE GRIB2_MESSAGE_ALLOCATE( THIS, PARAMS, METADATA, VERBOSE )
LOGICAL, INTENT(IN) :: VERBOSE

! Initialize the sections
CALL THIS%SAMPLE_LOADER%LOAD( PARAMS, METADATA, VERBOSE )
! CALL THIS%SAMPLE_LOADER%LOAD( PARAMS, METADATA, VERBOSE )
CALL THIS%SEC0%ALLOCATE( PARAMS, METADATA, VERBOSE )
CALL THIS%SEC1%ALLOCATE( PARAMS, METADATA, VERBOSE )
CALL THIS%SEC2%ALLOCATE( PARAMS, METADATA, VERBOSE )
Expand All @@ -103,9 +103,6 @@ SUBROUTINE GRIB2_MESSAGE_PRESET( THIS, PARAMS, METADATA, VERBOSE )
CLASS(METADATA_BASE_T), INTENT(INOUT) :: METADATA
LOGICAL, INTENT(IN) :: VERBOSE

! Allocate the grib strucutre
CALL THIS%ALLOCATE( PARAMS, METADATA, VERBOSE )

! Initialize the sections
CALL THIS%SEC0%PRESET( PARAMS, METADATA, VERBOSE )
CALL THIS%SEC1%PRESET( PARAMS, METADATA, VERBOSE )
Expand All @@ -118,7 +115,7 @@ SUBROUTINE GRIB2_MESSAGE_PRESET( THIS, PARAMS, METADATA, VERBOSE )
END SUBROUTINE GRIB2_MESSAGE_PRESET


SUBROUTINE GRIB2_MESSAGE_GET_RUNTIME_OPS( THIS, PARAMS, RUNTIME_OPS, VERBOSE )
SUBROUTINE GRIB2_MESSAGE_RUNTIME( THIS, PARAMS, RUNTIME_OPS, VERBOSE )

IMPLICIT NONE

Expand Down Expand Up @@ -184,7 +181,7 @@ SUBROUTINE GRIB2_MESSAGE_GET_RUNTIME_OPS( THIS, PARAMS, RUNTIME_OPS, VERBOSE )
CALL THIS%SEC5%GET_RUNTIME_OPS( PARAMS, MSG, RUNTIME_OPS(LO(5):HI(5)), VERBOSE )
CALL THIS%SEC1%GET_RUNTIME_OPS( PARAMS, MSG, RUNTIME_OPS(LO(6):HI(6)), VERBOSE )

END SUBROUTINE GRIB2_MESSAGE_GET_RUNTIME_OPS
END SUBROUTINE GRIB2_MESSAGE_RUNTIME


SUBROUTINE GRIB2_MESSAGE_FREE( THIS, VERBOSE )
Expand Down
51 changes: 50 additions & 1 deletion src/ecom/grib_info/grib2/grib2_factory_mod.F90
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
!>
!> @file grib2_factory_mod.F90
!>
!> @brief Module containing the factory function for creating or initializing GRIB2 sections.
!>
!> The `GRIB2_FACTORY_MOD` provides a factory function that creates or initializes
!> GRIB2 sections from 0 to 6, using their respective section-specific factories.
!> The factory function initializes GRIB sections based on the provided parameters,
!> section ID, and configuration. This module is equipped with debugging, logging,
!> and tracing capabilities that can be enabled during runtime if needed.
!>

! Include preprocessor utils
#include "output_manager_preprocessor_utils.h"
#include "output_manager_preprocessor_trace_utils.h"
Expand All @@ -21,7 +33,44 @@ MODULE GRIB2_FACTORY_MOD

CONTAINS


!>
!> @brief Factory function for creating or initializing GRIB2 sections.
!>
!> This function serves as the main factory for creating or initializing GRIB2 sections,
!> selecting the appropriate factory function for each section based on the provided `SEC` value.
!> It initializes a GRIB section object (`GRIB_SECTION`) using model parameters,
!> section ID, and YAML configuration. Debugging, logging, and tracing functionalities
!> are available if verbose mode is enabled.
!>
!> @param [inout] GRIB_SECTION Pointer to the GRIB section object to be created or initialized.
!> Must be of type `GRIB_SECTION_BASE_A`.
!> @param [in] PARAMS Model parameters structure of type `MODEL_PAR_T`.
!> @param [in] SEC Integer indicating the section number (0 to 6) to be initialized.
!> @param [in] ID Integer identifier for the GRIB2 section object.
!> @param [in] CFG YAML configuration object used to configure the GRIB2 section.
!> @param [in] VERBOSE Logical flag indicating whether verbose output is enabled (`.TRUE.`)
!> for debugging purposes.
!>
!> @return Integer error code (`RET`) indicating success or failure of the operation.
!> Possible values:
!> - `0`: Success
!> - `1`: Failure
!>
!> @section local dependencies
!> - @dependency [PARAMETER] OM_CORE_MOD::JPIB_K
!> - @dependency [PROCEDURE] GRIB2_SECTION0_FACTORY_MOD::GRIB2_SECTION0_FACTORY
!> - @dependency [PROCEDURE] GRIB2_SECTION1_FACTORY_MOD::GRIB2_SECTION1_FACTORY
!> - @dependency [PROCEDURE] GRIB2_SECTION2_FACTORY_MOD::GRIB2_SECTION2_FACTORY
!> - @dependency [PROCEDURE] GRIB2_SECTION3_FACTORY_MOD::GRIB2_SECTION3_FACTORY
!> - @dependency [PROCEDURE] GRIB2_SECTION4_FACTORY_MOD::GRIB2_SECTION4_FACTORY
!> - @dependency [PROCEDURE] GRIB2_SECTION5_FACTORY_MOD::GRIB2_SECTION5_FACTORY
!> - @dependency [PROCEDURE] GRIB2_SECTION6_FACTORY_MOD::GRIB2_SECTION6_FACTORY
!> - @dependency [TYPE] YAML_CORE_UTILS_MOD::YAML_CONFIGURATION_T
!> - @dependency [TYPE] OM_DATA_TYPES_MOD::MODEL_PAR_T
!> - @dependency [*] PP_DEBUG_USE_VARS::*
!> - @dependency [*] PP_LOG_USE_VARS::*
!> - @dependency [*] PP_TRACE_USE_VARS::*
!>
#define PP_PROCEDURE_TYPE 'FUNCTION'
#define PP_PROCEDURE_NAME 'GRIB2_SECTION5_FACTORY'
FUNCTION GRIB2_FACTORY( GRIB_SECTION, PARAMS, SEC, ID, CFG, VERBOSE ) RESULT(RET)
Expand Down
Loading

0 comments on commit 2d0e1f9

Please sign in to comment.