diff --git a/src/copysb.f b/src/copysb.f index e5f026da..76f503b8 100644 --- a/src/copysb.f +++ b/src/copysb.f @@ -6,16 +6,6 @@ C> This subroutine copies a BUFR data subset from one Fortran logical C> unit to another. C> -C> @param[in] LUNIN -- integer: Fortran logical unit number for -C> source BUFR file -C> @param[in] LUNOT -- integer: Fortran logical unit number for -C> target BUFR file -C> @param[out] IRET -- integer: return code -C> - 0 = normal return -C> - -1 = a BUFR data subset could not be -C> read from the BUFR message in -C> internal arrays for LUNIN -C> C> Logical unit LUNIN should have already been opened for input C> operations via a previous call to subroutine openbf(), and a BUFR C> message should have already been read into internal arrays for @@ -39,6 +29,16 @@ C> definitions for the type of BUFR message containing the data C> subset to be copied from LUNIN to LUNOT. C> +C> @param[in] LUNIN -- integer: Fortran logical unit number for +C> source BUFR file +C> @param[in] LUNOT -- integer: Fortran logical unit number for +C> target BUFR file +C> @param[out] IRET -- integer: return code +C> - 0 = normal return +C> - -1 = a BUFR data subset could not be +C> read from the BUFR message in +C> internal arrays for LUNIN +C> C> @author J. Woollen @date 1994-01-06 RECURSIVE SUBROUTINE COPYSB(LUNIN,LUNOT,IRET) diff --git a/src/stndrd.f b/src/stndrd.f index 2b04f827..4cbfa76f 100644 --- a/src/stndrd.f +++ b/src/stndrd.f @@ -9,6 +9,12 @@ C> whereas stdmsg() operates on BUFR messages stored internally C> within the software. C> +C> @remarks +C> - MSGIN and MSGOT must be separate arrays. +C> - Standardized messages are usually longer in length than their +C> non-standard counterparts, so it's usually a good idea to allow +C> for extra space when allocating MSGOT within the application program. +C> C> @param[in] LUNIT -- integer: Fortran logical unit number for C> BUFR file C> @param[in] MSGIN -- integer(*): BUFR message @@ -17,12 +23,6 @@ C> it doesn't overflow the MSGOT array C> @param[out] MSGOT -- integer(*): Standardized copy of MSGIN C> -C> @remarks -C> - MSGIN and MSGOT must be separate arrays. -C> - Standardized messages are usually longer in length than their -C> non-standard counterparts, so it's usually a good idea to allow -C> for extra space when allocating MSGOT within the application program. -C> C> @author J. Ator @date 2004-08-18 RECURSIVE SUBROUTINE STNDRD(LUNIT,MSGIN,LMSGOT,MSGOT) diff --git a/src/ufbcnt.f b/src/ufbcnt.f index cb74a727..dd49e486 100644 --- a/src/ufbcnt.f +++ b/src/ufbcnt.f @@ -1,6 +1,6 @@ C> @file C> @brief Get the current message number and data subset number within -C> a BUFR file +C> a BUFR file. C> C> @author J. Woollen @date 1994-01-06 @@ -9,15 +9,6 @@ C> beginning of the file, and a data subset number counting from the C> beginning of that message. C> -C> @param[in] LUNIT -- integer: Fortran logical unit number for BUFR file -C> @param[out] KMSG -- integer: Ordinal number of current message, -C> counting from the beginning of the BUFR file, but -C> not counting any messages which contain DX BUFR -C> tables information -C> @param[out] KSUB -- integer: Ordinal number of current data subset -C> within (KMSG)th message, counting from the -C> beginning of the message -C> C> @remarks C> - Logical unit LUNIT should have already been opened via a previous C> call to subroutine openbf(). If LUNIT was opened for input @@ -33,6 +24,15 @@ C> - The value returned for KMSG does not include any messages C> which contain DX BUFR tables information. C> +C> @param[in] LUNIT -- integer: Fortran logical unit number for BUFR file +C> @param[out] KMSG -- integer: Ordinal number of current message, +C> counting from the beginning of the BUFR file, but +C> not counting any messages which contain DX BUFR +C> tables information +C> @param[out] KSUB -- integer: Ordinal number of current data subset +C> within (KMSG)th message, counting from the +C> beginning of the message +C> C> @author J. Woollen @date 1994-01-06 RECURSIVE SUBROUTINE UFBCNT(LUNIT,KMSG,KSUB) diff --git a/src/ufbevn.f b/src/ufbevn.f index d22365f3..df777b4d 100644 --- a/src/ufbevn.f +++ b/src/ufbevn.f @@ -14,26 +14,6 @@ C> this subroutine is used for NCEP prepbufr files and stores the C> same information internally within a COMMON block. C> -C> @param[in] LUNIT -- integer: Fortran logical unit number for -C> NCEP prepbufr file -C> @param[out] USR -- real*8(*,*): Data values -C> @param[in] I1 -- integer: First dimension of USR as allocated -C> within the calling program -C> @param[in] I2 -- integer: Second dimension of USR as allocated -C> within the calling program -C> @param[in] I3 -- integer: Third dimension of USR as allocated -C> within the calling program -C> @param[out] IRET -- integer: Number of replications of STR that were -C> read from the data subset, corresponding -C> to the second dimension of USR -C> @param[in] STR -- character*(*): String of blank-separated -C> Table B mnemonics -C> in one-to-one correspondence with the number of data -C> values that will be read from the data -C> subset within the first dimension of USR (see -C> [DX BUFR Tables](@ref dfbftab) for further -C> information about Table B mnemonics) -C> C> It is the user's responsibility to ensure that USR is dimensioned C> sufficiently large enough to accommodate the number of data values C> that are to be read from the data subset. Note also @@ -70,6 +50,26 @@ C> the BUFR message pointed to by IREC, counting from C> the beginning of the message C> +C> @param[in] LUNIT -- integer: Fortran logical unit number for +C> NCEP prepbufr file +C> @param[out] USR -- real*8(*,*): Data values +C> @param[in] I1 -- integer: First dimension of USR as allocated +C> within the calling program +C> @param[in] I2 -- integer: Second dimension of USR as allocated +C> within the calling program +C> @param[in] I3 -- integer: Third dimension of USR as allocated +C> within the calling program +C> @param[out] IRET -- integer: Number of replications of STR that were +C> read from the data subset, corresponding +C> to the second dimension of USR +C> @param[in] STR -- character*(*): String of blank-separated +C> Table B mnemonics +C> in one-to-one correspondence with the number of data +C> values that will be read from the data +C> subset within the first dimension of USR (see +C> [DX BUFR Tables](@ref dfbftab) for further +C> information about Table B mnemonics) +C> C> @author J. Woollen @date 1994-01-06 RECURSIVE SUBROUTINE UFBEVN(LUNIT,USR,I1,I2,I3,IRET,STR) diff --git a/src/ufbstp.f b/src/ufbstp.f index 6791b436..5ace596b 100644 --- a/src/ufbstp.f +++ b/src/ufbstp.f @@ -26,36 +26,6 @@ C> also designed for different use cases as noted in C> [DX BUFR Tables](@ref ufbsubs). C> -C> @param[in] LUNIN -- integer: Absolute value is Fortran logical -C> unit number for BUFR file -C> @param[in,out] USR -- real*8(*,*): Data values -C> - If ABS(LUNIN) was opened for input, then -C> USR is output from this subroutine and -C> contains data values that were read -C> from the current data subset. -C> - If ABS(LUNIN) was opened for output, then -C> USR is input to this subroutine and -C> contains data values that are to be -C> written to the current data subset. -C> @param[in] I1 -- integer: First dimension of USR as allocated -C> within the calling program -C> @param[in] I2 -- integer: -C> - If ABS(LUNIN) was opened for input, then I2 -C> must be set equal to the second dimension -C> of USR as allocated within the calling program -C> - If ABS(LUNIN) was opened for output, then I2 -C> must be set equal to the number of replications -C> of STR that are to be written to the data subset -C> @param[out] IRET -- integer: Number of replications of STR that were -C> read/written from/to the data subset -C> @param[in] STR -- character*(*): String of blank-separated -C> Table B mnemonics -C> in one-to-one correspondence with the number of data -C> values that will be read/written from/to the data -C> subset within the first dimension of USR (see -C> [DX BUFR Tables](@ref dfbftab) for further -C> information about Table B mnemonics) -C> C> It is the user's responsibility to ensure that USR is dimensioned C> sufficiently large enough to accommodate the number of data values C> that are to be read from or written to the data subset. Note also @@ -111,6 +81,36 @@ C> that need to read certain values back out from a BUFR file during C> the same time that it is in the process of being written to. C> +C> @param[in] LUNIN -- integer: Absolute value is Fortran logical +C> unit number for BUFR file +C> @param[in,out] USR -- real*8(*,*): Data values +C> - If ABS(LUNIN) was opened for input, then +C> USR is output from this subroutine and +C> contains data values that were read +C> from the current data subset. +C> - If ABS(LUNIN) was opened for output, then +C> USR is input to this subroutine and +C> contains data values that are to be +C> written to the current data subset. +C> @param[in] I1 -- integer: First dimension of USR as allocated +C> within the calling program +C> @param[in] I2 -- integer: +C> - If ABS(LUNIN) was opened for input, then I2 +C> must be set equal to the second dimension +C> of USR as allocated within the calling program +C> - If ABS(LUNIN) was opened for output, then I2 +C> must be set equal to the number of replications +C> of STR that are to be written to the data subset +C> @param[out] IRET -- integer: Number of replications of STR that were +C> read/written from/to the data subset +C> @param[in] STR -- character*(*): String of blank-separated +C> Table B mnemonics +C> in one-to-one correspondence with the number of data +C> values that will be read/written from/to the data +C> subset within the first dimension of USR (see +C> [DX BUFR Tables](@ref dfbftab) for further +C> information about Table B mnemonics) +C> C> @author J. Woollen @date 1994-01-06 RECURSIVE SUBROUTINE UFBSTP(LUNIN,USR,I1,I2,IRET,STR) diff --git a/src/valx.f b/src/valx.f index 2ea03f60..7824a027 100644 --- a/src/valx.f +++ b/src/valx.f @@ -1,5 +1,5 @@ C> @file -C> @brief Decode a real number from a character string +C> @brief Decode a real number from a character string. C> C> @author J. Woollen @date 1994-01-06 diff --git a/test/run_test_bort.sh b/test/run_test_bort.sh index 2254547f..de650c13 100644 --- a/test/run_test_bort.sh +++ b/test/run_test_bort.sh @@ -27,6 +27,108 @@ ./test_bort_4 cmpmsg 1 [ $? != 1 ] && exit 1 +# Check codflg(). +./test_bort_4 codflg 1 +[ $? != 1 ] && exit 1 + +# Check copybf(). +./test_bort_4 copybf 1 +[ $? != 1 ] && exit 1 + +# Check copymg(). +./test_bort_4 copymg 1 +[ $? != 1 ] && exit 1 + +# Check copysb(). +./test_bort_4 copysb 1 +[ $? != 1 ] && exit 1 + +# Check sntbbe(). +./test_bort_4 sntbbe 1 +[ $? != 1 ] && exit 1 + +# Check sntbde(). +./test_bort_4 sntbde 1 +[ $? != 1 ] && exit 1 + +# Check stdmsg(). +./test_bort_4 stdmsg 1 +[ $? != 1 ] && exit 1 + +# Check stndrd(). +./test_bort_4 stndrd 1 +[ $? != 1 ] && exit 1 + +# Check strcpt(). +./test_bort_4 strcpt 1 +[ $? != 1 ] && exit 1 + +# Commented out until https://github.com/NOAA-EMC/NCEPLIBS-bufr/issues/384 +# is resolved. +# Check string(). +#./test_bort_4 string 1 +#[ $? != 1 ] && exit 1 + +# Check ufbcnt(). +./test_bort_4 ufbcnt 1 +[ $? != 1 ] && exit 1 + +# Check ufbcpy(). +./test_bort_4 ufbcpy 1 +[ $? != 1 ] && exit 1 + +# Check ufbcup(). +./test_bort_4 ufbcup 1 +[ $? != 1 ] && exit 1 + +# Check ufbdmp(). +./test_bort_4 ufbdmp 1 +[ $? != 1 ] && exit 1 + +# Check ufbevn(). +./test_bort_4 ufbevn 1 +[ $? != 1 ] && exit 1 + +# Check ufbget(). +./test_bort_4 ufbget 1 +[ $? != 1 ] && exit 1 + +# Check ufbint(). +./test_bort_4 ufbint 1 +[ $? != 1 ] && exit 1 + +# Check ufbqcp(). +./test_bort_4 ufbqcp 1 +[ $? != 1 ] && exit 1 + +# Check ufbrep(). +./test_bort_4 ufbrep 1 +[ $? != 1 ] && exit 1 + +# Check ufbrms(). +./test_bort_4 ufbrms 1 +[ $? != 1 ] && exit 1 + +# Check ufbseq(). +./test_bort_4 ufbseq 1 +[ $? != 1 ] && exit 1 + +# Check ufdump(). +./test_bort_4 ufdump 1 +[ $? != 1 ] && exit 1 + +# Check upftbv(). +./test_bort_4 upftbv 1 +[ $? != 1 ] && exit 1 + +# Check valx(). +./test_bort_4 valx 1 +[ $? != 1 ] && exit 1 + +# Check wrdxtb(). +./test_bort_4 wrdxtb 1 +[ $? != 1 ] && exit 1 + # Check wtstat(). ./test_bort_4 wtstat 1 [ $? != 1 ] && exit 1 diff --git a/test/test_bort.F90 b/test/test_bort.F90 index e655912e..de49e7c6 100644 --- a/test/test_bort.F90 +++ b/test/test_bort.F90 @@ -6,8 +6,19 @@ ! Ed Hartnett 3/12/23 program test_bort implicit none + integer iret + ! integer i1 + integer int_1d(1), int_1d_2(1) character*2 char_short character*30 char_30 + character*4 char_4(1) + character*8 char_8(1) + character*12 char_12(1) + character*24 char_24(1) + character*120 char_120(1) + real r, valx + real*8 real_1d(1) + real*8 real_2d(1,1) integer :: num_args, len, status character(len=32) :: sub_name, test_case @@ -50,6 +61,108 @@ program test_bort if (test_case .eq. '1') then call cmpmsg('W') endif + elseif (sub_name .eq. 'codflg') then + if (test_case .eq. '1') then + call codflg('W') + endif + elseif (sub_name .eq. 'copybf') then + if (test_case .eq. '1') then + call copybf(0, 0) + endif + elseif (sub_name .eq. 'copymg') then + if (test_case .eq. '1') then + call copymg(0, 0) + endif + elseif (sub_name .eq. 'copysb') then + if (test_case .eq. '1') then + call copysb(0, 0, iret) + endif + elseif (sub_name .eq. 'sntbbe') then + if (test_case .eq. '1') then + call sntbbe(0, 'c', 1, 2, int_1d, char_4, char_12, char_4, char_24, char_8, char_4, char_120) + endif + elseif (sub_name .eq. 'sntbde') then + if (test_case .eq. '1') then + call sntbde(0, 0, 'c', 1, 1, 2, int_1d, char_8, char_4, char_120, int_1d_2, int_1d, char_120) + endif + elseif (sub_name .eq. 'stdmsg') then + if (test_case .eq. '1') then + call stdmsg('W') + endif + elseif (sub_name .eq. 'stndrd') then + if (test_case .eq. '1') then + call stndrd(0, int_1d, 1, int_1d_2) + endif + elseif (sub_name .eq. 'strcpt') then + if (test_case .eq. '1') then + call strcpt('W', 1960, 12, 15, 12, 0) + endif + ! Next test commented out until + ! https://github.com/NOAA-EMC/NCEPLIBS-bufr/issues/384 is resolved. + ! elseif (sub_name .eq. 'string') then if (test_case .eq. '1') then + ! call + ! STRING('0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', + ! & 1, i1, 0) endif + elseif (sub_name .eq. 'ufbcnt') then + if (test_case .eq. '1') then + call ufbcnt(0, 1, 1) + endif + elseif (sub_name .eq. 'ufbcpy') then + if (test_case .eq. '1') then + call ufbcpy(0, 0) + endif + elseif (sub_name .eq. 'ufbcup') then + if (test_case .eq. '1') then + call ufbcup(0, 0) + endif + elseif (sub_name .eq. 'ufbdmp') then + if (test_case .eq. '1') then + call ufbdmp(0, 0) + endif + elseif (sub_name .eq. 'ufbevn') then + if (test_case .eq. '1') then + call ufbevn(0, real_2d, 1, 2, 3, iret, 'c') + endif + elseif (sub_name .eq. 'ufbget') then + if (test_case .eq. '1') then + call ufbget(0, real_1d, 1, iret, 's') + endif + elseif (sub_name .eq. 'ufbint') then + if (test_case .eq. '1') then + call ufbint(0, real_2d, 1, 2, iret, 'c') + endif + elseif (sub_name .eq. 'ufbqcp') then + if (test_case .eq. '1') then + call ufbqcp(0, 0, 'c') + endif + elseif (sub_name .eq. 'ufbrep') then + if (test_case .eq. '1') then + call ufbrep(0, real_2d, 1, 2, iret, 'c') + endif + elseif (sub_name .eq. 'ufbrms') then + if (test_case .eq. '1') then + call ufbrms(1, 1, real_2d, 1, 2, iret, 'c') + endif + elseif (sub_name .eq. 'ufbseq') then + if (test_case .eq. '1') then + call ufbseq(0, real_2d, 1, 2, iret, 'c') + endif + elseif (sub_name .eq. 'ufdump') then + if (test_case .eq. '1') then + call ufdump(0, 0) + endif + elseif (sub_name .eq. 'upftbv') then + if (test_case .eq. '1') then + call upftbv(0, 'n', 1.0, 1, 1, 1) + endif + elseif (sub_name .eq. 'valx') then + if (test_case .eq. '1') then + r = valx('0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789') + endif + elseif (sub_name .eq. 'wrdxtb') then + if (test_case .eq. '1') then + call wrdxtb(0, 0) + endif elseif (sub_name .eq. 'writdx') then if (test_case .eq. '1') then call writdx(0, 0, 0)