Skip to content

Commit

Permalink
Baseline some initial logic to remove 'checksum' from
Browse files Browse the repository at this point in the history
an existing file.

Fixes ufs-community#781.
  • Loading branch information
GeorgeGayno-NOAA committed Mar 14, 2023
1 parent 9cf134a commit 884a0c2
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions sorc/global_cycle.fd/read_write_data.f90
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ subroutine write_data(lensfc,idim,jdim,lsoil, &
dum2d = reshape(slifcs, (/idim,jdim/))
error = nf90_put_var( ncid, id_var, dum2d)
call netcdf_err(error, 'writing slmsk record' )

call remove_checksum(ncid, id_var)

endif

if(present(tsffcs)) then
Expand Down Expand Up @@ -573,6 +576,31 @@ subroutine write_data(lensfc,idim,jdim,lsoil, &

end subroutine write_data

subroutine remove_checksum(ncid, id_var)

implicit none

integer, intent(in) :: ncid, id_var

integer :: error

error=nf90_inquire_attribute(ncid, id_var, 'checksum')

if (error == 0) then ! attribute was found

error = nf90_redef(ncid)
call netcdf_err(error, 'entering define mode' )

error=nf90_del_att(ncid, id_var, 'checksum')
call netcdf_err(error, 'deleting checksum' )

error= nf90_enddef(ncid)
call netcdf_err(error, 'ending define mode' )

endif

end subroutine remove_checksum

!> Read latitude and longitude for the cubed-sphere tile from the
!! 'grid' file. Read the filtered and unfiltered orography from
!! the 'orography' file.
Expand Down

0 comments on commit 884a0c2

Please sign in to comment.