Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use standard F2003 argument functions in utils #560

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions utils/binv.f90
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ PROGRAM BINV

! get filename

NARG=IARGC()
IF(NARG/=1) THEN
PRINT *,'Usage: binv <bufrfile> will print bufrfile inventory by message type'
CALL EXIT(2)
ENDIF
narg=command_argument_count()
if(narg/=1) then
print *,'Usage: binv <bufrfile> will print bufrfile inventory by message type'
call exit(2)
endif

call getarg(1,file)
call get_command_argument(1,file)
file = TRIM(file)//CHAR(0)
inquire(file=file,exist=exist)
if (.not.exist) then
Expand Down
2 changes: 1 addition & 1 deletion utils/cmpbqm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ PROGRAM CMPBQM
! OPEN A FILE - GET A DATE
! ------------------------

call getarg(1,file); file=trim(adjustl(file))
call get_command_argument(1,file); file=trim(adjustl(file))
if (file == '') then
print *, 'Usage: Usage: cmpbqm <prepbufrfile> will print prep inventory by variable, report type, and qc mark'
call exit(2)
Expand Down
2 changes: 1 addition & 1 deletion utils/gettab.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ program gettab

! get the filename to open and read

call getarg(1,file); file=trim(adjustl(file))
call get_command_argument(1,file); file=trim(adjustl(file))
if (file == '') then
print *,'Usage: gettab <bufrfile> will print the internal BUFR table'
call exit(2)
Expand Down
20 changes: 10 additions & 10 deletions utils/readbp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ PROGRAM READBP

! check for filename argument

narg=iargc()
narg=command_argument_count()
1 if(narg<1) THEN
call printx(' ')
call printx('Usage: readbp <-s> <-w> <m> <-k> <-r> <-d> <-n> <-h> prep bufrfile ')
Expand All @@ -82,22 +82,22 @@ PROGRAM READBP

iarg=1
do while(iarg<=narg)
call getarg(iarg,file)
call get_command_argument(iarg,file)
if(file(1:1)=='-') then
if(file(2:2)=='s') then
iarg=iarg+1; call getarg(iarg,sta); nsta=len(trim(sta))
iarg=iarg+1; call get_command_argument(iarg,sta); nsta=len(trim(sta))
elseif(file(2:2)=='w') then
iarg=iarg+1; call getarg(iarg,val); read(val,*)x1
iarg=iarg+1; call getarg(iarg,val); read(val,*)x2
iarg=iarg+1; call getarg(iarg,val); read(val,*)y1
iarg=iarg+1; call getarg(iarg,val); read(val,*)y2
iarg=iarg+1; call get_command_argument(iarg,val); read(val,*)x1
iarg=iarg+1; call get_command_argument(iarg,val); read(val,*)x2
iarg=iarg+1; call get_command_argument(iarg,val); read(val,*)y1
iarg=iarg+1; call get_command_argument(iarg,val); read(val,*)y2
window=.true.
elseif(file(2:2)=='k') then
iarg=iarg+1; call getarg(iarg,val); read(val,*)ikx
iarg=iarg+1; call get_command_argument(iarg,val); read(val,*)ikx
elseif(file(2:2)=='r') then
iarg=iarg+1; call getarg(iarg,val); read(val,*)irt
iarg=iarg+1; call get_command_argument(iarg,val); read(val,*)irt
elseif(file(2:2)=='m') then
iarg=iarg+1; call getarg(iarg,val); msg=val(1:8)
iarg=iarg+1; call get_command_argument(iarg,val); msg=val(1:8)
elseif(file(2:2)=='d') then
iarg=iarg+1; dump=.true.
elseif(file(2:2)=='h') then
Expand Down
4 changes: 2 additions & 2 deletions utils/readmp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ program readmp

! get the filename to open and read

call getarg(1,file); file=trim(adjustl(file))
call get_command_argument(1,file); file=trim(adjustl(file))
if (file == '') then
print *, 'Usage: readmp <bufrfile> will print reports one at a time'
call exit(2)
Expand All @@ -33,7 +33,7 @@ program readmp
print *,trim(file)//' does not exist'
call exit(3)
endif
call getarg(2,go); go=trim(adjustl(go)) ! this for testing !
call get_command_argument(2,go); go=trim(adjustl(go)) ! this for testing
open(lunit,file=file,form='unformatted')

! open the file to bufr and dump the subsets to standard outout one at a time
Expand Down
6 changes: 3 additions & 3 deletions utils/sinv.f90.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ program sinv

! get filename argument

narg=iargc()
narg=command_argument_count()
if(narg<1) then
write(*,*)'Usage: sinv <satbufrfile> will print inventory of satellites by platform and instrument'
call exit(2)
endif
call getarg(1,file)
call get_command_argument(1,file)
file = trim(adjustl(file))
inquire(file=file,exist=exist)
if (.not.exist) call bort(trim(file)//' does not exist')
Expand All @@ -47,7 +47,7 @@ program sinv

call openbf(lunbf,'FIRST',lunbf) ! need to call openbf prior to calling mtinfo
if(narg==2) then ! arg 2 would be a user defined table dir
call getarg(2,tbldir)
call get_command_argument(2,tbldir)
call mtinfo(tbldir,3,4)
else ! otherwise default table dir is used
cmtdir = '@MASTER_TABLE_DIR_F@'
Expand Down
4 changes: 2 additions & 2 deletions utils/split_by_subset.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ program split_by_subset

!> get input filename from stdin

if(iargc()==1) then
call getarg(1, finput)
if(command_argument_count()==1) then
call get_command_argument(1, finput)
inquire(file=trim(adjustl(finput)), exist=file_exists)
if (file_exists) then
open(lunit, file=trim(adjustl(finput)), form='unformatted')
Expand Down
Loading