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

Philippe 05/09/2019: IO: Z-split files: to prevent serialization between...

Philippe 05/09/2019: IO: Z-split files: to prevent serialization between files, nmnhversion is taken from the main file
parent 37f41d25
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
! P. Wautelet 13/12/2018: extracted from mode_io.f90 ! P. Wautelet 13/12/2018: extracted from mode_io.f90
! P. Wautelet 14/12/2018: added IO_Filename_construct ! P. Wautelet 14/12/2018: added IO_Filename_construct
! P. Wautelet 05/03/2019: rename IO subroutines and modules ! P. Wautelet 05/03/2019: rename IO subroutines and modules
! P. Wautelet 05/09/2019: IO_Mnhversion_get: Z-split files: to prevent serialization between files,
! nmnhversion is taken from the main file
!----------------------------------------------------------------- !-----------------------------------------------------------------
module mode_io_tools module mode_io_tools
...@@ -117,58 +119,59 @@ subroutine IO_Mnhversion_get(tpfile) ...@@ -117,58 +119,59 @@ subroutine IO_Mnhversion_get(tpfile)
if ( trim(tpfile%cmode) /= 'READ' ) & if ( trim(tpfile%cmode) /= 'READ' ) &
call print_msg(NVERB_FATAL,'IO','IO_Mnhversion_get',trim(tpfile%cname)// 'not opened in read mode') call print_msg(NVERB_FATAL,'IO','IO_Mnhversion_get',trim(tpfile%cname)// 'not opened in read mode')
imnhversion(:) = 0 if ( .not. associated( tpfile%tmainfile ) ) then
!use tzfield because tfieldlist could be not initialised imnhversion(:) = 0
tzfield%cmnhname = 'MNHVERSION' !use tzfield because tfieldlist could be not initialised
tzfield%cstdname = '' tzfield%cmnhname = 'MNHVERSION'
tzfield%clongname = 'MesoNH version' tzfield%cstdname = ''
tzfield%cunits = '' tzfield%clongname = 'MesoNH version'
tzfield%cdir = '--' tzfield%cunits = ''
tzfield%ccomment = '' tzfield%cdir = '--'
tzfield%ngrid = 0 tzfield%ccomment = ''
tzfield%ntype = TYPEINT tzfield%ngrid = 0
tzfield%ndims = 1 tzfield%ntype = TYPEINT
tzfield%ltimedep = .false. tzfield%ndims = 1
call IO_Field_read(tpfile,tzfield,imnhversion,iresp) tzfield%ltimedep = .false.
if (iresp/=0) then call IO_Field_read(tpfile,tzfield,imnhversion,iresp)
tzfield%cmnhname = 'MASDEV'
tzfield%clongname = 'MesoNH version (without bugfix)'
tzfield%ndims = 0
call IO_Field_read(tpfile,tzfield,imasdev,iresp)
if (iresp/=0) then if (iresp/=0) then
call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','unknown MASDEV version for '//trim(tpfile%cname)) tzfield%cmnhname = 'MASDEV'
else tzfield%clongname = 'MesoNH version (without bugfix)'
if (imasdev<100) then tzfield%ndims = 0
imnhversion(1)=imasdev/10 call IO_Field_read(tpfile,tzfield,imasdev,iresp)
imnhversion(2)=mod(imasdev,10) if (iresp/=0) then
else !for example for mnh 4.10 call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','unknown MASDEV version for '//trim(tpfile%cname))
imnhversion(1)=imasdev/100 else
imnhversion(2)=mod(imasdev,100) if (imasdev<100) then
imnhversion(1)=imasdev/10
imnhversion(2)=mod(imasdev,10)
else !for example for mnh 4.10
imnhversion(1)=imasdev/100
imnhversion(2)=mod(imasdev,100)
end if
end if
!
tzfield%cmnhname = 'BUGFIX'
tzfield%clongname = 'MesoNH bugfix number'
call IO_Field_read(tpfile,tzfield,ibugfix,iresp)
if (iresp/=0) then
call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','unknown BUGFIX version for '//trim(tpfile%cname))
else
imnhversion(3)=ibugfix
end if end if
end if end if
! !
tzfield%cmnhname = 'BUGFIX' write(ymnhversion_file,"( I0,'.',I0,'.',I0 )" ) imnhversion(1),imnhversion(2),imnhversion(3)
tzfield%clongname = 'MesoNH bugfix number' write(ymnhversion_curr,"( I0,'.',I0,'.',I0 )" ) nmnhversion(1),nmnhversion(2),nmnhversion(3)
call IO_Field_read(tpfile,tzfield,ibugfix,iresp) !
if (iresp/=0) then if ( imnhversion(1)==0 .and. imnhversion(2)==0 .and. imnhversion(3)==0 ) then
call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','unknown BUGFIX version for '//trim(tpfile%cname)) call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','file '//trim(tpfile%cname)//&
else ' was written with an unknown version of MesoNH')
imnhversion(3)=ibugfix
end if
end if
!
write(ymnhversion_file,"( I0,'.',I0,'.',I0 )" ) imnhversion(1),imnhversion(2),imnhversion(3)
write(ymnhversion_curr,"( I0,'.',I0,'.',I0 )" ) nmnhversion(1),nmnhversion(2),nmnhversion(3)
!
if ( imnhversion(1)==0 .and. imnhversion(2)==0 .and. imnhversion(3)==0 ) then
call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','file '//trim(tpfile%cname)//&
' was written with an unknown version of MesoNH')
else if ( imnhversion(1)< nmnhversion(1) .or. & else if ( imnhversion(1)< nmnhversion(1) .or. &
(imnhversion(1)==nmnhversion(1) .and. imnhversion(2)< nmnhversion(2)) .or. & (imnhversion(1)==nmnhversion(1) .and. imnhversion(2)< nmnhversion(2)) .or. &
(imnhversion(1)==nmnhversion(1) .and. imnhversion(2)==nmnhversion(2) .and. imnhversion(3)<nmnhversion(3)) ) then (imnhversion(1)==nmnhversion(1) .and. imnhversion(2)==nmnhversion(2) .and. imnhversion(3)<nmnhversion(3)) ) then
call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','file '//trim(tpfile%cname)//& call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','file '//trim(tpfile%cname)//&
' was written with an older version of MesoNH ('//trim(ymnhversion_file)//& ' was written with an older version of MesoNH ('//trim(ymnhversion_file)//&
' instead of '//trim(ymnhversion_curr)//')') ' instead of '//trim(ymnhversion_curr)//')')
else if ( imnhversion(1)> nmnhversion(1) .or. & else if ( imnhversion(1)> nmnhversion(1) .or. &
(imnhversion(1)==nmnhversion(1) .and. imnhversion(2)> nmnhversion(2)) .or. & (imnhversion(1)==nmnhversion(1) .and. imnhversion(2)> nmnhversion(2)) .or. &
(imnhversion(1)==nmnhversion(1) .and. imnhversion(2)==nmnhversion(2) .and. imnhversion(3)>nmnhversion(3)) ) then (imnhversion(1)==nmnhversion(1) .and. imnhversion(2)==nmnhversion(2) .and. imnhversion(3)>nmnhversion(3)) ) then
...@@ -177,10 +180,15 @@ subroutine IO_Mnhversion_get(tpfile) ...@@ -177,10 +180,15 @@ subroutine IO_Mnhversion_get(tpfile)
' instead of '//trim(ymnhversion_curr)//')') ' instead of '//trim(ymnhversion_curr)//')')
else else
call print_msg(NVERB_DEBUG,'IO','IO_Mnhversion_get','file '//trim(tpfile%cname)//& call print_msg(NVERB_DEBUG,'IO','IO_Mnhversion_get','file '//trim(tpfile%cname)//&
' was written with the same version of MesoNH ('//trim(ymnhversion_curr)//')') ' was written with the same version of MesoNH ('//trim(ymnhversion_curr)//')')
end if end if
! !
tpfile%nmnhversion(:) = imnhversion(:) tpfile%nmnhversion(:) = imnhversion(:)
else ! associated( tpfile%tmainfile )
if ( .not. tpfile%tmainfile%lopened ) &
call Print_msg( NVERB_FATAL, 'IO', 'IO_Mnhversion_get', 'tmainfile should be opened' )
tpfile%nmnhversion(:) = tpfile%tmainfile%nmnhversion(:)
end if
end subroutine IO_Mnhversion_get end subroutine IO_Mnhversion_get
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment