From 77989746f296b2dbc0a1c4ae968c7dae036bbeba Mon Sep 17 00:00:00 2001 From: Jeff Ator Date: Fri, 1 Dec 2023 16:40:29 +0000 Subject: [PATCH 1/3] Jack Woollen's fix to optimize rdcmps.f routine --- src/rdcmps.f | 17 +++++++++++++---- test/test_ufbrw.F90 | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/rdcmps.f b/src/rdcmps.f index 9cae099f..ae98c9be 100644 --- a/src/rdcmps.f +++ b/src/rdcmps.f @@ -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 diff --git a/test/test_ufbrw.F90 b/test/test_ufbrw.F90 index 0ef1d075..c542e98f 100644 --- a/test/test_ufbrw.F90 +++ b/test/test_ufbrw.F90 @@ -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 From f24dd10245cb6f506573909143555c0e7c31eba6 Mon Sep 17 00:00:00 2001 From: Jeff Ator Date: Thu, 7 Dec 2023 18:20:19 +0000 Subject: [PATCH 2/3] bugfix to wrcmps for non-character values larger than 32 bits --- src/modules_arrs.F90 | 2 ++ src/wrcmps.f | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules_arrs.F90 b/src/modules_arrs.F90 index b8c56d81..930829b3 100644 --- a/src/modules_arrs.F90 +++ b/src/modules_arrs.F90 @@ -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. diff --git a/src/wrcmps.f b/src/wrcmps.f index 6552dd42..eb70804a 100644 --- a/src/wrcmps.f +++ b/src/wrcmps.f @@ -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 From d7eb86bab4f9e4fc073597e133614a8d2f360c49 Mon Sep 17 00:00:00 2001 From: Jeff Ator Date: Fri, 8 Dec 2023 17:37:14 +0000 Subject: [PATCH 3/3] new debufr test to verify rdcmps fix --- .github/workflows/Intel.yml | 2 +- .github/workflows/Linux.yml | 2 +- .github/workflows/MacOS.yml | 2 +- .github/workflows/developer.yml | 2 +- test/test_scripts/test_debufr.sh | 50 ++++++++++++++++++-------------- 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/.github/workflows/Intel.yml b/.github/workflows/Intel.yml index 9f569c51..bfbc571d 100644 --- a/.github/workflows/Intel.yml +++ b/.github/workflows/Intel.yml @@ -50,7 +50,7 @@ jobs: uses: actions/cache@v3 with: path: ~/data - key: data-10 + key: data-11 - name: build run: | diff --git a/.github/workflows/Linux.yml b/.github/workflows/Linux.yml index 4b6907ac..222353d6 100644 --- a/.github/workflows/Linux.yml +++ b/.github/workflows/Linux.yml @@ -40,7 +40,7 @@ jobs: uses: actions/cache@v3 with: path: ~/data - key: data-10 + key: data-11 - name: build run: | diff --git a/.github/workflows/MacOS.yml b/.github/workflows/MacOS.yml index 00970676..1b7b4326 100644 --- a/.github/workflows/MacOS.yml +++ b/.github/workflows/MacOS.yml @@ -44,7 +44,7 @@ jobs: uses: actions/cache@v3 with: path: ~/data - key: data-10 + key: data-11 - name: build-bufr run: | diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml index 718d0759..7493245f 100644 --- a/.github/workflows/developer.yml +++ b/.github/workflows/developer.yml @@ -38,7 +38,7 @@ jobs: uses: actions/cache@v3 with: path: ~/data - key: data-10 + key: data-11 - name: build-docs run: | diff --git a/test/test_scripts/test_debufr.sh b/test/test_scripts/test_debufr.sh index 4db77241..86beff7e 100755 --- a/test/test_scripts/test_debufr.sh +++ b/test/test_scripts/test_debufr.sh @@ -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