Skip to content

Commit 884a0c2

Browse files
Baseline some initial logic to remove 'checksum' from
an existing file. Fixes ufs-community#781.
1 parent 9cf134a commit 884a0c2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

sorc/global_cycle.fd/read_write_data.f90

+28
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ subroutine write_data(lensfc,idim,jdim,lsoil, &
177177
dum2d = reshape(slifcs, (/idim,jdim/))
178178
error = nf90_put_var( ncid, id_var, dum2d)
179179
call netcdf_err(error, 'writing slmsk record' )
180+
181+
call remove_checksum(ncid, id_var)
182+
180183
endif
181184

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

574577
end subroutine write_data
575578

579+
subroutine remove_checksum(ncid, id_var)
580+
581+
implicit none
582+
583+
integer, intent(in) :: ncid, id_var
584+
585+
integer :: error
586+
587+
error=nf90_inquire_attribute(ncid, id_var, 'checksum')
588+
589+
if (error == 0) then ! attribute was found
590+
591+
error = nf90_redef(ncid)
592+
call netcdf_err(error, 'entering define mode' )
593+
594+
error=nf90_del_att(ncid, id_var, 'checksum')
595+
call netcdf_err(error, 'deleting checksum' )
596+
597+
error= nf90_enddef(ncid)
598+
call netcdf_err(error, 'ending define mode' )
599+
600+
endif
601+
602+
end subroutine remove_checksum
603+
576604
!> Read latitude and longitude for the cubed-sphere tile from the
577605
!! 'grid' file. Read the filtered and unfiltered orography from
578606
!! the 'orography' file.

0 commit comments

Comments
 (0)