Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/framework/mpas_io_streams.F
Original file line number Diff line number Diff line change
Expand Up @@ -4176,6 +4176,7 @@ end subroutine MPAS_readStreamAtt_text


logical function MPAS_checkStreamAtt(stream, attName, ierr)
! Returns .true. if we can write the attribute.

implicit none

Expand All @@ -4195,6 +4196,12 @@ logical function MPAS_checkStreamAtt(stream, attName, ierr)
if (present(ierr)) ierr = MPAS_STREAM_NOT_INITIALIZED
return
end if
if (.not. stream % fileHandle % data_mode) then
! Can always write an attribute in define mode.
STREAM_DEBUG_WRITE('Able to write attribute "' // trim(attName) // '" in define mode.')
MPAS_checkStreamAtt = .true.
return
endif
call MPAS_io_has_att(stream % fileHandle, attName, ierr=io_err)
if(io_err /= 0) then
return
Expand Down Expand Up @@ -4226,10 +4233,7 @@ subroutine MPAS_writeStreamAtt_0dInteger(stream, attName, attValue, syncVal, ier
if (present(ierr)) ierr = MPAS_STREAM_NOT_INITIALIZED
return
end if
call MPAS_io_has_att(stream % fileHandle, attName, ierr=io_err)
if(io_err /= 0) then
return
endif

call MPAS_io_put_att(stream % fileHandle, attName, attValue, syncVal=syncVal, ierr=io_err)
call MPAS_io_err_mesg(stream % fileHandle % ioContext, io_err, .false.)
if (io_err /= MPAS_IO_NOERR .and. present(ierr)) ierr = MPAS_IO_ERR
Expand Down