Skip to content

Commit

Permalink
Fixed uninitialized status variable. NOAA-EMC#447
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidHuber-NOAA committed Feb 28, 2023
1 parent 7d05325 commit e32a4fb
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 105 deletions.
41 changes: 16 additions & 25 deletions src/gsi/general_read_fv3atm.f90
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,9 @@ subroutine general_read_fv3atm_nems(grd,sp_a,filename,uvflag,vordivflag,zflag, &
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_fv3atm_nems: ERROR'
write(6,*) 'cannot handle having both sf and div'
write(6,*) 'Aborting ... '
endif
write(6,*) 'general_read_fv3atm_nems: ERROR'
write(6,*) 'cannot handle having both sf and div'
write(6,*) 'Aborting ... '
call stop2(999)
endif
iredundant=0
Expand All @@ -234,11 +232,9 @@ subroutine general_read_fv3atm_nems(grd,sp_a,filename,uvflag,vordivflag,zflag, &
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_fv3atm_nems: ERROR'
write(6,*) 'cannot handle having both vp and vor'
write(6,*) 'Aborting ... '
endif
write(6,*) 'general_read_fv3atm_nems: ERROR'
write(6,*) 'cannot handle having both vp and vor'
write(6,*) 'Aborting ... '
call stop2(999)
endif
iredundant=0
Expand All @@ -247,14 +243,13 @@ subroutine general_read_fv3atm_nems(grd,sp_a,filename,uvflag,vordivflag,zflag, &
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_fv3atm_nems: ERROR'
write(6,*) 'cannot handle having both t and tv'
write(6,*) 'Aborting ... '
endif
write(6,*) 'general_read_fv3atm_nems: ERROR'
write(6,*) 'cannot handle having both t and tv'
write(6,*) 'Aborting ... '
call stop2(999)
endif
istatus=0
istatus1=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
Expand All @@ -265,19 +260,15 @@ subroutine general_read_fv3atm_nems(grd,sp_a,filename,uvflag,vordivflag,zflag, &
call gsi_bundlegetpointer(gfs_bundle,'qg',g_qg ,ier);istatus1= istatus1+ ier
call gsi_bundlegetpointer(gfs_bundle,'cf',g_cf ,ier);istatus1= istatus1+ ier
if ( istatus /= 0 ) then
if ( mype == 0 ) then
write(6,*) 'general_read_fv3atm_nems: ERROR'
write(6,*) 'Missing some of the required fields'
write(6,*) 'Aborting ... '
endif
write(6,*) 'general_read_fv3atm_nems: ERROR'
write(6,*) 'Missing some of the required fields'
write(6,*) 'Aborting ... '
call stop2(999)
endif
if ( istatus1 /= 0 ) then
if ( mype == 0 ) then
write(6,*) 'general_read_fv3atm_nems: ERROR'
write(6,*) 'Missing some of the required hydrometeor fields for imp_physics = ', imp_physics
write(6,*) 'Aborting ... '
endif
write(6,*) 'general_read_fv3atm_nems: ERROR'
write(6,*) 'Missing some of the required hydrometeor fields for imp_physics = ', imp_physics
write(6,*) 'Aborting ... '
call stop2(999)
endif

Expand Down
129 changes: 49 additions & 80 deletions src/gsi/general_read_gfsatm.f90
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,9 @@ subroutine general_read_gfsatm(grd,sp_a,sp_b,filename,uvflag,vordivflag,zflag, &
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: ERROR'
write(6,*) 'cannot handle having both sf and div'
write(6,*) 'Aborting ... '
endif
write(6,*) 'general_read_gfsatm: ERROR'
write(6,*) 'cannot handle having both sf and div'
write(6,*) 'Aborting ... '
call stop2(999)
endif
iredundant=0
Expand All @@ -571,11 +569,9 @@ subroutine general_read_gfsatm(grd,sp_a,sp_b,filename,uvflag,vordivflag,zflag, &
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: ERROR'
write(6,*) 'cannot handle having both vp and vor'
write(6,*) 'Aborting ... '
endif
write(6,*) 'general_read_gfsatm: ERROR'
write(6,*) 'cannot handle having both vp and vor'
write(6,*) 'Aborting ... '
call stop2(999)
endif
iredundant=0
Expand All @@ -584,11 +580,9 @@ subroutine general_read_gfsatm(grd,sp_a,sp_b,filename,uvflag,vordivflag,zflag, &
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: ERROR'
write(6,*) 'cannot handle having both t and tv'
write(6,*) 'Aborting ... '
endif
write(6,*) 'general_read_gfsatm: ERROR'
write(6,*) 'cannot handle having both t and tv'
write(6,*) 'Aborting ... '
call stop2(999)
endif
istatus=0
Expand All @@ -597,11 +591,9 @@ subroutine general_read_gfsatm(grd,sp_a,sp_b,filename,uvflag,vordivflag,zflag, &
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: ERROR'
write(6,*) 'Missing some of the required fields'
write(6,*) 'Aborting ... '
endif
write(6,*) 'general_read_gfsatm: ERROR'
write(6,*) 'Missing some of the required fields'
write(6,*) 'Aborting ... '
call stop2(999)
endif
allocate(g_u(grd%lat2,grd%lon2,grd%nsig),g_v(grd%lat2,grd%lon2,grd%nsig))
Expand Down Expand Up @@ -1246,11 +1238,9 @@ subroutine general_read_gfsatm_nems(grd,sp_a,filename,uvflag,vordivflag,zflag, &
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
write(6,*) 'general_read_gfsatm_nems: ERROR'
write(6,*) 'cannot handle having both sf and div'
write(6,*) 'Aborting ... '
call stop2(999)
endif
iredundant=0
Expand All @@ -1259,11 +1249,9 @@ subroutine general_read_gfsatm_nems(grd,sp_a,filename,uvflag,vordivflag,zflag, &
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
write(6,*) 'general_read_gfsatm_nems: ERROR'
write(6,*) 'cannot handle having both vp and vor'
write(6,*) 'Aborting ... '
call stop2(999)
endif
iredundant=0
Expand All @@ -1272,11 +1260,9 @@ subroutine general_read_gfsatm_nems(grd,sp_a,filename,uvflag,vordivflag,zflag, &
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
write(6,*) 'general_read_gfsatm_nems: ERROR'
write(6,*) 'cannot handle having both t and tv'
write(6,*) 'Aborting ... '
call stop2(999)
endif
istatus=0
Expand All @@ -1287,11 +1273,9 @@ subroutine general_read_gfsatm_nems(grd,sp_a,filename,uvflag,vordivflag,zflag, &
if(has_cf) call gsi_bundlegetpointer(gfs_bundle,'cf',g_cf, 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
write(6,*) 'general_read_gfsatm_nems: ERROR'
write(6,*) 'Missing some of the required fields'
write(6,*) 'Aborting ... '
call stop2(999)
endif
allocate(g_u(grd%lat2,grd%lon2,grd%nsig),g_v(grd%lat2,grd%lon2,grd%nsig))
Expand Down Expand Up @@ -2079,11 +2063,9 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, &
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
write(6,*) 'general_read_gfsatm_nems: ERROR'
write(6,*) 'cannot handle having both sf and div'
write(6,*) 'Aborting ... '
call stop2(999)
endif
iredundant=0
Expand All @@ -2092,11 +2074,9 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, &
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
write(6,*) 'general_read_gfsatm_nems: ERROR'
write(6,*) 'cannot handle having both vp and vor'
write(6,*) 'Aborting ... '
call stop2(999)
endif
iredundant=0
Expand All @@ -2105,11 +2085,9 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, &
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
write(6,*) 'general_read_gfsatm_nems: ERROR'
write(6,*) 'cannot handle having both t and tv'
write(6,*) 'Aborting ... '
call stop2(999)
endif
istatus=0
Expand All @@ -2118,11 +2096,9 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, &
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
write(6,*) 'general_read_gfsatm_nems: ERROR'
write(6,*) 'Missing some of the required fields'
write(6,*) 'Aborting ... '
call stop2(999)
endif
allocate(g_u(grd%lat2,grd%lon2,grd%nsig),g_v(grd%lat2,grd%lon2,grd%nsig))
Expand Down Expand Up @@ -2787,11 +2763,9 @@ subroutine general_read_gfsatm_allhydro_nc(grd,sp_a,filename,uvflag,vordivflag,z
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_allhydro_nc: ERROR'
write(6,*) 'cannot handle having both sf and div'
write(6,*) 'Aborting ... '
endif
write(6,*) 'general_read_gfsatm_allhydro_nc: ERROR'
write(6,*) 'cannot handle having both sf and div'
write(6,*) 'Aborting ... '
call stop2(999)
endif
iredundant=0
Expand All @@ -2800,11 +2774,9 @@ subroutine general_read_gfsatm_allhydro_nc(grd,sp_a,filename,uvflag,vordivflag,z
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_allhydro_nc: ERROR'
write(6,*) 'cannot handle having both vp and vor'
write(6,*) 'Aborting ... '
endif
write(6,*) 'general_read_gfsatm_allhydro_nc: ERROR'
write(6,*) 'cannot handle having both vp and vor'
write(6,*) 'Aborting ... '
call stop2(999)
endif
iredundant=0
Expand All @@ -2813,14 +2785,13 @@ subroutine general_read_gfsatm_allhydro_nc(grd,sp_a,filename,uvflag,vordivflag,z
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_allhydro_nc: ERROR'
write(6,*) 'cannot handle having both t and tv'
write(6,*) 'Aborting ... '
endif
write(6,*) 'general_read_gfsatm_allhydro_nc: ERROR'
write(6,*) 'cannot handle having both t and tv'
write(6,*) 'Aborting ... '
call stop2(999)
endif
istatus=0
istatus1=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
Expand All @@ -2832,11 +2803,9 @@ subroutine general_read_gfsatm_allhydro_nc(grd,sp_a,filename,uvflag,vordivflag,z
call gsi_bundlegetpointer(gfs_bundle,'qg',g_qg ,ier);istatus1=istatus1+ier
! call gsi_bundlegetpointer(gfs_bundle,'cf',g_cf ,ier);istatus1=istatus1+ier
if ( istatus1 /= 0 ) then
if ( mype == 0 ) then
write(6,*) 'general_read_gfsatm_allhydro_nc: ERROR'
write(6,*) 'Missing some of the required hydrometeor fields for imp_physics = ', imp_physics
write(6,*) 'Aborting ... '
endif
write(6,*) 'general_read_gfsatm_allhydro_nc: ERROR'
write(6,*) 'Missing some of the required hydrometeor fields for imp_physics = ', imp_physics
write(6,*) 'Aborting ... '
call stop2(999)
endif

Expand Down

0 comments on commit e32a4fb

Please sign in to comment.