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

Jack Woollen's fix to optimize rdcmps.f routine #543

Merged
merged 3 commits into from
Dec 8, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/Intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/data
key: data-10
key: data-11

- name: build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/data
key: data-10
key: data-11

- name: build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/MacOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/data
key: data-10
key: data-11

- name: build-bufr
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/data
key: data-10
key: data-11

- name: build-docs
run: |
Expand Down
2 changes: 2 additions & 0 deletions src/modules_arrs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ module moda_comprx
integer(8), allocatable :: KMIN(:)
!> Maximum of each data value across all data subsets in message.
integer(8), allocatable :: KMAX(:)
!> "Missing" value used when compressing non-character data values.
integer(8) :: IMISS
!> "Missing" values flag. Set to .true. if at least one occurrence
!> of this data value is "missing" within any data subset of the
!> message. Otherwise set to .false.
Expand Down
17 changes: 13 additions & 4 deletions src/rdcmps.f
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,19 @@ SUBROUTINE RDCMPS(LUN)

C This is a numeric element.

CALL UP8(LREF,NBIT,MBAY(1,LUN),IBIT)
CALL UPB(LINC, 6,MBAY(1,LUN),IBIT)
JBIT = IBIT + LINC*(NSBS-1)
CALL UP8(NINC,LINC,MBAY(1,LUN),JBIT)
if(nbit<=32) then
CALL UPB(LRE4,NBIT,MBAY(1,LUN),IBIT)
CALL UPB(LINC, 6,MBAY(1,LUN),IBIT)
JBIT = IBIT + LINC*(NSBS-1)
CALL UPB(NIN4,LINC,MBAY(1,LUN),JBIT)
LREF=LRE4; NINC=NIN4
elseif(nbit<=64) then
CALL UP8(LREF,NBIT,MBAY(1,LUN),IBIT)
CALL UPB(LINC, 6,MBAY(1,LUN),IBIT)
JBIT = IBIT + LINC*(NSBS-1)
CALL UP8(NINC,LINC,MBAY(1,LUN),JBIT)
endif

IF(NINC.EQ.LPS(LINC)) THEN
IVAL = LPS(NBIT)
ELSE
Expand Down
2 changes: 1 addition & 1 deletion src/wrcmps.f
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ SUBROUTINE WRCMPS(LUNIX)
C .FALSE. IF ALL SUCH VALUES ARE NON-"MISSING"
C .TRUE. OTHERWISE

IMISS = 2**IWID(I)-1
IMISS = 2_8**IWID(I)-1
IF(ICOL.EQ.1) THEN
KMIN(I) = IMISS
KMAX(I) = 0
Expand Down
50 changes: 28 additions & 22 deletions test/test_scripts/test_debufr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,46 @@ args_5="-b -o ${outfile_5}"
../utils/debufr ${args_5} testfiles/data/debufr_4 && cmp -s ${outfile_5} testfiles/testoutput/debufr_5.out
[[ ${?} -ne 0 ]] && exit 5

# Test #6, reading debufr_6 file using master tables.
outfile_6=testrun/debufr_6.out
args_6="-t ../tables -o ${outfile_6}"
../utils/debufr ${args_6} testfiles/data/debufr_6 && cmp -s ${outfile_6} testfiles/testoutput/debufr_6.out
[[ ${?} -ne 0 ]] && exit 6

# We expect some of the following tests may return a non-zero exit code, but we don't want
# to immediately exit the script when that happens.
set +e

# Test #6, for wrong number of arguments.
outfile_6=testrun/debufr_6.out
../utils/debufr > ${outfile_6}
[[ ${?} -eq 0 || `grep -c "ERROR: You must specify an input BUFR file to be decoded" ${outfile_6}` -ne 1 ]] && exit 6

# Test #7, for -v option.
# Test #7, for wrong number of arguments.
outfile_7=testrun/debufr_7.out
../utils/debufr -v > ${outfile_7}
[[ ${?} -ne 0 || `grep -c "This is the debufr utility, built with NCEPLIBS-bufr" ${outfile_7}` -ne 1 ]] && exit 7
../utils/debufr > ${outfile_7}
[[ ${?} -eq 0 || `grep -c "ERROR: You must specify an input BUFR file to be decoded" ${outfile_7}` -ne 1 ]] && exit 7

# Test #8, for -h option.
# Test #8, for -v option.
outfile_8=testrun/debufr_8.out
../utils/debufr -h > ${outfile_8}
[[ ${?} -ne 0 || `egrep -c "(ABSTRACT|USAGE|WHERE):" ${outfile_8}` -ne 3 ]] && exit 8
../utils/debufr -v > ${outfile_8}
[[ ${?} -ne 0 || `grep -c "This is the debufr utility, built with NCEPLIBS-bufr" ${outfile_8}` -ne 1 ]] && exit 8

# Test #9, for non-existent DX tables file.
# Test #9, for -h option.
outfile_9=testrun/debufr_9.out
../utils/debufr -t. -f BUFRLIB_DUMMY testfiles/data/debufr_1 > ${outfile_9}
[[ ${?} -ne 0 || `grep -c "Error: Could not find file" ${outfile_9}` -ne 1 ]] && exit 9
../utils/debufr -h > ${outfile_9}
[[ ${?} -ne 0 || `egrep -c "(ABSTRACT|USAGE|WHERE):" ${outfile_9}` -ne 3 ]] && exit 9

# Test #10, which should call NCEPLIBS-bufr subroutine bort from within subroutine readerme.
outfile_10=debufr_10.debufr.out
args_10="-t ../tables -p MXMSGL=40000"
../utils/debufr ${args_10} testfiles/data/debufr_3 > ${outfile_10}
[[ ${?} -eq 0 || `grep -c "READERME - INPUT BUFR MESSAGE LENGTH.*LARGER THAN LIMIT" ${outfile_10}` -ne 1 ]] && exit 10
# Test #10, for non-existent DX tables file.
outfile_10=testrun/debufr_10.out
../utils/debufr -t. -f BUFRLIB_DUMMY testfiles/data/debufr_1 > ${outfile_10}
[[ ${?} -ne 0 || `grep -c "Error: Could not find file" ${outfile_10}` -ne 1 ]] && exit 10

# Test #11, for unwriteable output directory.
# Test #11, which should call NCEPLIBS-bufr subroutine bort from within subroutine readerme.
outfile_11=testrun/debufr_11.out
../utils/debufr -o /BUFRLIB_DUMMY_DIRECTORY/BUFRLIB_DUMMY testfiles/data/debufr_1 > ${outfile_11}
[[ ${?} -eq 0 || `grep -c "ERROR: Cannot write output file" ${outfile_11}` -ne 1 ]] && exit 11
args_11="-t ../tables -p MXMSGL=40000"
../utils/debufr ${args_11} testfiles/data/debufr_3 > ${outfile_11}
[[ ${?} -eq 0 || `grep -c "READERME - INPUT BUFR MESSAGE LENGTH.*LARGER THAN LIMIT" ${outfile_11}` -ne 1 ]] && exit 11

# Test #12, for unwriteable output directory.
outfile_12=testrun/debufr_12.out
../utils/debufr -o /BUFRLIB_DUMMY_DIRECTORY/BUFRLIB_DUMMY testfiles/data/debufr_1 > ${outfile_12}
[[ ${?} -eq 0 || `grep -c "ERROR: Cannot write output file" ${outfile_12}` -ne 1 ]] && exit 12

# Success!
exit 0
4 changes: 2 additions & 2 deletions test/test_ufbrw.F90
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ program test_ufbrw
if(n<=55.and.iret==0.and.str1/=str2) then
print*,"str1:",str1
print*,"str2:",str2
stop n
stop 98
elseif(n>55.and.iret==0) then
stop n
stop 99
endif
enddo

Expand Down