Skip to content

Commit

Permalink
more progress
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Dec 21, 2024
1 parent cd05c3d commit 5960bd7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
33 changes: 22 additions & 11 deletions src/g2cf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function g2cf_inq(g2id, num_msg) result(status)
implicit none

integer, intent(in) :: g2id
integer(c_int), intent(out) :: num_msg
integer, intent(out) :: num_msg
integer :: status

integer(c_int) :: cg2id, cnum_msg, cstatus
Expand Down Expand Up @@ -178,19 +178,30 @@ function g2cf_inq_msg(g2id, msg_num, discipline, num_fields, &
use g2c_interface
implicit none

integer, intent(in) :: g2id
integer(c_int), intent(in) :: msg_num
integer(c_signed_char), intent(out) :: discipline
integer(c_int), intent(out) :: num_fields, num_local
integer(c_short), intent(out) :: center, subcenter
integer(c_signed_char), intent(out) :: master_version, local_version
integer, intent(in) :: g2id, msg_num
integer, intent(out) :: discipline
integer, intent(out) :: num_fields, num_local
integer(kind = 2), intent(out) :: center, subcenter
integer(kind = 2), intent(out) :: master_version, local_version
integer :: status

integer(c_int) :: cg2id, cnum_msg, cstatus

integer(c_int) :: cg2id, cmsg_num, cstatus
integer(c_signed_char) :: cdiscipline
integer(c_int) :: cnum_fields, cnum_local
integer(c_short) :: ccenter, csubcenter
integer(c_signed_char) :: cmaster_version, clocal_version

cg2id = g2id
cstatus = g2c_inq(cg2id, cnum_msg)
!num_msg = cnum_msg
cmsg_num = msg_num
cstatus = g2c_inq_msg(cg2id, cmsg_num, cdiscipline, cnum_fields, &
cnum_local, ccenter, csubcenter, cmaster_version, clocal_version)
discipline = cdiscipline
num_fields = cnum_fields
num_local = cnum_local
center = ccenter
subcenter = csubcenter
master_version = cmaster_version
local_version = clocal_version
status = cstatus
end function g2cf_inq_msg

Expand Down
10 changes: 5 additions & 5 deletions tests/test_g2cf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ program test_g2cf
if (ierr .ne. 0) stop 10
if (num_msg .ne. 19) stop 11

! ! Check the last message.
! ierr = g2cf_inq_msg(g2cid, 19, discipline, num_fields, num_local, center, subcenter, &
! master_version, local_version)
! if (discipline .ne. 10 .or. num_fields .ne. 1 .or. num_local .ne. 0 .or. center .ne. 7 .or. &
! subcenter .ne. 0 .or. master_version .ne. 2 .or. local_version .ne. 1) stop 12
! Check the last message.
ierr = g2cf_inq_msg(g2cid, 19, discipline, num_fields, num_local, center, subcenter, &
master_version, local_version)
if (discipline .ne. 10 .or. num_fields .ne. 1 .or. num_local .ne. 0 .or. center .ne. 7 .or. &
subcenter .ne. 0 .or. master_version .ne. 2 .or. local_version .ne. 1) stop 12

! Close the file.
ierr = g2cf_close(g2cid)
Expand Down

0 comments on commit 5960bd7

Please sign in to comment.