Skip to content

Commit

Permalink
Fix write_incr (NOAA-EMC#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
jderber-NOAA authored and TingLei-daprediction committed May 23, 2023
1 parent 1eaf5da commit 0fee5e3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/gsi/write_incr.f90
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ subroutine write_fv3_inc_ (grd,sp_a,filename,mype_out,gfs_bundle,ibin)
use general_sub2grid_mod, only: sub2grid_info

use gsi_bundlemod, only: gsi_bundle, gsi_bundlegetpointer
use gsi_bundlemod, only: assignment(=)
use control_vectors, only: control_vector

use constants, only: one, rad2deg, r1000
Expand Down Expand Up @@ -158,7 +159,6 @@ subroutine write_fv3_inc_ (grd,sp_a,filename,mype_out,gfs_bundle,ibin)
! set up state space based off of xhatsave
! Convert from control space directly to physical
! space for comparison with obs.
call allocate_preds(sbiasinc)
do iii=1,nobs_bins
call allocate_state(svalinc(iii))
end do
Expand All @@ -168,7 +168,10 @@ subroutine write_fv3_inc_ (grd,sp_a,filename,mype_out,gfs_bundle,ibin)
do iii=1,ntlevs_ens
call allocate_state(evalinc(iii))
end do

call allocate_preds(sbiasinc)
call control2state(xhatsave,mvalinc,sbiasinc)
call deallocate_preds(sbiasinc)

if (l4dvar) then
if (l_hyb_ens) then
Expand All @@ -193,6 +196,12 @@ subroutine write_fv3_inc_ (grd,sp_a,filename,mype_out,gfs_bundle,ibin)
end do
end if
end if
do iii=1,ntlevs_ens
call deallocate_state(evalinc(iii))
end do
do iii=1,nsubwin
call deallocate_state(mvalinc(iii))
end do

! Check hydrometeors in control variables
iql = getindex(svars3d,'ql')
Expand Down Expand Up @@ -527,6 +536,10 @@ subroutine write_fv3_inc_ (grd,sp_a,filename,mype_out,gfs_bundle,ibin)
endif
! ! cleanup and exit
call nccheck_incr(nf90_close(ncid_out))
deallocate(out3d)
do iii=1,nobs_bins
call deallocate_state(svalinc(iii))
end do
if ( mype == mype_out ) then
write(6,*) "FV3 netCDF increment written, file= "//trim(filename)//".nc"
end if
Expand Down

0 comments on commit 0fee5e3

Please sign in to comment.