Skip to content

Commit

Permalink
Merge pull request NOAA-EMC#8 from ClaraDraper-NOAA/bugfix2mDA
Browse files Browse the repository at this point in the history
Bugfix2m da
  • Loading branch information
jswhit committed Sep 23, 2022
2 parents 4002db4 + 29cca95 commit 5f08c29
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/enkf/readconvobs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ subroutine get_num_convobs_nc(obspath,datestring,num_obs_tot,num_obs_totdiag,id)
do i = 1, nobs_curr

ityp = Observation_Type(i)
sfctype=(ityp>179.and.ityp<190).or.(ityp>=192.and.ityp<=199)
sfctype =( ityp==181 .or. ityp==183 .or. ityp==187 )

errorlimit2=errorlimit2_obs

Expand Down Expand Up @@ -669,7 +669,7 @@ subroutine get_convobs_data_nc(obspath, datestring, nobs_max, nobs_maxdiag, &

do i = 1, nobs
ityp = Observation_Type(i)
sfctype=(ityp>179.and.ityp<190).or.(ityp>=192.and.ityp<=199)
sfctype =( ityp==181 .or. ityp==183 .or. ityp==187 )
nobdiag = nobdiag + 1
! special handling for error limits for GPS bend angle
if (obtype == 'gps') then
Expand Down
18 changes: 12 additions & 6 deletions src/gsi/setupt.f90
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ subroutine setupt(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav

logical,dimension(nobs):: luse,muse
integer(i_kind),dimension(nobs):: ioid ! initial (pre-distribution) obs ID
logical sfctype
logical sfctype, landsfctype
logical iqtflg
logical aircraftobst
logical duplogic
Expand Down Expand Up @@ -447,6 +447,11 @@ subroutine setupt(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav
ikx=nint(data(ikxx,k))
itype=ictype(ikx)
sfctype=(itype>179.and.itype<190).or.(itype>=192.and.itype<=199)
! landsfctype below is used to restrict hofx_2m_sfcfile to land obs only.
! GDAS assmilates 180 and 182 over ocean. Would probably be better to read h(x) from
! the surface file for these, but have left as is (default is LML) for zero-diff
! changes.
landsfctype =( itype==181 .or. itype==183 .or. itype==187 )
do l=k+1,nobs
if (twodvar_regional .or. (hofx_2m_sfcfile .and. sfctype) ) then
duplogic=data(ilat,k) == data(ilat,l) .and. &
Expand Down Expand Up @@ -677,17 +682,17 @@ subroutine setupt(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav
call tintrp2a1(ges_lnprsl,prsltmp,dlat,dlon,dtime,hrdifsig,&
nsig,mype,nfldsig)

if ( .not. hofx_2m_sfcfile) then
if ( hofx_2m_sfcfile .and. landsfctype) then
drpx = zero
dpres = one ! put obs at surface
else
drpx=zero
if(sfctype .and. .not.twodvar_regional) then
drpx=abs(one-((one/exp(dpres-log(psges))))**rd_over_cp)*t0c
end if

! Put obs pressure in correct units to get grid coord. number
call grdcrd1(dpres,prsltmp(1),nsig,-1)
else
drpx = zero
dpres = one ! put obs at surface
endif

! Implementation of forward model ----------
Expand Down Expand Up @@ -723,7 +728,7 @@ subroutine setupt(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav
prsltmp2(2), tvtmp(2), qtmp(2), hsges(1), roges, msges, &
f10ges,u10ges,v10ges, t2ges, q2ges, regime, iqtflg)
tges = t2ges
elseif (sfctype .and. hofx_2m_sfcfile ) then
elseif (landsfctype .and. hofx_2m_sfcfile ) then
! SCENARIO 2: obs is sfctype, and hofx_2m_sfcfile scheme is on.
! 2m forecast has been read from the sfc guess files

Expand Down Expand Up @@ -810,6 +815,7 @@ subroutine setupt(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav
endif
end if


! SCENARIO 4: obs is sfctype, and i_use_2mt4b flag is on (turns on LAM sfc DA)
if(i_use_2mt4b>0 .and. sfctype) then

Expand Down
6 changes: 3 additions & 3 deletions src/gsi/update_guess.f90
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ subroutine update_guess(sval,sbias)
use mpimod, only: mype
use constants, only: zero,one,fv,max_varname_length,qmin,qcmin,tgmin,&
r100,one_tenth,tiny_r_kind
use jfunc, only: iout_iter,bcoption,tsensible,clip_supersaturation,superfact
use jfunc, only: iout_iter,bcoption,tsensible,clip_supersaturation,superfact,hofx_2m_sfcfile
use gridmod, only: lat2,lon2,nsig,&
regional,twodvar_regional,regional_ozone,&
l_reg_update_hydro_delz
Expand Down Expand Up @@ -454,15 +454,15 @@ subroutine update_guess(sval,sbias)
endif
call gsd_update_soil_tq(tinc_1st,is_t,qinc_1st,is_q,it)
endif ! l_gsd_soilTQ_nudge
if ( (i_use_2mt4b > 0) .and. is_t>0) then
if ( (i_use_2mt4b > 0.or. hofx_2m_sfcfile) .and. is_t>0) then
do j=1,lon2
do i=1,lat2
tinc_1st(i,j)=p_tv(i,j,1)
end do
end do
call gsd_update_t2m(tinc_1st,it)
endif ! l_gsd_t2m_adjust
if (i_use_2mq4b > 0 .and. is_q>0) then
if ( (i_use_2mq4b > 0.or. hofx_2m_sfcfile) .and. is_q>0) then
do j=1,lon2
do i=1,lat2
qinc_1st(i,j)=p_q(i,j,1)
Expand Down

0 comments on commit 5f08c29

Please sign in to comment.