Skip to content

Commit

Permalink
Merge pull request #631 from NOAA-EMC/jba_updates
Browse files Browse the repository at this point in the history
some minor updates
  • Loading branch information
jbathegit authored Nov 1, 2024
2 parents 7fea5ad + fbeda32 commit e7e894b
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 72 deletions.
15 changes: 15 additions & 0 deletions docs/utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,21 @@ TOTAL 6823 774888 67232740

Utility to print an inventory of satellite data by platform and instrument type.

<pre>
Usage:

sinv satbufrfile [tabledir]

where:

satbufrfile [path/]name of BUFR satellite data file to be decoded

tabledir [path/]name of directory containing master BUFR tables.
If unspecified, the default directory location is
the defined value of the MASTER_TABLE_DIR macro when the
utility was built.
</pre>

See the source code at sinv.F90

Sample output for: `sinv gdas.20200812/00/gdas.t00z.satwnd.tm00.bufr_d`
Expand Down
8 changes: 2 additions & 6 deletions src/dxtable.F90
Original file line number Diff line number Diff line change
Expand Up @@ -641,9 +641,7 @@ subroutine dxinit(lun,ioi)
enddo

ntbb(lun) = 0
do i=1,ntbb(0)
tabb(i,lun) = ' '
enddo
tabb(1:ntbb(0),lun) = ' '

ntbd(lun) = 0
do i=1,ntbd(0)
Expand Down Expand Up @@ -713,9 +711,7 @@ subroutine dxmini(mbay,mbyt,mb4,mba,mbb,mbd)
! Initialize the message

mbit = 0
do i=1,mxmsgld4
mbay(i) = 0
enddo
mbay(1:mxmsgld4) = 0

! For DX table messages, the Section 1 date is simply zeroed out. Note that there is logic in function idxmsg()
! which relies on this.
Expand Down
6 changes: 2 additions & 4 deletions src/jumplink.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ subroutine makestab

implicit none

integer iprt, lunit, lundx, lun, lum, k, n, itba, inc, newn, noda, node, inod, icmpdx, ishrdx
integer iprt, lunit, lundx, lun, lum, n, itba, inc, newn, noda, node, inod, icmpdx, ishrdx

character*128 bort_str, errstr
character*8 nemo
Expand Down Expand Up @@ -206,9 +206,7 @@ subroutine makestab
! Set up expansion segments for type 'SUB', 'DRP', and 'DRS' nodes.

newn = 0
do k=1,maxjl
knt(k) = 0
enddo
knt(1:maxjl) = 0
do n=1,ntab
iseq(n,1) = 0
iseq(n,2) = 0
Expand Down
8 changes: 2 additions & 6 deletions src/memmsgs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ recursive subroutine ufbtam(tab,i1,i2,iret,str)
integer*8 mps, ival
integer, intent(in) :: i1, i2
integer, intent(out) :: iret
integer iprt, maxtg, nnod, ncon, nods, nodc, ivls, kons, my_i1, my_i2, i, j, irec, isub, itbl, lun, il, im, jdate, mret, &
integer iprt, maxtg, nnod, ncon, nods, nodc, ivls, kons, my_i1, my_i2, i, irec, isub, itbl, lun, il, im, jdate, mret, &
kbit, mbit, nbit, n, node, imsg, kmsg, nrep, ntg, nbyt, nbmp, nmsub

real*8, intent(out) :: tab(i1,i2)
Expand Down Expand Up @@ -1153,11 +1153,7 @@ recursive subroutine ufbtam(tab,i1,i2,iret,str)

if(msgp(0)==0) return

do j=1,i2
do i=1,i1
tab(i,j) = bmiss
enddo
enddo
tab(1:i1,1:i2) = bmiss

! Check for special tags in string

Expand Down
8 changes: 2 additions & 6 deletions src/openclosebf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ recursive subroutine ufbtab(lunin,tab,i1,i2,iret,str)
integer, intent(in) :: lunin, i1, i2
integer, intent(out) :: iret
integer, parameter :: maxtg = 100
integer nnod, ncon, nods, nodc, ivls, kons, iprt, my_lunin, my_i1, my_i2, lunit, lun, il, im, irec, isub, i, j, n, ntg, &
integer nnod, ncon, nods, nodc, ivls, kons, iprt, my_lunin, my_i1, my_i2, lunit, lun, il, im, irec, isub, i, n, ntg, &
jdate, jbit, kbit, lbit, mbit, nbit, nibit, nbyt, nsb, node, nbmp, nrep, lret, linc, iac_prev, ityp, &
ireadmg, ireadsb, nmsub

Expand Down Expand Up @@ -927,11 +927,7 @@ recursive subroutine ufbtab(lunin,tab,i1,i2,iret,str)
endif

! Initialize all of the output array values to the current value for "missing"
do j=1,i2
do i=1,i1
tab(i,j) = bmiss
enddo
enddo
tab(1:i1,1:i2) = bmiss

! Set counters to zero
iret = 0
Expand Down
5 changes: 1 addition & 4 deletions src/readwritesb.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1183,10 +1183,7 @@ subroutine rcstpl(lun,iret)
mbmp = 1
nval(lun) = 1
nr = 0

do i=1,maxrcr
knx(i) = 0
enddo
knx(1:maxrcr) = 0

outer: do while (.true.)

Expand Down
52 changes: 9 additions & 43 deletions src/readwriteval.F90
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ recursive subroutine ufbint(lunin,usr,i1,i2,iret,str)

integer, intent(in) :: lunin, i1, i2
integer, intent(out) :: iret
integer iprt, nnod, ncon, nods, nodc, ivls, kons, ifirst1, ifirst2, my_lunin, my_i1, my_i2, lunit, lun, il, im, io, i, j
integer iprt, nnod, ncon, nods, nodc, ivls, kons, ifirst1, ifirst2, my_lunin, my_i1, my_i2, lunit, lun, il, im, io

common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
common /quiet/ iprt
Expand Down Expand Up @@ -728,13 +728,7 @@ recursive subroutine ufbint(lunin,usr,i1,i2,iret,str)
call string(str,lun,i1,io)

! Initialize usr array preceeding an input operation
if(io==0) then
do j=1,i2
do i=1,I1
usr(i,j) = bmiss
enddo
enddo
endif
if(io==0) usr(1:i1,1:i2) = bmiss

! Call the mnemonic reader/writer
call ufbrw(lun,usr,i1,i2,io,iret)
Expand Down Expand Up @@ -898,7 +892,7 @@ recursive subroutine ufbrep(lunin,usr,i1,i2,iret,str)

integer, intent(in) :: lunin, i1, i2
integer, intent(out) :: iret
integer iprt, ifirst1, my_lunin, my_i1, my_i2, lunit, lun, il, im, io, iac_prev, i, j
integer iprt, ifirst1, my_lunin, my_i1, my_i2, lunit, lun, il, im, io, iac_prev

common /quiet/ iprt

Expand Down Expand Up @@ -964,13 +958,7 @@ recursive subroutine ufbrep(lunin,usr,i1,i2,iret,str)
endif

! Initialize usr array preceeding an input operation
if(io==0) then
do j=1,i2
do i=1,i1
usr(i,j) = bmiss
enddo
enddo
endif
if(io==0) usr(1:i1,1:i2) = bmiss

! Parse or recall the input string
iac_prev = iac
Expand Down Expand Up @@ -1111,7 +1099,7 @@ recursive subroutine ufbstp(lunin,usr,i1,i2,iret,str)

integer, intent(in) :: lunin, i1, i2
integer, intent(out) :: iret
integer iprt, ifirst1, my_lunin, my_i1, my_i2, lunit, lun, il, im, io, i, j
integer iprt, ifirst1, my_lunin, my_i1, my_i2, lunit, lun, il, im, io

common /quiet/ iprt

Expand Down Expand Up @@ -1177,13 +1165,7 @@ recursive subroutine ufbstp(lunin,usr,i1,i2,iret,str)
endif

! Initialize usr array preceeding an input operation
if(io==0) then
do j=1,i2
do i=1,I1
usr(i,j) = bmiss
enddo
enddo
endif
if(io==0) usr(1:i1,1:i2) = bmiss

! Parse or recall the input string
call string(str,lun,i1,io)
Expand Down Expand Up @@ -1415,13 +1397,7 @@ recursive subroutine ufbseq(lunin,usr,i1,i2,iret,str)
'BUFR FILE DOES NOT AGREE WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')

! Initialize usr array preceeding an input operation
if(io==0) then
do j=1,i2
do i=1,I1
usr(i,j) = bmiss
enddo
enddo
endif
if(io==0) usr(1:i1,1:i2) = bmiss

! Find the parameters of the specified sequence
outer: do node=inode(lun),isc(inode(lun))
Expand Down Expand Up @@ -2345,14 +2321,7 @@ recursive subroutine ufbevn(lunit,usr,i1,i2,i3,iret,str)
call string(str,lun,i1,0)

! Initialize usr array

do k=1,i3
do j=1,i2
do i=1,i1
usr(i,j,k) = bmiss
enddo
enddo
enddo
usr(1:i1,1:i2,1:i3) = bmiss

! Loop over condition windows

Expand Down Expand Up @@ -2583,10 +2552,7 @@ recursive subroutine ufbget(lunit,tab,i1,iret,str)
endif

iret = 0

do i=1,i1
tab(i) = bmiss
enddo
tab(1:i1) = bmiss

! Make sure a file/message is open for input

Expand Down
2 changes: 1 addition & 1 deletion test/test_scripts/test_sinv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set +e
# Test #3, for wrong number of arguments.
outfile_3=testrun/sinv_3.out
../utils/sinv > ${outfile_3}
[[ ${?} -ne 2 || `grep -c "Usage: sinv <satbufrfile>" ${outfile_3}` -ne 1 ]] && exit 3
[[ ${?} -ne 2 || `grep -c "Usage: sinv satbufrfile" ${outfile_3}` -ne 1 ]] && exit 3

# Success!
exit 0
6 changes: 4 additions & 2 deletions utils/sinv.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
!>
!> @author J Woollen @date 2010

!> Usage: sinv \<satbufrfile\> will print inventory of satellites by platform and instrument.
!> Usage: sinv satbufrfile \<tabledir\> will print an inventory of satellites in the
!> satbufrfile by platform and instrument. The optional tabledir argument can be used
!> to specify a custom directory for the master BUFR tables.
!>
!> @return 0 for success, error message otherwise.
!>
Expand Down Expand Up @@ -35,7 +37,7 @@ program sinv

narg=command_argument_count()
if(narg<1) then
write(*,*)'Usage: sinv <satbufrfile> will print inventory of satellites by platform and instrument'
write(*,*)'Usage: sinv satbufrfile <tabledir> will print inventory of satbufrfile by platform and instrument'
call exit(2)
endif
call get_command_argument(1,file)
Expand Down

0 comments on commit e7e894b

Please sign in to comment.