Skip to content

Commit

Permalink
checking result
Browse files Browse the repository at this point in the history
  • Loading branch information
AlysonStahl-NOAA committed Dec 3, 2024
1 parent 0252924 commit 1cc9aa8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ copy_test_data(ref_gdaswave.t00z.wcoast.0p16.f000.grb2index2)
copy_test_data(g1.grib2)
copy_test_data(gdaswave.t00z.wcoast.0p16.f000.grib2)
copy_test_data(ref_test_jpcpack_4_output.txt)
copy_test_data(ref_png_bitmap.grib2)
copy_test_data(ref_jpeg_bitmap.grib2)

# Build a _4 and _d version of each test and link them to the _4 and
# _d builds of the library, for 4-byte real, and 8-byte real.
Expand Down
Binary file removed tests/data/ref_png_bitmap.grib2
Binary file not shown.
46 changes: 31 additions & 15 deletions tests/test_bitmap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ program test_bitmap
implicit none

character(*) :: BITMAP_FILE
parameter(BITMAP_FILE = 'data/ref_png_bitmap.grib2')
parameter(BITMAP_FILE = 'data/ref_jpeg_bitmap.grib2')
character(*) :: BITMAP_FILE_INDEX
parameter(BITMAP_FILE_INDEX = 'test_bitmap_index.grb2index')

Expand All @@ -18,10 +18,11 @@ program test_bitmap

integer :: idxver = 2, j = 0, jdisc = 0, jpdtn = 0, jgdtn = 0
integer :: iret, k, i
integer :: jids(13) = (/ 57, 90, 2, 0, 0, 2021, 4, 25, 0, 0, 0, 0, 1/)
integer :: jpdt(15) = (/ 19, 10, 0, 0, 92, 0, 0, 1, 0, 105, 0, 10, 255, 0, 255 /)
integer :: jgdt(19) = (/ 6, 0, 0, 0, 0, 0, 0, 5760, 2882, 0, 0, -90000000, &
180000000, 48, 90000000, 179937500, 62500, 62500, 64/)
integer :: jids(13), jpdt(15), jgdt(19)
!integer :: jids(13) = (/ 7, 0, 2, 1, 1, 2021, 11, 30, 0, 0, 0, 0, 1/)
!integer :: jpdt(15) = (/ 2, 1, 2, 0, 92, 0, 0, 1, 0, 105, 0, 10, 255, 0, 255 /)
!integer :: jgdt(19) = (/ 6, 0, 0, 0, 0, 0, 0, 5760, 2882, 0, 0, -90000000, &
! 180000000, 48, 90000000, 179937500, 62500, 62500, 64/)
logical :: unpack = .true.
integer :: expected_idrtmpl(5) = (/ 0, 0, 0, 3, 0 /)
type(gribfield) :: gfld
Expand All @@ -45,28 +46,43 @@ end subroutine g2_create_index
call g2_create_index(lugb, lugi, idxver, BITMAP_FILE, iret)
if (iret .ne. 0) stop 4

jids = -9999
jpdt = -9999,
jgdt = -9999
call getgb2i2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, &
jgdt, unpack, idxver, k, gfld, iret)
if (iret .ne. 0) stop 10
if (k .ne. 1) stop 11
if (gfld%version .ne. 2 .or. gfld%discipline .ne. 0 .or. gfld%idsectlen .ne. 13 .or. &
gfld%locallen .ne. 0 .or. gfld%ifldnum .ne. 1 .or. gfld%griddef .ne. 0 .or. &
gfld%ngrdpts .ne. 16600320 .or. gfld%numoct_opt .ne. 0 .or. gfld%interp_opt .ne. 0 .or. &
gfld%num_opt .ne. 0 .or. gfld%igdtnum .ne. 0 .or. gfld%igdtlen .ne. 19 .or. &
gfld%ipdtnum .ne. 0 .or. gfld%ipdtlen .ne. 15 .or. gfld%ndpts .ne. 16600303 .or. &
gfld%idrtnum .ne. 0 .or. gfld%idrtlen .ne. 5 .or. gfld%unpacked .neqv. .false. .or. &
gfld%expanded .neqv. .true. .or. gfld%ibmap .ne. 0) stop 12
!if (gfld%version .ne. 2 .or. gfld%discipline .ne. 0 .or. gfld%idsectlen .ne. 13 .or. &
! gfld%locallen .ne. 0 .or. gfld%ifldnum .ne. 1 .or. gfld%griddef .ne. 0 .or. &
! gfld%ngrdpts .ne. 16600320 .or. gfld%numoct_opt .ne. 0 .or. gfld%interp_opt .ne. 0 .or. &
! gfld%num_opt .ne. 0 .or. gfld%igdtnum .ne. 0 .or. gfld%igdtlen .ne. 19 .or. &
! gfld%ipdtnum .ne. 0 .or. gfld%ipdtlen .ne. 15 .or. gfld%ndpts .ne. 16600303 .or. &
! gfld%idrtnum .ne. 0 .or. gfld%idrtlen .ne. 5 .or. gfld%unpacked .neqv. .false. .or. &
! gfld%expanded .neqv. .true. .or. gfld%ibmap .ne. 0) stop 12

do i=1,5
if (gfld%idrtmpl(i) .ne. expected_idrtmpl(i)) stop 23
do i=1,13
print *, gfld%idsect(i)
enddo
print *, "pdt"
do i=1,gfld%ipdtlen
print *, gfld%ipdtmpl(i)
enddo
print *, "gdt"
do i=1,gfld%igdtlen
print *, gfld%igdtmpl(i)
enddo
print *, "drt"
do i=1,gfld%idrtlen
print *, gfld%idrtmpl(i)
enddo

call baclose(lugb, iret)
if (iret .ne. 0) stop 100
call baclose(lugi, iret)
if (iret .ne. 0) stop 101

! Free resources.
call gf_free(gfld)
call gf_finalize(iret)
if (iret .ne. 0) stop 102

Expand Down

0 comments on commit 1cc9aa8

Please sign in to comment.