diff --git a/src/gsi/setuprad.f90 b/src/gsi/setuprad.f90 index 7f001ea9c..a5b2a6b28 100644 --- a/src/gsi/setuprad.f90 +++ b/src/gsi/setuprad.f90 @@ -2108,7 +2108,7 @@ subroutine setuprad(obsLL,odiagLL,lunin,mype,aivals,stats,nchanl,nreal,nobs,& deallocate(diagbufchan) deallocate(sc_index) - if (rad_diagsave) then + if (rad_diagsave .and. nchanl_diag > 0) then if (netcdf_diag) call nc_diag_write if(binary_diag) call final_binary_diag_ if (lextra .and. allocated(diagbufex)) deallocate(diagbufex)