Skip to content

Commit

Permalink
GitHub Issue NOAA-EMC#566 A quick enhancement for clipping negative m…
Browse files Browse the repository at this point in the history
…oisture values in the analysis of EnKF for FV3-LAM
  • Loading branch information
TingLei-daprediction committed May 4, 2023
1 parent dee603d commit 243d01c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/enkf/gridio_fv3reg.f90
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,10 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid
varstrname = 'sphum'
call fv3lamfile%get_idfn(varstrname,file_id,fv3filename)
call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d)
if ( cliptracers ) then ! set cliptracers to remove negative hydrometers
clip = tiny(qworkvar3d(1,1,1))
where (qworkvar3d < clip) qworkvar3d = clip
end if
tvworkvar3d=tsenworkvar3d*(one+fv*qworkvar3d)
tvworkvar3d=tvworkvar3d+workinc3d
if(q_ind > 0) then
Expand All @@ -866,6 +870,10 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid
enddo
enddo
qworkvar3d=qworkvar3d+workinc3d
if ( cliptracers ) then ! set cliptracers to remove negative hydrometers
clip = tiny(qworkvar3d(1,1,1))
where (qworkvar3d < clip) qworkvar3d = clip
end if
endif
tsenworkvar3d=tvworkvar3d/(one+fv*qworkvar3d)
varstrname = 'T'
Expand Down Expand Up @@ -2173,6 +2181,10 @@ subroutine writegriddata_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_inflat
enddo

if(iope ==0 ) then
if ( cliptracers ) then ! set cliptracers to remove negative hydrometers
clip = tiny(qworkvar3d(1,1,1))
where (qworkvar3d < clip) qworkvar3d = clip
end if
tvworkvar3d=tsenworkvar3d*(one+fv*qworkvar3d)
tvworkvar3d=tvworkvar3d+workinc3d
if(q_ind > 0) then
Expand All @@ -2186,6 +2198,10 @@ subroutine writegriddata_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_inflat
enddo
enddo
qworkvar3d=qworkvar3d+workinc3d
if ( cliptracers ) then ! set cliptracers to remove negative hydrometers
clip = tiny(qworkvar3d(1,1,1))
where (qworkvar3d < clip) qworkvar3d = clip
end if
endif
tsenworkvar3d=tvworkvar3d/(one+fv*qworkvar3d)
endif
Expand Down

0 comments on commit 243d01c

Please sign in to comment.