Skip to content

Commit

Permalink
Revert remapping for sol fields
Browse files Browse the repository at this point in the history
  • Loading branch information
MircoValentiniECMWF committed Aug 11, 2024
1 parent a59628a commit 04edf26
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
18 changes: 17 additions & 1 deletion src/ecom/encoders/grib2/grib_encoder_grib2_gg_s_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ FUNCTION ENCODER_GRIB2_GG_S_ENCODE_ATM( THIS, MODEL_PARAMS, GRIB_INFO, &

ILPARAM = COMPUTE_PARAM_GRIBX_ATM( MODEL_PARAMS, GRIB_INFO, MSG, THIS%CLTYPE_, METADATA )

! TOWIL Hacks until we use multi-level soil parameters etc
#if defined(NEW_SOL_ENCODING)
SELECT CASE (ILPARAM)
CASE( NGRBMX2T3, NGRBMN2T3, NGRB10FG3, &
& NGRB10FG6, &
Expand All @@ -415,6 +415,22 @@ FUNCTION ENCODER_GRIB2_GG_S_ENCODE_ATM( THIS, MODEL_PARAMS, GRIB_INFO, &
PP_METADATA_SET( METADATA, 'paramId',ILPARAM)
ENDIF
END SELECT
#else
SELECT CASE (ILPARAM)
CASE( NGRBMX2T3, NGRBMN2T3, NGRB10FG3, &
& NGRB10FG6, &
& 35,36,37,38, &
& 39,40,41,42, &
& 139,170,183,236, &
& 200001:200999, & ! Class 4i & me, see above
& 80) ! See sekf_write.F90
PP_METADATA_SET( METADATA, 'paramIdECMF',ILPARAM)
CASE DEFAULT
IF(ILPARAM .NE. 128) THEN
PP_METADATA_SET( METADATA, 'paramId',ILPARAM)
ENDIF
END SELECT
#endif

! Trace end of procedure (on success)
PP_METADATA_EXIT_PROCEDURE( METADATA )
Expand Down
26 changes: 25 additions & 1 deletion src/ecom/encoders/utils/runtime/levels_runtime_utils_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ SUBROUTINE SET_SOL_ICE_LEVEL_GRIBX_ATM( MODEL_PARAMS, GRIB_INFO, MSG, METADATA )
PP_TRACE_ENTER_PROCEDURE()
PP_METADATA_ENTER_PROCEDURE( METADATA )

#if defined(NEW_SOL_ENCODING)
! Mapping levels
SELECT CASE ( MSG%PARAM_ID_ )
CASE (35)
Expand All @@ -633,6 +634,17 @@ SUBROUTINE SET_SOL_ICE_LEVEL_GRIBX_ATM( MODEL_PARAMS, GRIB_INFO, MSG, METADATA )
PP_METADATA_SET( METADATA, 'scaledValueOfSecondFixedSurface', LEVEL )

PP_METADATA_SET( METADATA, 'level', LEVEL ) ! level must be defined at the end
#else
! Set type of level
PP_METADATA_SET( METADATA, 'typeOfFirstFixedSurface', INT(1,JPIB_K) )
PP_METADATA_SET_MISSING( METADATA, 'scaleFactorOfFirstFixedSurface' )
PP_METADATA_SET_MISSING( METADATA, 'scaledValueOfFirstFixedSurface' )
PP_METADATA_SET( METADATA, 'typeOfSecondFixedSurface', INT(255,JPIB_K) )
PP_METADATA_SET_MISSING( METADATA, 'scaleFactorOfSecondFixedSurface' )
PP_METADATA_SET_MISSING( METADATA, 'scaledValueOfSecondFixedSurface' )
! Set level
PP_METADATA_SET( METADATA, 'level', INT(0,JPIB_K) )
#endif

! Trace end of procedure (on success)
PP_METADATA_EXIT_PROCEDURE( METADATA )
Expand Down Expand Up @@ -713,6 +725,7 @@ SUBROUTINE SET_SOL_SOIL_LEVEL_GRIBX_ATM( MODEL_PARAMS, GRIB_INFO, MSG, METADATA
PP_TRACE_ENTER_PROCEDURE()
PP_METADATA_ENTER_PROCEDURE( METADATA )

#if defined(NEW_SOL_ENCODING)
! Mapping levels
SELECT CASE ( MSG%PARAM_ID_ )
CASE (39,139)
Expand All @@ -735,8 +748,19 @@ SUBROUTINE SET_SOL_SOIL_LEVEL_GRIBX_ATM( MODEL_PARAMS, GRIB_INFO, MSG, METADATA
PP_METADATA_SET( METADATA, 'scaledValueOfSecondFixedSurface', LEVEL )

PP_METADATA_SET( METADATA, 'level', LEVEL ) ! level must be defined at the end
#else
! Set type of level
PP_METADATA_SET( METADATA, 'typeOfFirstFixedSurface', INT(1,JPIB_K) )
PP_METADATA_SET_MISSING( METADATA, 'scaleFactorOfFirstFixedSurface' )
PP_METADATA_SET_MISSING( METADATA, 'scaledValueOfFirstFixedSurface' )
PP_METADATA_SET( METADATA, 'typeOfSecondFixedSurface', INT(255,JPIB_K) )
PP_METADATA_SET_MISSING( METADATA, 'scaleFactorOfSecondFixedSurface' )
PP_METADATA_SET_MISSING( METADATA, 'scaledValueOfSecondFixedSurface' )
! Set level
PP_METADATA_SET( METADATA, 'level', INT(0,JPIB_K) )
#endif


! ENDIF

! Trace end of procedure (on success)
PP_METADATA_EXIT_PROCEDURE( METADATA )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ FUNCTION COMPUTE_PARAM_GRIBX_ATM( MODEL_PARAMS, GRIB_INFO, MSG, CDTYPE, METADAT
CASE( 'sg', 'sf' )
IF( ITABLE .EQ. 128 ) IPARAM = 129000 + IPARAM


CASE DEFAULT
IF( ITABLE .NE. 128 ) IPARAM = ITABLE*1000 + IPARAM
#if defined(NEW_SOL_ENCODING)
SELECT CASE (IPARAM)
CASE (35,36,37,38)
IPARAM = 262024
Expand All @@ -261,9 +261,9 @@ FUNCTION COMPUTE_PARAM_GRIBX_ATM( MODEL_PARAMS, GRIB_INFO, MSG, CDTYPE, METADAT
CASE (139,170,183,236)
IPARAM = 260360
END SELECT
#endif
END SELECT


! Trace end of procedure (on success)
PP_METADATA_EXIT_PROCEDURE( METADATA )
PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS()
Expand Down

0 comments on commit 04edf26

Please sign in to comment.