Skip to content

Commit

Permalink
Merge pull request #7 from thomas-robinson/doubleNC
Browse files Browse the repository at this point in the history
Checks for an extra .nc suffix on the file name of a history file.
  • Loading branch information
thomas-robinson authored Aug 5, 2019
2 parents faa5756 + e540e13 commit e2eae0a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions diag_manager/diag_manager.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3733,6 +3733,7 @@ SUBROUTINE closing_file(file, time)
IF ( mpp_pe() .EQ. mpp_root_pe() ) &
& CALL error_mesg('diag_manager_mod::closing_file', 'module/output_field ' //&
& TRIM(message)//', skip one time level, maybe send_data never called', WARNING)
status = writing_field(i, .TRUE.,message,time)
ELSE
status = writing_field(i, .TRUE., message, time)
END IF
Expand Down
13 changes: 13 additions & 0 deletions diag_manager/diag_output.F90
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,19 @@ SUBROUTINE diag_output_init(file_name, FORMAT, file_title, file_unit,&
else
fname_no_tile = trim(file_name)
endif
!> If there is a .nc suffix on the file name, remove the .nc
if (len(trim(fname_no_tile)) > 3 ) then
checkNC: do i = 3,len_file_name
if (fname_no_tile(i-2:i) == ".nc") then
fname_no_tile(i-2:i) = " "
exit checkNC
endif
enddo checkNC
endif
! trim(fname_no_tile)(len_file_name-3:len_file_name) == ".nc") write (6,*)trim(fname_no_tile)
! trim(fname_no_tile)(len(trim(fname_no_tile))-3:len(trim(fname_no_tile))) == ".nc") &
! trim(fname_no_tile)(len(trim(fname_no_tile))-3:len(trim(fname_no_tile))) = " "

!> Check to make sure that only domain2D or domainUG is used. If both are not null, then FATAL
if (domain .NE. NULL_DOMAIN2D .AND. domainU .NE. NULL_DOMAINUG)&
& CALL error_mesg('diag_output_init', "Domain2D and DomainUG can not be used at the same time in "//&
Expand Down
4 changes: 1 addition & 3 deletions diag_manager/diag_util.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2542,11 +2542,9 @@ SUBROUTINE diag_data_out(file, field, dat, time, final_call_in, static_write_in)
else
call error_mesg("diag_util_mod::diag_data_out","Error opening the file "//files(file)%name,fatal)
endif
! call diag_field_write ("time", dif, file_num=file, fileobjU=fileobjU, &
! fileobj=fileobj, fileobjND=fileobjND, fnum_for_domain=fnum_for_domain(file), time_in=files(file)%time_index)
elseif (dif < files(file)%rtime_current .and. .not.(static_write) ) then
call error_mesg("diag_util_mod::diag_data_out","The time for the file "//trim(files(file)%name)//&
" has gone backwards.",FATAL)
" has gone backwards. There may be missing values for some of the variables",NOTE)
endif
!> Write data
call diag_field_write (output_fields(field)%output_name, dat, static=static_write, file_num=file, fileobjU=fileobjU, &
Expand Down

0 comments on commit e2eae0a

Please sign in to comment.