From 922a5c450f587843dcbd4f3ba0e05237b1a7e935 Mon Sep 17 00:00:00 2001 From: "Guoqing.Ge" Date: Mon, 3 Oct 2022 20:34:31 -0600 Subject: [PATCH 1/6] bug fix on latest merge of EMC develop and 2mDA --- src/gsi/general_read_gfsatm.f90 | 269 +++++++++++++++++++++++--------- src/gsi/netcdfgfs_io.f90 | 15 +- src/gsi/setupt.f90 | 4 +- 3 files changed, 202 insertions(+), 86 deletions(-) diff --git a/src/gsi/general_read_gfsatm.f90 b/src/gsi/general_read_gfsatm.f90 index 744fcf3d8d..b3e3e13938 100755 --- a/src/gsi/general_read_gfsatm.f90 +++ b/src/gsi/general_read_gfsatm.f90 @@ -1959,7 +1959,7 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & use gsi_bundlemod, only: gsi_bundlegetpointer use module_ncio, only: Dataset, Variable, Dimension, open_dataset,& close_dataset, get_dim, read_vardata,get_idate_from_time_units - use gfsreadmod, only: general_reload + use gfsreadmod, only: general_reload, general_2m_reload implicit none @@ -1977,6 +1977,7 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & real(r_kind),pointer,dimension(:,:) :: ptr2d real(r_kind),pointer,dimension(:,:,:) :: ptr3d real(r_kind),pointer,dimension(:,:) :: g_ps + real(r_kind),pointer,dimension(:,:) :: g_t2m, g_q2m real(r_kind),pointer,dimension(:,:,:) :: g_vor,g_div,& g_cwmr,g_q,g_oz,g_tv @@ -2011,8 +2012,7 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & logical,dimension(1) :: vector type(Dataset) :: atmges type(Dimension) :: ncdim - - + logical :: read_2m, read_z !****************************************************************************** ! Initialize variables used below @@ -2026,6 +2026,20 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & mype_use=-1 icount=0 procuse=.false. + + if (filename(1:3) == 'sfc') then + read_2m = .true. + read_z = .false. + if ( mype == 0 ) write(6,* ) & + trim(my_name), ': reading 2m variables from ', trim(filename) + else + read_2m = .false. + read_z = zflag + if ( mype == 0 ) write(6,* ) & + trim(my_name), ': reading atmos variables from ', trim(filename) + endif + + if ( mype == 0 ) procuse = .true. do i=1,npe if ( grd%recvcounts_s(i-1) > 0 ) then @@ -2064,6 +2078,7 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & ! get dimension sizes ncdim = get_dim(atmges, 'grid_xt'); lonb = ncdim%len ncdim = get_dim(atmges, 'grid_yt'); latb = ncdim%len + if (.not. read_2m) & ncdim = get_dim(atmges, 'pfull'); levs = ncdim%len ! get time information @@ -2097,12 +2112,14 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & trim(my_name),grd%nlon,lonb !call stop2(101) endif + if (.not. read_2m) then if ( levs /= grd%nsig ) then if ( mype == 0 ) write(6, & '(a,'': inconsistent spatial dimension nsig = '',i4,tr1,''levs = '',i4)') & trim(my_name),grd%nsig,levs call stop2(101) endif + endif allocate( spec_vor(sp_a%nc), spec_div(sp_a%nc) ) allocate( grid(grd%nlon,nlatm2), grid_v(grd%nlon,nlatm2) ) @@ -2140,57 +2157,73 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & endif ! if ( procuse ) ! Get pointer to relevant variables (this should be made flexible and general) - iredundant=0 - call gsi_bundlegetpointer(gfs_bundle,'sf',g_div ,ier) - if ( ier == 0 ) iredundant = iredundant + 1 - call gsi_bundlegetpointer(gfs_bundle,'div',g_div ,ier) - if ( ier == 0 ) iredundant = iredundant + 1 - if ( iredundant==2 ) then - if ( mype == 0 ) then - write(6,*) 'general_read_gfsatm_nems: ERROR' - write(6,*) 'cannot handle having both sf and div' - write(6,*) 'Aborting ... ' - endif - call stop2(999) - endif - iredundant=0 - call gsi_bundlegetpointer(gfs_bundle,'vp',g_vor ,ier) - if ( ier == 0 ) iredundant = iredundant + 1 - call gsi_bundlegetpointer(gfs_bundle,'vor',g_vor ,ier) - if ( ier == 0 ) iredundant = iredundant + 1 - if ( iredundant==2 ) then - if ( mype == 0 ) then - write(6,*) 'general_read_gfsatm_nems: ERROR' - write(6,*) 'cannot handle having both vp and vor' - write(6,*) 'Aborting ... ' - endif - call stop2(999) - endif - iredundant=0 - call gsi_bundlegetpointer(gfs_bundle,'t' ,g_tv ,ier) - if ( ier == 0 ) iredundant = iredundant + 1 - call gsi_bundlegetpointer(gfs_bundle,'tv',g_tv ,ier) - if ( ier == 0 ) iredundant = iredundant + 1 - if ( iredundant==2 ) then - if ( mype == 0 ) then - write(6,*) 'general_read_gfsatm_nems: ERROR' - write(6,*) 'cannot handle having both t and tv' - write(6,*) 'Aborting ... ' - endif - call stop2(999) - endif - istatus=0 - call gsi_bundlegetpointer(gfs_bundle,'ps',g_ps ,ier);istatus=istatus+ier - call gsi_bundlegetpointer(gfs_bundle,'q' ,g_q ,ier);istatus=istatus+ier - call gsi_bundlegetpointer(gfs_bundle,'oz',g_oz ,ier);istatus=istatus+ier - call gsi_bundlegetpointer(gfs_bundle,'cw',g_cwmr,ier);istatus=istatus+ier - if ( istatus /= 0 ) then - if ( mype == 0 ) then - write(6,*) 'general_read_gfsatm_nems: ERROR' - write(6,*) 'Missing some of the required fields' - write(6,*) 'Aborting ... ' - endif - call stop2(999) + if (.not. read_2m) then + iredundant=0 + call gsi_bundlegetpointer(gfs_bundle,'sf',g_div ,ier) + if ( ier == 0 ) iredundant = iredundant + 1 + call gsi_bundlegetpointer(gfs_bundle,'div',g_div ,ier) + if ( ier == 0 ) iredundant = iredundant + 1 + if ( iredundant==2 ) then + if ( mype == 0 ) then + write(6,*) 'general_read_gfsatm_nems: ERROR' + write(6,*) 'cannot handle having both sf and div' + write(6,*) 'Aborting ... ' + endif + call stop2(999) + endif + iredundant=0 + call gsi_bundlegetpointer(gfs_bundle,'vp',g_vor ,ier) + if ( ier == 0 ) iredundant = iredundant + 1 + call gsi_bundlegetpointer(gfs_bundle,'vor',g_vor ,ier) + if ( ier == 0 ) iredundant = iredundant + 1 + if ( iredundant==2 ) then + if ( mype == 0 ) then + write(6,*) 'general_read_gfsatm_nems: ERROR' + write(6,*) 'cannot handle having both vp and vor' + write(6,*) 'Aborting ... ' + endif + call stop2(999) + endif + iredundant=0 + call gsi_bundlegetpointer(gfs_bundle,'t' ,g_tv ,ier) + if ( ier == 0 ) iredundant = iredundant + 1 + call gsi_bundlegetpointer(gfs_bundle,'tv',g_tv ,ier) + if ( ier == 0 ) iredundant = iredundant + 1 + if ( iredundant==2 ) then + if ( mype == 0 ) then + write(6,*) 'general_read_gfsatm_nems: ERROR' + write(6,*) 'cannot handle having both t and tv' + write(6,*) 'Aborting ... ' + endif + call stop2(999) + endif + + istatus=0 + call gsi_bundlegetpointer(gfs_bundle,'ps',g_ps ,ier);istatus=istatus+ier + call gsi_bundlegetpointer(gfs_bundle,'q' ,g_q ,ier);istatus=istatus+ier + call gsi_bundlegetpointer(gfs_bundle,'oz',g_oz ,ier);istatus=istatus+ier + call gsi_bundlegetpointer(gfs_bundle,'cw',g_cwmr,ier);istatus=istatus+ier + if ( istatus /= 0 ) then + if ( mype == 0 ) then + write(6,*) 'general_read_gfsatm_nems: ERROR' + write(6,*) 'Missing some of the required fields' + write(6,*) 'Aborting ... ' + endif + call stop2(999) + endif + else ! read 2m vars + istatus=0 + call gsi_bundlegetpointer(gfs_bundle,'t2m',g_t2m ,ier);istatus=istatus+ier + call gsi_bundlegetpointer(gfs_bundle,'q2m',g_q2m ,ier);istatus=istatus+ier + call gsi_bundlegetpointer(gfs_bundle,'ps',g_ps ,ier);istatus=istatus+ier + if ( istatus /= 0 ) then + if ( mype == 0 ) then + write(6,*) 'general_read_gfsatm_nems: ERROR' + write(6,*) 'Missing 2m required variabless' + write(6,*) 'Aborting ... ' + endif + call stop2(999) + endif endif allocate(g_u(grd%lat2,grd%lon2,grd%nsig),g_v(grd%lat2,grd%lon2,grd%nsig)) allocate(g_z(grd%lat2,grd%lon2)) @@ -2202,8 +2235,8 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & ! Once on the grid, fields need to be scattered from the full domain to ! sub-domains. - ! Only read Terrain when zflag is true. - if ( zflag ) then + ! Only read Terrain when read_z is true. + if ( read_z ) then icount=icount+1 iflag(icount)=1 @@ -2228,12 +2261,14 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & call general_fill_ns(grd,grid,work) endif endif - if ( icount == icm ) then + if ( read_2m .or. ( (.not. read_2m ) .and. ( icount == icm)) ) then call general_reload(grd,g_z,g_ps,g_tv,g_vor,g_div,g_u,g_v,g_q,g_oz,g_cwmr, & icount,iflag,ilev,work,uvflag,vordivflag) endif endif + if (.not. read_2m) then + icount=icount+1 iflag(icount)=2 ilev(icount)=1 @@ -2575,6 +2610,82 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & endif enddo ! do k=1,nlevs + elseif (read_2m) then ! read_2m + icount=1 + iflag(icount)=1 + + ! 2m temperature from sfc file + if (mype==mype_use(icount)) then + ! read t2m + call read_vardata(atmges, 'tmp2m', rwork2d) + + if ( diff_res ) then + vector(1)=.false. + grid_b=rwork2d + call fill2_ns(grid_b,grid_c(:,:,1),latb+2,lonb) + call g_egrid2agrid(p_high,grid_c,grid2,1,1,vector) + do kk=1,grd%itotsub + i=grd%ltosi_s(kk) + j=grd%ltosj_s(kk) + work(kk)=grid2(i,j,1) + enddo + else + grid=rwork2d + call general_fill_ns(grd,grid,work) + endif + endif + !if ( icount == icm ) then + ! call general_2m_reload(grd,g_t2m, g_q2m, icount,iflag,work) + !endif + + icount=icount + 1 + iflag(icount)=2 + + ! 2m temperature from sfc file + if (mype==mype_use(icount)) then + ! read ps + call read_vardata(atmges, 'spfh2m', rwork2d) + if ( diff_res ) then + vector(1)=.false. + grid_b=rwork2d + call fill2_ns(grid_b,grid_c(:,:,1),latb+2,lonb) + call g_egrid2agrid(p_high,grid_c,grid2,1,1,vector) + do kk=1,grd%itotsub + i=grd%ltosi_s(kk) + j=grd%ltosj_s(kk) + work(kk)=grid2(i,j,1) + enddo + else + grid=rwork2d + call general_fill_ns(grd,grid,work) + endif + endif + if (mype==mype_use(icount)) then + ! read ps + call read_vardata(atmges, 'pressfc', rwork2d) + rwork2d = r0_001*rwork2d ! convert Pa to cb + if ( diff_res ) then + vector(1)=.false. + grid_b=rwork2d + call fill2_ns(grid_b,grid_c(:,:,1),latb+2,lonb) + call g_egrid2agrid(p_high,grid_c,grid2,1,1,vector) + do kk=1,grd%itotsub + i=grd%ltosi_s(kk) + j=grd%ltosj_s(kk) + work(kk)=grid2(i,j,1) + enddo + else + grid=rwork2d + call general_fill_ns(grd,grid,work) + endif + endif + + ! not using all procs. doesn't trigger. todo: fix task allocation + !if ( icount == icm ) then + call general_2m_reload(grd,g_t2m, g_q2m, g_ps, icount,iflag,work) + !endif + + endif ! read_2m if ( procuse ) then if ( diff_res) deallocate(grid_b,grid_b2,grid_c,grid_c2,grid2) @@ -2597,27 +2708,29 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & !enddo ! Load u->div and v->vor slot when uv are used instead - if ( uvflag ) then - call gsi_bundlegetpointer(gfs_bundle,'u' ,ptr3d,ier) - if ( ier == 0 ) then - ptr3d=g_u - call gsi_bundlegetpointer(gfs_bundle,'v' ,ptr3d,ier) - if ( ier == 0 ) ptr3d=g_v - else ! in this case, overload: return u/v in sf/vp slot - call gsi_bundlegetpointer(gfs_bundle,'sf' ,ptr3d,ier) - if ( ier == 0 ) then - ptr3d=g_u - call gsi_bundlegetpointer(gfs_bundle,'vp' ,ptr3d,ier) - if ( ier == 0 ) ptr3d=g_v - endif - endif - else ! in this case, overload: return u/v in sf/vp slot - call gsi_bundlegetpointer(gfs_bundle,'sf' ,ptr3d,ier) - if ( ier == 0 ) ptr3d=g_u - call gsi_bundlegetpointer(gfs_bundle,'vp' ,ptr3d,ier) - if ( ier == 0 ) ptr3d=g_v - endif - if (zflag) then + if ( .not. read_2m ) then + if ( uvflag ) then + call gsi_bundlegetpointer(gfs_bundle,'u' ,ptr3d,ier) + if ( ier == 0 ) then + ptr3d=g_u + call gsi_bundlegetpointer(gfs_bundle,'v' ,ptr3d,ier) + if ( ier == 0 ) ptr3d=g_v + else ! in this case, overload: return u/v in sf/vp slot + call gsi_bundlegetpointer(gfs_bundle,'sf' ,ptr3d,ier) + if ( ier == 0 ) then + ptr3d=g_u + call gsi_bundlegetpointer(gfs_bundle,'vp' ,ptr3d,ier) + if ( ier == 0 ) ptr3d=g_v + endif + endif + else ! in this case, overload: return u/v in sf/vp slot + call gsi_bundlegetpointer(gfs_bundle,'sf' ,ptr3d,ier) + if ( ier == 0 ) ptr3d=g_u + call gsi_bundlegetpointer(gfs_bundle,'vp' ,ptr3d,ier) + if ( ier == 0 ) ptr3d=g_v + endif + endif ! read_2m + if (read_z) then call gsi_bundlegetpointer(gfs_bundle,'z' ,ptr2d,ier) if ( ier == 0 ) ptr2d=g_z endif diff --git a/src/gsi/netcdfgfs_io.f90 b/src/gsi/netcdfgfs_io.f90 index fd8afbf835..0ff4795636 100644 --- a/src/gsi/netcdfgfs_io.f90 +++ b/src/gsi/netcdfgfs_io.f90 @@ -210,20 +210,23 @@ subroutine read_ if (hofx_2m_sfcfile) then ! current read_sfc routines called from different part of ! of the code, can't easily read into the met-bundle ! wrote a new routine here - if (mype==0) write(*,*) 'calling general_read_gfsatm_nc for 2m data', it + if (mype==0) write(*,*) 'calling general_read_gfsatm_nc for 2m data', it, ifilesig(it) write(filename,'(''sfcf'',i2.2)') ifilesig(it) call general_read_gfsatm_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& atm_bundle,.true.,istatus) - if (mype==0) write(*,*) 'done with general_read_gfsatm_nc for 2m data', it - endif - write(filename,'(''sigf'',i2.2)') ifilesig(it) - if (fv3_full_hydro) then + + write(filename,'(''sigf'',i2.2)') ifilesig(it) + call general_read_gfsatm_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& + atm_bundle,.true.,istatus) + elseif (fv3_full_hydro) then if (mype==0) write(*,*) 'calling general_read_gfsatm_allhydro_nc', it + write(filename,'(''sigf'',i2.2)') ifilesig(it) call general_read_gfsatm_allhydro_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& atm_bundle,istatus) ! this loads cloud and precip if (mype==0) write(*,*) 'done with general_read_gfsatm_allhydro_nc', it - else + else if (mype==0) write(*,*) 'calling general_read_gfsatm_nc' + write(filename,'(''sigf'',i2.2)') ifilesig(it) call general_read_gfsatm_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& atm_bundle,.true.,istatus) if (mype==0) write(*,*) 'done with general_read_gfsatm_nc' diff --git a/src/gsi/setupt.f90 b/src/gsi/setupt.f90 index 935a25ff14..833c978a32 100644 --- a/src/gsi/setupt.f90 +++ b/src/gsi/setupt.f90 @@ -1844,12 +1844,12 @@ subroutine contents_netcdf_diag_(odiag) call nc_diag_data2d("ObsDiagSave_obssen", odiag%obssen ) endif - if (twodvar_regional .or. hofx_2m_sfcfile .or. l_obsprvdiag) then + if (twodvar_regional .or. l_obsprvdiag .or. hofx_2m_sfcfile ) then call nc_diag_metadata("Dominant_Sfc_Type", data(idomsfc,i) ) ! this is the model height interpolated to the obs location in read_prepbufr call nc_diag_metadata("Model_Terrain", data(izz,i) ) endif - if (twodvar_regional) then + if (twodvar_regional .or. l_obsprvdiag) then r_prvstg = data(iprvd,i) call nc_diag_metadata("Provider_Name", c_prvstg ) r_sprvstg = data(isprvd,i) From 95a3dc86a4e4eed9ffebfd3d56c659d486ee7976 Mon Sep 17 00:00:00 2001 From: "Guoqing.Ge" Date: Mon, 3 Oct 2022 20:41:45 -0600 Subject: [PATCH 2/6] revert changes on src/gsi/netcdfgfs_io.f90 --- src/gsi/netcdfgfs_io.f90 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/gsi/netcdfgfs_io.f90 b/src/gsi/netcdfgfs_io.f90 index 0ff4795636..fd8afbf835 100644 --- a/src/gsi/netcdfgfs_io.f90 +++ b/src/gsi/netcdfgfs_io.f90 @@ -210,23 +210,20 @@ subroutine read_ if (hofx_2m_sfcfile) then ! current read_sfc routines called from different part of ! of the code, can't easily read into the met-bundle ! wrote a new routine here - if (mype==0) write(*,*) 'calling general_read_gfsatm_nc for 2m data', it, ifilesig(it) + if (mype==0) write(*,*) 'calling general_read_gfsatm_nc for 2m data', it write(filename,'(''sfcf'',i2.2)') ifilesig(it) call general_read_gfsatm_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& atm_bundle,.true.,istatus) - - write(filename,'(''sigf'',i2.2)') ifilesig(it) - call general_read_gfsatm_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& - atm_bundle,.true.,istatus) - elseif (fv3_full_hydro) then + if (mype==0) write(*,*) 'done with general_read_gfsatm_nc for 2m data', it + endif + write(filename,'(''sigf'',i2.2)') ifilesig(it) + if (fv3_full_hydro) then if (mype==0) write(*,*) 'calling general_read_gfsatm_allhydro_nc', it - write(filename,'(''sigf'',i2.2)') ifilesig(it) call general_read_gfsatm_allhydro_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& atm_bundle,istatus) ! this loads cloud and precip if (mype==0) write(*,*) 'done with general_read_gfsatm_allhydro_nc', it - else + else if (mype==0) write(*,*) 'calling general_read_gfsatm_nc' - write(filename,'(''sigf'',i2.2)') ifilesig(it) call general_read_gfsatm_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& atm_bundle,.true.,istatus) if (mype==0) write(*,*) 'done with general_read_gfsatm_nc' From f5e537bf35cc7a3eddaa9a741b7e358280c7e105 Mon Sep 17 00:00:00 2001 From: "Guoqing.Ge" Date: Mon, 3 Oct 2022 21:59:13 -0600 Subject: [PATCH 3/6] go ahead with the changes on src/gsi/netcdfgfs_io.f90 --- src/gsi/netcdfgfs_io.f90 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/gsi/netcdfgfs_io.f90 b/src/gsi/netcdfgfs_io.f90 index fd8afbf835..0ff4795636 100644 --- a/src/gsi/netcdfgfs_io.f90 +++ b/src/gsi/netcdfgfs_io.f90 @@ -210,20 +210,23 @@ subroutine read_ if (hofx_2m_sfcfile) then ! current read_sfc routines called from different part of ! of the code, can't easily read into the met-bundle ! wrote a new routine here - if (mype==0) write(*,*) 'calling general_read_gfsatm_nc for 2m data', it + if (mype==0) write(*,*) 'calling general_read_gfsatm_nc for 2m data', it, ifilesig(it) write(filename,'(''sfcf'',i2.2)') ifilesig(it) call general_read_gfsatm_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& atm_bundle,.true.,istatus) - if (mype==0) write(*,*) 'done with general_read_gfsatm_nc for 2m data', it - endif - write(filename,'(''sigf'',i2.2)') ifilesig(it) - if (fv3_full_hydro) then + + write(filename,'(''sigf'',i2.2)') ifilesig(it) + call general_read_gfsatm_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& + atm_bundle,.true.,istatus) + elseif (fv3_full_hydro) then if (mype==0) write(*,*) 'calling general_read_gfsatm_allhydro_nc', it + write(filename,'(''sigf'',i2.2)') ifilesig(it) call general_read_gfsatm_allhydro_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& atm_bundle,istatus) ! this loads cloud and precip if (mype==0) write(*,*) 'done with general_read_gfsatm_allhydro_nc', it - else + else if (mype==0) write(*,*) 'calling general_read_gfsatm_nc' + write(filename,'(''sigf'',i2.2)') ifilesig(it) call general_read_gfsatm_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& atm_bundle,.true.,istatus) if (mype==0) write(*,*) 'done with general_read_gfsatm_nc' From 9d454b93cd974f468d83d7353311cc49df280141 Mon Sep 17 00:00:00 2001 From: "Guoqing.Ge" Date: Mon, 3 Oct 2022 22:57:04 -0600 Subject: [PATCH 4/6] revert changes on src/gsi/netcdfgfs_io.f90 --- src/gsi/netcdfgfs_io.f90 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/gsi/netcdfgfs_io.f90 b/src/gsi/netcdfgfs_io.f90 index 0ff4795636..fd8afbf835 100644 --- a/src/gsi/netcdfgfs_io.f90 +++ b/src/gsi/netcdfgfs_io.f90 @@ -210,23 +210,20 @@ subroutine read_ if (hofx_2m_sfcfile) then ! current read_sfc routines called from different part of ! of the code, can't easily read into the met-bundle ! wrote a new routine here - if (mype==0) write(*,*) 'calling general_read_gfsatm_nc for 2m data', it, ifilesig(it) + if (mype==0) write(*,*) 'calling general_read_gfsatm_nc for 2m data', it write(filename,'(''sfcf'',i2.2)') ifilesig(it) call general_read_gfsatm_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& atm_bundle,.true.,istatus) - - write(filename,'(''sigf'',i2.2)') ifilesig(it) - call general_read_gfsatm_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& - atm_bundle,.true.,istatus) - elseif (fv3_full_hydro) then + if (mype==0) write(*,*) 'done with general_read_gfsatm_nc for 2m data', it + endif + write(filename,'(''sigf'',i2.2)') ifilesig(it) + if (fv3_full_hydro) then if (mype==0) write(*,*) 'calling general_read_gfsatm_allhydro_nc', it - write(filename,'(''sigf'',i2.2)') ifilesig(it) call general_read_gfsatm_allhydro_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& atm_bundle,istatus) ! this loads cloud and precip if (mype==0) write(*,*) 'done with general_read_gfsatm_allhydro_nc', it - else + else if (mype==0) write(*,*) 'calling general_read_gfsatm_nc' - write(filename,'(''sigf'',i2.2)') ifilesig(it) call general_read_gfsatm_nc(grd_t,sp_a,filename,.true.,.true.,.true.,& atm_bundle,.true.,istatus) if (mype==0) write(*,*) 'done with general_read_gfsatm_nc' From c7be078316daa74098375cdf66f549902623b333 Mon Sep 17 00:00:00 2001 From: "Guoqing.Ge" Date: Wed, 12 Oct 2022 09:28:48 -0600 Subject: [PATCH 5/6] minor fix on src/gsi/setupt.f90 --- src/gsi/setupt.f90 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gsi/setupt.f90 b/src/gsi/setupt.f90 index 833c978a32..01e6f0ec5c 100644 --- a/src/gsi/setupt.f90 +++ b/src/gsi/setupt.f90 @@ -903,6 +903,7 @@ subroutine setupt(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav !if(i_use_2mt4b>0 .and. sfctype) then if(sfctype .and. (( i_use_2mt4b>0) .or. hofx_2m_sfcfile ) ) then ddiff = tob-tges2m + if (hofx_2m_sfcfile) tges=tges2m else ddiff = tob-tges endif @@ -1798,10 +1799,10 @@ subroutine contents_netcdf_diag_(odiag) call nc_diag_metadata("Errinv_Adjust", sngl(errinv_adjst) ) call nc_diag_metadata("Errinv_Final", sngl(errinv_final) ) if (hofx_2m_sfcfile ) then - call nc_diag_metadata("Observation", sngl(tob) ) - call nc_diag_metadata("Observation_Before_Elev_Correction", sngl(data(itob,i)) ) + call nc_diag_metadata("Observation", sngl(tob) ) + call nc_diag_metadata("Observation_Before_Elev_Correction", sngl(data(itob,i)) ) else - call nc_diag_metadata("Observation", sngl(data(itob,i)) ) + call nc_diag_metadata("Observation", sngl(data(itob,i)) ) endif call nc_diag_metadata("Obs_Minus_Forecast_adjusted", sngl(ddiff) ) call nc_diag_metadata("Obs_Minus_Forecast_unadjusted", sngl(tob-tges) ) From 2046b3881f4b7d2d9ed0259c3f7e4b8fda77431a Mon Sep 17 00:00:00 2001 From: "Guoqing.Ge" Date: Tue, 25 Oct 2022 22:31:46 -0600 Subject: [PATCH 6/6] more changes --- src/gsi/gsd_update_mod.f90 | 7 +++---- src/gsi/read_prepbufr.f90 | 6 +++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gsi/gsd_update_mod.f90 b/src/gsi/gsd_update_mod.f90 index b0a5817763..7b43f55fb2 100644 --- a/src/gsi/gsd_update_mod.f90 +++ b/src/gsi/gsd_update_mod.f90 @@ -516,9 +516,8 @@ subroutine gsd_update_t2m(tinc,it) !$$$ use kinds, only: r_kind,i_kind use jfunc, only: tsensible - use constants, only: zero,one,fv,rd_over_cp_mass,one_tenth - use gridmod, only: lat2,lon2,aeta1_ll,pt_ll,aeta2_ll - use guess_grids, only:ges_prsi + use constants, only: zero,one,fv,one_tenth + use gridmod, only: lat2,lon2 use constants, only: half implicit none @@ -555,7 +554,7 @@ subroutine gsd_update_t2m(tinc,it) if(ihaveq/=0) cycle dth2=tinc(i,j)/(one+fv*ges_q(i,j,1)) endif -! do not need to convert sensible temperature to potential temperature + ges_t2m(i,j) = ges_t2m(i,j) + dth2 end do end do diff --git a/src/gsi/read_prepbufr.f90 b/src/gsi/read_prepbufr.f90 index 2ea7ff9421..b57a80a6b4 100644 --- a/src/gsi/read_prepbufr.f90 +++ b/src/gsi/read_prepbufr.f90 @@ -1915,9 +1915,13 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& ! Missing Values ==> Cycling! In this case for howv only. #ww3 if (howvob .and. owave(1,k) > r0_1_bmiss) cycle LOOP_K_LEVS -! CSD - temporary hack ( move to prepbufr pre-processing) +! CSD - temporary hack ( move to prepbufr pre-processing later) ! Over-ride QM=9 for sfc obs if (sfctype .and. hofx_2m_sfcfile ) then + if (tob) then!hardwire 187 obs error to 1.2 for now + tqm(k)=2 + obserr(3,k)=1.2 + endif if (tob .and. qm == 9 ) qm = 2 ! 2=not checked if (qob .and. qm == 9 ) qm = 2 ! 2=not checked endif