Skip to content
Snippets Groups Projects
Commit 4c4324d7 authored by WAUTELET Philippe's avatar WAUTELET Philippe
Browse files

Philippe 03/02/2023: bugfix for Fill_tfieldmetadata: do not use optional dummy...

Philippe 03/02/2023: bugfix for Fill_tfieldmetadata: do not use optional dummy argument if not provided + bug correction for ndimlist if ngrid not provided
parent d09e33fc
No related branches found
No related tags found
No related merge requests found
...@@ -389,19 +389,20 @@ type(tfieldmetadata) function Fill_tfieldmetadata( cmnhname, cstdname, clongname ...@@ -389,19 +389,20 @@ type(tfieldmetadata) function Fill_tfieldmetadata( cmnhname, cstdname, clongname
! ndimlist ! ndimlist
if ( Present( ndimlist ) ) then if ( Present( ndimlist ) ) then
if ( Size( ndimlist ) /= ndims ) & if ( Size( ndimlist ) /= tpfield%ndims ) &
call Print_msg( NVERB_ERROR, 'GEN', 'Fill_tfielddata', 'ndimlist size different of ndims for variable ' // Trim( ymnhname ) ) call Print_msg( NVERB_ERROR, 'GEN', 'Fill_tfielddata', 'ndimlist size different of ndims for variable ' // Trim( ymnhname ) )
tpfield%ndimlist(1:ndims) = ndimlist(:) tpfield%ndimlist(1:tpfield%ndims) = ndimlist(:)
tpfield%ndimlist(ndims+1:) = NMNHDIM_UNUSED tpfield%ndimlist(tpfield%ndims+1:) = NMNHDIM_UNUSED
else else
!If ndimlist is not provided, it is possible to fill it if some information is available !If ndimlist is not provided, it is possible to fill it if some information is available
if ( Present( cdir ) ) then if ( Present( cdir ) ) then
if ( cdir == 'XY' ) then if ( cdir == 'XY' ) then
if ( ndims == 2 ) then ! Check also on NGRIDUNKNOWN (this happens if the optional ngrid argument is not provided)
tpfield%ndimlist(1:2) = NMNHDIM_ARAKAWA(ngrid,1:2) if ( tpfield%ndims == 2 .and. tpfield%ngrid /= NGRIDUNKNOWN ) then
else if ( ndims == 3 ) then tpfield%ndimlist(1:2) = NMNHDIM_ARAKAWA(tpfield%ngrid,1:2)
tpfield%ndimlist(1:3) = NMNHDIM_ARAKAWA(ngrid,1:3) else if ( tpfield%ndims == 3 .and. tpfield%ngrid /= NGRIDUNKNOWN ) then
tpfield%ndimlist(1:3) = NMNHDIM_ARAKAWA(tpfield%ngrid,1:3)
else else
call Print_msg( NVERB_DEBUG, 'GEN', 'Fill_tfielddata', 'ndimlist not filled for variable ' // Trim( ymnhname ) ) call Print_msg( NVERB_DEBUG, 'GEN', 'Fill_tfielddata', 'ndimlist not filled for variable ' // Trim( ymnhname ) )
end if end if
...@@ -414,14 +415,14 @@ type(tfieldmetadata) function Fill_tfieldmetadata( cmnhname, cstdname, clongname ...@@ -414,14 +415,14 @@ type(tfieldmetadata) function Fill_tfieldmetadata( cmnhname, cstdname, clongname
end if end if
if ( Present( ltimedep ) ) then if ( Present( ltimedep ) ) then
if ( ltimedep ) then if ( ltimedep ) then
if ( ndims == NMNHMAXDIMS ) & if ( tpfield%ndims == NMNHMAXDIMS ) &
call Print_msg( NVERB_ERROR, 'GEN', 'Fill_tfielddata', & call Print_msg( NVERB_ERROR, 'GEN', 'Fill_tfielddata', &
'ltimedep=T not possible if ndims=NMNHMAXDIMS for variable ' // Trim( ymnhname ) ) 'ltimedep=T not possible if ndims=NMNHMAXDIMS for variable ' // Trim( ymnhname ) )
!Set this dimension only if ndimlist already filled up or ndims = 0 !Set this dimension only if ndimlist already filled up or tpfield%ndims = 0
if ( ndims == 0 ) then if ( tpfield%ndims == 0 ) then
tpfield%ndimlist( ndims + 1 ) = NMNHDIM_TIME tpfield%ndimlist( tpfield%ndims + 1 ) = NMNHDIM_TIME
else if ( tpfield%ndimlist(ndims) /= NMNHDIM_UNKNOWN ) then else if ( tpfield%ndimlist(tpfield%ndims) /= NMNHDIM_UNKNOWN ) then
tpfield%ndimlist( ndims + 1 ) = NMNHDIM_TIME tpfield%ndimlist( tpfield%ndims + 1 ) = NMNHDIM_TIME
end if end if
end if end if
end if end if
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment