From 92c9d86df773543e0ee709904269c6c990bc28fa Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sat, 21 Dec 2024 04:54:15 -0700 Subject: [PATCH 01/33] changing package file --- spack/package.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spack/package.py b/spack/package.py index f3830d88..079699f3 100644 --- a/spack/package.py +++ b/spack/package.py @@ -1,4 +1,4 @@ -# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -29,6 +29,9 @@ class G2(CMakePackage): version("3.4.5", sha256="c18e991c56964953d778632e2d74da13c4e78da35e8d04cb742a2ca4f52737b6") version("3.4.3", sha256="679ea99b225f08b168cbf10f4b29f529b5b011232f298a5442ce037ea84de17c") + depends_on("c", type="build") + depends_on("fortran", type="build") + variant("pic", default=True, description="Build with position-independent-code") variant( "precision", From 118f53d91ff91c1288013ad043600d922035053e Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sat, 21 Dec 2024 05:52:03 -0700 Subject: [PATCH 02/33] changing package file --- spack/package.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spack/package.py b/spack/package.py index 079699f3..369e2c3e 100644 --- a/spack/package.py +++ b/spack/package.py @@ -43,9 +43,9 @@ class G2(CMakePackage): ) variant("w3emc", default=True, description="Enable GRIB1 through w3emc", when="@3.4.6:") variant("aec", default=True, description="Use AEC library", when="@develop") - variant("shared", default="False", when="@3.4.7:") - variant("openmp", default=False, description="Use OpenMP multithreading") - variant("utils", default=False, description="Build grib utilities") + variant("shared", default="False", description="Build shared library", when="@3.4.7:") + variant("openmp", default=False, description="Use OpenMP multithreading", when="@develop") + variant("utils", default=False, description="Build grib utilities", when="@develop") variant("g2c_compare", default=False, description="Enable copygb2 tests using g2c_compare") depends_on("jasper@:2.0.32", when="@:3.4.7") From 0124dabeb5d798b3f070e4dccee7142004be7987 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sat, 21 Dec 2024 06:04:10 -0700 Subject: [PATCH 03/33] changing package file --- spack/package.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spack/package.py b/spack/package.py index 369e2c3e..118fcf03 100644 --- a/spack/package.py +++ b/spack/package.py @@ -46,7 +46,12 @@ class G2(CMakePackage): variant("shared", default="False", description="Build shared library", when="@3.4.7:") variant("openmp", default=False, description="Use OpenMP multithreading", when="@develop") variant("utils", default=False, description="Build grib utilities", when="@develop") - variant("g2c_compare", default=False, description="Enable copygb2 tests using g2c_compare") + variant( + "g2c_compare", + default=False, + description="Enable copygb2 tests using g2c_compare", + when="@2.0.0:", + ) depends_on("jasper@:2.0.32", when="@:3.4.7") depends_on("jasper") From e4c745c38e04a9e444bf0c5f18ba0a8979b2fc9e Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sat, 21 Dec 2024 06:12:06 -0700 Subject: [PATCH 04/33] changing package file --- spack/package.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spack/package.py b/spack/package.py index 118fcf03..cede9213 100644 --- a/spack/package.py +++ b/spack/package.py @@ -58,10 +58,10 @@ class G2(CMakePackage): depends_on("g2c@2.0.0:", when="@develop") depends_on("g2c@2.0.0 +aec", when="+aec") depends_on("libpng") - depends_on("zlib-api") + depends_on("zlib-api", when="@develop") depends_on("bacio", when="@3.4.6:") - depends_on("ip") - depends_on("ip precision=d", when="^ip@4.1:") + depends_on("ip", when="@develop") + requires("^ip precision=d", when="^ip@4.1:") depends_on("sp", when="^ip@:4") depends_on("sp precision=d", when="^ip@:4 ^sp@2.4:") depends_on("g2c@2.0: +utils", when="+g2c_compare") From 122e7496ce221b6491e8ad382b0654c66c09ddb3 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sat, 21 Dec 2024 06:18:27 -0700 Subject: [PATCH 05/33] changing package file --- spack/package.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spack/package.py b/spack/package.py index cede9213..f6e2e814 100644 --- a/spack/package.py +++ b/spack/package.py @@ -92,10 +92,15 @@ def setup_run_environment(self, env): self.spec.variants["precision"].value if self.spec.satisfies("@3.4.6:") else ("4", "d") ) for suffix in precisions: - lib = find_libraries("libg2_" + suffix, root=self.prefix, shared=self.spec.satisfies("+shared"), recursive=True) + lib = find_libraries( + "libg2_" + suffix, + root=self.prefix, + shared=self.spec.satisfies("+shared"), + recursive=True, + ) env.set("G2_LIB" + suffix, lib[0]) env.set("G2_INC" + suffix, join_path(self.prefix, "include_" + suffix)) def check(self): - with working_dir(self.builder.build_directory): + with working_dir(self.build_directory): make("test") From fc5a725aaaacb370d39944a8762c726d5dd88f2e Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sat, 21 Dec 2024 06:21:09 -0700 Subject: [PATCH 06/33] changing package file --- spack/package.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/spack/package.py b/spack/package.py index f6e2e814..cede9213 100644 --- a/spack/package.py +++ b/spack/package.py @@ -92,15 +92,10 @@ def setup_run_environment(self, env): self.spec.variants["precision"].value if self.spec.satisfies("@3.4.6:") else ("4", "d") ) for suffix in precisions: - lib = find_libraries( - "libg2_" + suffix, - root=self.prefix, - shared=self.spec.satisfies("+shared"), - recursive=True, - ) + lib = find_libraries("libg2_" + suffix, root=self.prefix, shared=self.spec.satisfies("+shared"), recursive=True) env.set("G2_LIB" + suffix, lib[0]) env.set("G2_INC" + suffix, join_path(self.prefix, "include_" + suffix)) def check(self): - with working_dir(self.build_directory): + with working_dir(self.builder.build_directory): make("test") From 77fd1dde5e34287531bea36ef17cae562dae05cf Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sat, 21 Dec 2024 06:27:56 -0700 Subject: [PATCH 07/33] changing package file --- spack/package.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spack/package.py b/spack/package.py index cede9213..0b78d919 100644 --- a/spack/package.py +++ b/spack/package.py @@ -92,7 +92,12 @@ def setup_run_environment(self, env): self.spec.variants["precision"].value if self.spec.satisfies("@3.4.6:") else ("4", "d") ) for suffix in precisions: - lib = find_libraries("libg2_" + suffix, root=self.prefix, shared=self.spec.satisfies("+shared"), recursive=True) + lib = find_libraries( + "libg2_" + suffix, + root=self.prefix, + shared=self.spec.satisfies("+shared"), + recursive=True, + ) env.set("G2_LIB" + suffix, lib[0]) env.set("G2_INC" + suffix, join_path(self.prefix, "include_" + suffix)) From c125b429c63fb821fc4ec3f9c91c6b28a28a0e1d Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sat, 21 Dec 2024 07:45:18 -0700 Subject: [PATCH 08/33] fortran wrapper for g2c_inq() --- src/g2c_interface.F90 | 8 ++++++++ src/g2cf.F90 | 24 ++++++++++++++++++++++++ tests/test_g2cf.F90 | 8 ++++---- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/g2c_interface.F90 b/src/g2c_interface.F90 index b97d3737..8418a99f 100644 --- a/src/g2c_interface.F90 +++ b/src/g2c_interface.F90 @@ -23,6 +23,13 @@ function g2c_open_index(data_file, index_file, mode, g2cid) bind(c) integer(c_int) :: g2c_open_index end function g2c_open_index + function g2c_inq(g2id, num_msg) bind(c) + use iso_c_binding + integer(c_int), value :: g2id + integer(c_int), intent(out) :: num_msg + integer(c_int) :: g2c_inq + end function g2c_inq + ! int g2c_inq(int g2cid, int *num_msg); ! int g2c_inq_msg(int g2cid, int msg_num, unsigned char *discipline, int *num_fields, ! int *num_local, short *center, short *subcenter, unsigned char *master_version, @@ -32,6 +39,7 @@ function g2c_close(g2id) bind(c) integer(c_int), value :: g2id integer(c_int) :: g2c_close end function g2c_close + function g2c_set_log_level(log_level) bind(c) use iso_c_binding integer(c_int), intent(in) :: log_level diff --git a/src/g2cf.F90 b/src/g2cf.F90 index faf96440..ee318fec 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -132,6 +132,30 @@ function g2cf_open_index(data_file, index_file, mode, g2cid) result (status) status = cstatus end function g2cf_open_index + !> Close a GRIB2 file. + !> + !> @param g2id The ID of the open file + !> + !> @return 0 for success, error code otherwise. + !> + !> @author Edward Hartnett @date 2024-06-12 + function g2cf_inq(g2id, num_msg) result(status) + use iso_c_binding + use g2c_interface + implicit none + + integer, intent(in) :: g2id + integer(c_int), intent(out) :: num_msg + integer :: status + + integer(c_int) :: cg2id, cnum_msg, cstatus + + cg2id = g2id + cstatus = g2c_inq(cg2id, cnum_msg) + num_msg = cnum_msg + status = cstatus + end function g2cf_inq + !> Close a GRIB2 file. !> !> @param g2id The ID of the open file diff --git a/tests/test_g2cf.F90 b/tests/test_g2cf.F90 index 0e284f1a..cb6e2aa0 100644 --- a/tests/test_g2cf.F90 +++ b/tests/test_g2cf.F90 @@ -21,10 +21,10 @@ program test_g2cf ierr = g2cf_open(fileName, 0, g2cid) if (ierr .ne. 0) stop 2 - ! ! Check number of messages. - ! ierr = g2cf_inq(g2cid, num_msg) - ! if (ierr .ne. 0) stop 10 - ! if (num_msg .ne. 19) stop 11 + ! Check number of messages. + ierr = g2cf_inq(g2cid, num_msg) + 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, & From df1cf259fa43a6cfb2b752155d572aa5faaf8166 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sat, 21 Dec 2024 08:27:02 -0700 Subject: [PATCH 09/33] fortran wrapper for g2c_inq() --- src/g2cf.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/g2cf.F90 b/src/g2cf.F90 index ee318fec..a46d3add 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -132,13 +132,14 @@ function g2cf_open_index(data_file, index_file, mode, g2cid) result (status) status = cstatus end function g2cf_open_index - !> Close a GRIB2 file. + !> Learn how many messages are in a GRIB2 file. !> !> @param g2id The ID of the open file + !> @param num_msg The number of messages in the file. !> !> @return 0 for success, error code otherwise. !> - !> @author Edward Hartnett @date 2024-06-12 + !> @author Edward Hartnett @date 2024-12-21 function g2cf_inq(g2id, num_msg) result(status) use iso_c_binding use g2c_interface From cd05c3da86c053c2848d8ddc8138286a2e84e83e Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sat, 21 Dec 2024 08:40:56 -0700 Subject: [PATCH 10/33] more progress --- src/g2c_interface.F90 | 13 ++++++++++++- src/g2cf.F90 | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/g2c_interface.F90 b/src/g2c_interface.F90 index 8418a99f..05c145ca 100644 --- a/src/g2c_interface.F90 +++ b/src/g2c_interface.F90 @@ -30,7 +30,18 @@ function g2c_inq(g2id, num_msg) bind(c) integer(c_int) :: g2c_inq end function g2c_inq - ! int g2c_inq(int g2cid, int *num_msg); + function g2c_inq_msg(g2id, msg_num, discipline, num_fields, & + num_local, center, subcenter, master_version, local_version) bind(c) + use iso_c_binding + integer(c_int), value :: 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(c_int) :: g2c_inq_msg + end function g2c_inq_msg + ! int g2c_inq_msg(int g2cid, int msg_num, unsigned char *discipline, int *num_fields, ! int *num_local, short *center, short *subcenter, unsigned char *master_version, ! unsigned char *local_version); diff --git a/src/g2cf.F90 b/src/g2cf.F90 index a46d3add..816e20bf 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -157,6 +157,43 @@ function g2cf_inq(g2id, num_msg) result(status) status = cstatus end function g2cf_inq + !> Learn about a message are in a GRIB2 file. + !> + !> @param[in] g2id The ID of the open file + !> @param[in] msg_num The number of message to learn about. + !> @param[out] discipline The discipline of the message. + !> @param[out] num_fields Number of fields in the message. + !> @param[out] num_local Number of local sections in the message. + !> @param[out] center Originating center. + !> @param[out] subcenter Originating sub-center. + !> @param[out] master_version Master version. + !> @param[out] local_version Local version. + !> + !> @return 0 for success, error code otherwise. + !> + !> @author Edward Hartnett @date 2024-12-21 + function g2cf_inq_msg(g2id, msg_num, discipline, num_fields, & + num_local, center, subcenter, master_version, local_version) result(status) + use iso_c_binding + 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 :: status + + integer(c_int) :: cg2id, cnum_msg, cstatus + + cg2id = g2id + cstatus = g2c_inq(cg2id, cnum_msg) + !num_msg = cnum_msg + status = cstatus + end function g2cf_inq_msg + !> Close a GRIB2 file. !> !> @param g2id The ID of the open file From 5960bd7d6158c0732c85b5cba9567bccd61ca5dd Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sat, 21 Dec 2024 09:43:29 -0700 Subject: [PATCH 11/33] more progress --- src/g2cf.F90 | 33 ++++++++++++++++++++++----------- tests/test_g2cf.F90 | 10 +++++----- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/g2cf.F90 b/src/g2cf.F90 index 816e20bf..4e7a3962 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -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 @@ -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 diff --git a/tests/test_g2cf.F90 b/tests/test_g2cf.F90 index cb6e2aa0..474d3da9 100644 --- a/tests/test_g2cf.F90 +++ b/tests/test_g2cf.F90 @@ -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) From 6b416813286d36cf7e9d27930671c6e5d9404334 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sat, 21 Dec 2024 09:58:21 -0700 Subject: [PATCH 12/33] more g2c API --- src/g2c_interface.F90 | 2 +- src/g2cf.F90 | 10 ++++++---- tests/test_g2cf.F90 | 4 +++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/g2c_interface.F90 b/src/g2c_interface.F90 index 05c145ca..e9e838fc 100644 --- a/src/g2c_interface.F90 +++ b/src/g2c_interface.F90 @@ -34,7 +34,7 @@ function g2c_inq_msg(g2id, msg_num, discipline, num_fields, & num_local, center, subcenter, master_version, local_version) bind(c) use iso_c_binding integer(c_int), value :: g2id - integer(c_int), intent(in) :: msg_num + integer(c_int), value :: 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 diff --git a/src/g2cf.F90 b/src/g2cf.F90 index 4e7a3962..a35a1194 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -160,7 +160,8 @@ end function g2cf_inq !> Learn about a message are in a GRIB2 file. !> !> @param[in] g2id The ID of the open file - !> @param[in] msg_num The number of message to learn about. + !> @param[in] msg_num The number of message to learn about. The + !> first message in the file is number 1. !> @param[out] discipline The discipline of the message. !> @param[out] num_fields Number of fields in the message. !> @param[out] num_local Number of local sections in the message. @@ -179,10 +180,10 @@ function g2cf_inq_msg(g2id, msg_num, discipline, num_fields, & implicit none integer, intent(in) :: g2id, msg_num - integer, intent(out) :: discipline + integer(kind = 1), 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(kind = 1), intent(out) :: master_version, local_version integer :: status integer(c_int) :: cg2id, cmsg_num, cstatus @@ -192,7 +193,8 @@ function g2cf_inq_msg(g2id, msg_num, discipline, num_fields, & integer(c_signed_char) :: cmaster_version, clocal_version cg2id = g2id - cmsg_num = msg_num + ! Subtract 1 because C is zero-based. + cmsg_num = msg_num - 1 cstatus = g2c_inq_msg(cg2id, cmsg_num, cdiscipline, cnum_fields, & cnum_local, ccenter, csubcenter, cmaster_version, clocal_version) discipline = cdiscipline diff --git a/tests/test_g2cf.F90 b/tests/test_g2cf.F90 index 474d3da9..d0c205a9 100644 --- a/tests/test_g2cf.F90 +++ b/tests/test_g2cf.F90 @@ -15,7 +15,7 @@ program test_g2cf integer :: ierr print *, 'Testing g2cf API...' - ierr = g2cf_set_log_level(1) + !ierr = g2cf_set_log_level(1) ! Open the test file. ierr = g2cf_open(fileName, 0, g2cid) @@ -29,6 +29,8 @@ program test_g2cf ! Check the last message. ierr = g2cf_inq_msg(g2cid, 19, discipline, num_fields, num_local, center, subcenter, & master_version, local_version) + if (ierr .ne. 0) stop 100 + !print *, 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 From f5ce0185e9bf770b880fa9d7ab8496b914c37428 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sun, 22 Dec 2024 06:26:55 -0700 Subject: [PATCH 13/33] cleanup --- src/g2c_interface.F90 | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/g2c_interface.F90 b/src/g2c_interface.F90 index e9e838fc..9aff84a8 100644 --- a/src/g2c_interface.F90 +++ b/src/g2c_interface.F90 @@ -42,9 +42,6 @@ function g2c_inq_msg(g2id, msg_num, discipline, num_fields, & integer(c_int) :: g2c_inq_msg end function g2c_inq_msg - ! int g2c_inq_msg(int g2cid, int msg_num, unsigned char *discipline, int *num_fields, - ! int *num_local, short *center, short *subcenter, unsigned char *master_version, - ! unsigned char *local_version); function g2c_close(g2id) bind(c) use iso_c_binding integer(c_int), value :: g2id From 39397e0e299f4fc06026912e72687944a8460f9f Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sun, 22 Dec 2024 06:48:05 -0700 Subject: [PATCH 14/33] more fortran wrappers --- src/g2c_interface.F90 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/g2c_interface.F90 b/src/g2c_interface.F90 index 9aff84a8..f6a707b3 100644 --- a/src/g2c_interface.F90 +++ b/src/g2c_interface.F90 @@ -42,6 +42,29 @@ function g2c_inq_msg(g2id, msg_num, discipline, num_fields, & integer(c_int) :: g2c_inq_msg end function g2c_inq_msg + function g2c_inq_msg_time(g2cid, msg_num, sig_ref_time, year, & + month, day, hour, minute, second) bind(c) + use iso_c_binding + integer(c_int), value :: g2id + integer(c_int), value :: msg_num + integer(c_signed_char), intent(out) :: sig_ref_time + integer(c_short), intent(out) :: year + integer(c_signed_char), intent(out) :: month, day, hour, minute, second + end function g2c_inq_msg_time + + ! int g2c_inq_msg_time(int g2cid, int msg_num, unsigned char *sig_ref_time, short *year, + ! unsigned char *month, unsigned char *day, unsigned char *hour, + ! unsigned char *minute, unsigned char *second); + ! int g2c_inq_prod(int g2cid, int msg_num, int prod_num, int *pds_template_len, + ! long long int *pds_template, int *gds_template_len, long long int *gds_template, + ! int *drs_template_len, long long int *drs_template); + ! int g2c_inq_dim(int g2cid, int msg_num, int prod_num, int dim_num, size_t *len, + ! char *name, float *val); + + ! /* Getting data. */ + ! int g2c_get_prod(int g2cid, int msg_num, int prod_num, int *num_data_points, + ! float *data); + function g2c_close(g2id) bind(c) use iso_c_binding integer(c_int), value :: g2id From fa06173836fc17993dace7f2dce4044291979722 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sun, 22 Dec 2024 06:51:39 -0700 Subject: [PATCH 15/33] more fortran wrappers --- src/g2c_interface.F90 | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/g2c_interface.F90 b/src/g2c_interface.F90 index f6a707b3..69f031d8 100644 --- a/src/g2c_interface.F90 +++ b/src/g2c_interface.F90 @@ -42,6 +42,9 @@ function g2c_inq_msg(g2id, msg_num, discipline, num_fields, & integer(c_int) :: g2c_inq_msg end function g2c_inq_msg + ! int g2c_inq_msg_time(int g2cid, int msg_num, unsigned char *sig_ref_time, short *year, + ! unsigned char *month, unsigned char *day, unsigned char *hour, + ! unsigned char *minute, unsigned char *second); function g2c_inq_msg_time(g2cid, msg_num, sig_ref_time, year, & month, day, hour, minute, second) bind(c) use iso_c_binding @@ -52,12 +55,22 @@ function g2c_inq_msg_time(g2cid, msg_num, sig_ref_time, year, & integer(c_signed_char), intent(out) :: month, day, hour, minute, second end function g2c_inq_msg_time - ! int g2c_inq_msg_time(int g2cid, int msg_num, unsigned char *sig_ref_time, short *year, - ! unsigned char *month, unsigned char *day, unsigned char *hour, - ! unsigned char *minute, unsigned char *second); ! int g2c_inq_prod(int g2cid, int msg_num, int prod_num, int *pds_template_len, ! long long int *pds_template, int *gds_template_len, long long int *gds_template, ! int *drs_template_len, long long int *drs_template); + function g2c_inq_prod(g2cid, msg_num, prod_num, pds_template_len, pds_template, gds_template_len, & + gds_template, drs_template_len, drs_template) bind(c) + use iso_c_binding + integer(c_int), value :: g2id + integer(c_int), value :: msg_num + integer(c_int), intent(out) :: prod_num, pds_template_len + integer(c_long_long), intent(out) :: pds_template + integer(c_int), intent(out) :: gds_template_len + integer(c_long_long), intent(out) :: gds_template + integer(c_int), intent(out) :: drs_template_len + integer(c_long_long), intent(out) :: drs_template + end function g2c_inq_prod + ! int g2c_inq_dim(int g2cid, int msg_num, int prod_num, int dim_num, size_t *len, ! char *name, float *val); From eea4a1e019ae791a1bf08bfb69e3bd73b457f872 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sun, 22 Dec 2024 07:04:13 -0700 Subject: [PATCH 16/33] more fortran wrappers --- src/g2c_interface.F90 | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/g2c_interface.F90 b/src/g2c_interface.F90 index 69f031d8..24c48870 100644 --- a/src/g2c_interface.F90 +++ b/src/g2c_interface.F90 @@ -45,7 +45,7 @@ end function g2c_inq_msg ! int g2c_inq_msg_time(int g2cid, int msg_num, unsigned char *sig_ref_time, short *year, ! unsigned char *month, unsigned char *day, unsigned char *hour, ! unsigned char *minute, unsigned char *second); - function g2c_inq_msg_time(g2cid, msg_num, sig_ref_time, year, & + function g2c_inq_msg_time(g2id, msg_num, sig_ref_time, year, & month, day, hour, minute, second) bind(c) use iso_c_binding integer(c_int), value :: g2id @@ -53,12 +53,13 @@ function g2c_inq_msg_time(g2cid, msg_num, sig_ref_time, year, & integer(c_signed_char), intent(out) :: sig_ref_time integer(c_short), intent(out) :: year integer(c_signed_char), intent(out) :: month, day, hour, minute, second + integer(c_int) :: g2c_inq_msg_time end function g2c_inq_msg_time - + ! int g2c_inq_prod(int g2cid, int msg_num, int prod_num, int *pds_template_len, ! long long int *pds_template, int *gds_template_len, long long int *gds_template, ! int *drs_template_len, long long int *drs_template); - function g2c_inq_prod(g2cid, msg_num, prod_num, pds_template_len, pds_template, gds_template_len, & + function g2c_inq_prod(g2id, msg_num, prod_num, pds_template_len, pds_template, gds_template_len, & gds_template, drs_template_len, drs_template) bind(c) use iso_c_binding integer(c_int), value :: g2id @@ -69,26 +70,37 @@ function g2c_inq_prod(g2cid, msg_num, prod_num, pds_template_len, pds_template, integer(c_long_long), intent(out) :: gds_template integer(c_int), intent(out) :: drs_template_len integer(c_long_long), intent(out) :: drs_template + integer(c_int) :: g2c_inq_prod end function g2c_inq_prod - + ! int g2c_inq_dim(int g2cid, int msg_num, int prod_num, int dim_num, size_t *len, ! char *name, float *val); - + function g2c_inq_dim(g2id, msg_num, prod_num, dim_num, len, name, val) bind(c) + use iso_c_binding + integer(c_int), value :: g2id + integer(c_int), value :: msg_num + integer(c_int), intent(out) :: prod_num, dim_num + integer(c_size_t), intent(out) :: len + character(c_char), intent(in) :: name(*) + real(c_float), intent(out) :: val + integer(c_int) :: g2c_inq_dim + end function g2c_inq_dim + ! /* Getting data. */ ! int g2c_get_prod(int g2cid, int msg_num, int prod_num, int *num_data_points, ! float *data); - + function g2c_close(g2id) bind(c) use iso_c_binding integer(c_int), value :: g2id integer(c_int) :: g2c_close end function g2c_close - + function g2c_set_log_level(log_level) bind(c) use iso_c_binding integer(c_int), intent(in) :: log_level integer(c_int) :: g2c_set_log_level end function g2c_set_log_level - + end interface end module g2c_interface From 400ec86280d4b318130fe7db03bee44b37adc61f Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sun, 22 Dec 2024 07:05:44 -0700 Subject: [PATCH 17/33] more fortran wrappers --- src/g2c_interface.F90 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/g2c_interface.F90 b/src/g2c_interface.F90 index 24c48870..6423b39e 100644 --- a/src/g2c_interface.F90 +++ b/src/g2c_interface.F90 @@ -89,6 +89,14 @@ end function g2c_inq_dim ! /* Getting data. */ ! int g2c_get_prod(int g2cid, int msg_num, int prod_num, int *num_data_points, ! float *data); + function g2c_get_prod(g2id, msg_num, prod_num, num_data_points, data) bind(c) + integer(c_int), value :: g2id + integer(c_int), value :: msg_num + integer(c_int), value :: prod_num + integer(c_int), intent(out) :: num_data_points + real(c_float), intent(out) :: data + integer(c_int) :: g2c_get_prod + end function g2c_get_prod function g2c_close(g2id) bind(c) use iso_c_binding From 0d4005c7cf2380bf68ce949f7508a0d9fd761e87 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sun, 22 Dec 2024 07:06:12 -0700 Subject: [PATCH 18/33] more fortran wrappers --- src/g2c_interface.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/g2c_interface.F90 b/src/g2c_interface.F90 index 6423b39e..bbf22bce 100644 --- a/src/g2c_interface.F90 +++ b/src/g2c_interface.F90 @@ -90,6 +90,7 @@ end function g2c_inq_dim ! int g2c_get_prod(int g2cid, int msg_num, int prod_num, int *num_data_points, ! float *data); function g2c_get_prod(g2id, msg_num, prod_num, num_data_points, data) bind(c) + use iso_c_binding integer(c_int), value :: g2id integer(c_int), value :: msg_num integer(c_int), value :: prod_num From 33174845e894b4dca069cebcdfade834193808ae Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sun, 22 Dec 2024 07:35:38 -0700 Subject: [PATCH 19/33] more fortran wrappers --- src/g2cf.F90 | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/g2cf.F90 b/src/g2cf.F90 index a35a1194..a9917e25 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -207,6 +207,56 @@ function g2cf_inq_msg(g2id, msg_num, discipline, num_fields, & status = cstatus end function g2cf_inq_msg + !> Learn about message date/time. + !> + !> @param g2id The ID of the open file + !> @param msg_num The message number in the file (first message is 1). + !> @param sig_ref_time The significant reference time. + !> @param year Year + !> @param month Mongh + !> @param day Day + !> @param hour Hour + !> @param minute Minute + !> @param second Second + !> + !> @return 0 for success, error code otherwise. + !> + !> @author Edward Hartnett @date 2024-12-22 + function g2cf_inq_msg_time(g2id, msg_num, sig_ref_time, year, & + month, day, hour, minute, second) result(status) + use iso_c_binding + use g2c_interface + implicit none + + integer, intent(in) :: g2id + integer, intent(in) :: msg_num + integer(kind = 1), intent(out) :: sig_ref_time + integer(kind = 2), intent(out) :: year + integer(kind = 1), intent(out) :: month, day, hour, minute, second + + integer(c_int) :: g2cid, cmsg_num + integer(c_signed_char) :: csig_ref_time + integer(c_short) :: cyear + integer(c_signed_char) :: cmonth, cday, chour, cminute, csecond + + integer(c_int) :: cstatus + integer :: status + + g2cid = g2id + cmsg_num = msg_num - 1 ! C is 0-based. + cstatus = g2c_inq_msg_time(g2id, cmsg_num, csig_ref_time, cyear, & + cmonth, cday, chour, cminute, csecond) + sig_ref_time = csig_ref_time + year = cyear + month = cmonth + day = cday + hour = chour + minute = cminute + second = csecond + status = cstatus + + end function g2cf_inq_msg_time + !> Close a GRIB2 file. !> !> @param g2id The ID of the open file From 5057eb0fc3451cd449b34f51209d383beef00b1d Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sun, 22 Dec 2024 07:57:50 -0700 Subject: [PATCH 20/33] more fortran wrappers --- src/g2c_interface.F90 | 6 ++-- src/g2cf.F90 | 76 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/src/g2c_interface.F90 b/src/g2c_interface.F90 index bbf22bce..b7d717d5 100644 --- a/src/g2c_interface.F90 +++ b/src/g2c_interface.F90 @@ -65,11 +65,11 @@ function g2c_inq_prod(g2id, msg_num, prod_num, pds_template_len, pds_template, g integer(c_int), value :: g2id integer(c_int), value :: msg_num integer(c_int), intent(out) :: prod_num, pds_template_len - integer(c_long_long), intent(out) :: pds_template + integer(c_long_long), intent(out) :: pds_template(*) integer(c_int), intent(out) :: gds_template_len - integer(c_long_long), intent(out) :: gds_template + integer(c_long_long), intent(out) :: gds_template(*) integer(c_int), intent(out) :: drs_template_len - integer(c_long_long), intent(out) :: drs_template + integer(c_long_long), intent(out) :: drs_template(*) integer(c_int) :: g2c_inq_prod end function g2c_inq_prod diff --git a/src/g2cf.F90 b/src/g2cf.F90 index a9917e25..5cae0be5 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -8,6 +8,15 @@ module g2cf use g2c_interface + !> Maximum number of entries in a PDS template. + integer, parameter :: MAX_PDS_TEMPLATE_LEN = 55 + + !> Maximum number of entries in a GDS template. + integer, parameter :: MAX_GDS_TEMPLATE_LEN = 55 + + !> Maximum number of entries in a DRS template. + integer, parameter :: MAX_DRS_TEMPLATE_LEN = 55 + contains !> Add a C_NULL_CHAR to a string to create a C compatible !> string. Assumes target variable will be of length @@ -257,6 +266,73 @@ function g2cf_inq_msg_time(g2id, msg_num, sig_ref_time, year, & end function g2cf_inq_msg_time + !> Learn about a product. + !> + !> @param g2id The ID of the open file + !> @param msg_num The message number in the file (first message is 1). + !> @param sig_ref_time The significant reference time. + !> @param pds_template_len Length of the PDS template. + !> @param pds_template The PDS template values. + !> @param gds_template_len Length of the GDS template. + !> @param gds_template The GDS template values. + !> @param drs_template_len Length of the DRS template. + !> @param drs_template The DRS template values. + !> + !> @return 0 for success, error code otherwise. + !> + !> @author Edward Hartnett @date 2024-12-22 + function g2cf_inq_prod(g2id, msg_num, prod_num, pds_template_len, pds_template, gds_template_len, & + gds_template, drs_template_len, drs_template) result(status) + use iso_c_binding + use g2c_interface + implicit none + + integer, intent(in) :: g2id + integer, intent(in) :: msg_num + integer, intent(out) :: prod_num, pds_template_len + integer(kind = 8), intent(out) :: pds_template(MAX_PDS_TEMPLATE_LEN) + integer, intent(out) :: gds_template_len + integer(kind = 8), intent(out) :: gds_template(MAX_GDS_TEMPLATE_LEN) + integer, intent(out) :: drs_template_len + integer(kind = 8), intent(out) :: drs_template(MAX_DRS_TEMPLATE_LEN) + + integer(c_int) :: g2cid, cmsg_num + integer(c_int) :: cprod_num, cpds_template_len + integer(c_long_long) :: cpds_template(MAX_PDS_TEMPLATE_LEN) + integer(c_int) :: cgds_template_len + integer(c_long_long) :: cgds_template(MAX_GDS_TEMPLATE_LEN) + integer(c_int) :: cdrs_template_len + integer(c_long_long) :: cdrs_template(MAX_DRS_TEMPLATE_LEN) + + integer(c_int) :: cstatus + integer :: status, i + + ! Copy input params to C types. + g2cid = g2id + cmsg_num = msg_num - 1 ! C is 0-based. + cprod_num = prod_num - 1 ! C is 0-based. + + ! Call the C function. + cstatus = g2c_inq_prod(g2cid, cmsg_num, cprod_num, cpds_template_len, cpds_template, & + cgds_template_len, cgds_template, cdrs_template_len, cdrs_template) + + ! Copy output params to Fortran types. + pds_template_len = cpds_template_len + do i = 1, pds_template_len + pds_template(i) = cpds_template(i) + end do + gds_template_len = cgds_template_len + do i = 1, gds_template_len + gds_template(i) = cgds_template(i) + end do + drs_template_len = cdrs_template_len + do i = 1, drs_template_len + drs_template(i) = cdrs_template(i) + end do + status = cstatus + + end function g2cf_inq_prod + !> Close a GRIB2 file. !> !> @param g2id The ID of the open file From 543504fe921ab8285918274737c89932a9e087e7 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sun, 22 Dec 2024 08:03:30 -0700 Subject: [PATCH 21/33] more fortran wrappers --- src/g2cf.F90 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/g2cf.F90 b/src/g2cf.F90 index 5cae0be5..f9d00066 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -268,15 +268,15 @@ end function g2cf_inq_msg_time !> Learn about a product. !> - !> @param g2id The ID of the open file - !> @param msg_num The message number in the file (first message is 1). - !> @param sig_ref_time The significant reference time. - !> @param pds_template_len Length of the PDS template. - !> @param pds_template The PDS template values. - !> @param gds_template_len Length of the GDS template. - !> @param gds_template The GDS template values. - !> @param drs_template_len Length of the DRS template. - !> @param drs_template The DRS template values. + !> @param[in] g2id The ID of the open file + !> @param[in] msg_num The message number in the file (first message is 1). + !> @param[in] prod_num The product number in the message (first product is 1). + !> @param[out] pds_template_len Length of the PDS template. + !> @param[out] pds_template The PDS template values. + !> @param[out] gds_template_len Length of the GDS template. + !> @param[out] gds_template The GDS template values. + !> @param[out] drs_template_len Length of the DRS template. + !> @param[out] drs_template The DRS template values. !> !> @return 0 for success, error code otherwise. !> From 31058361045c2c89a5f8f723a9a07d464ca3a0d9 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sun, 22 Dec 2024 08:50:50 -0700 Subject: [PATCH 22/33] more fortran wrappers --- src/g2cf.F90 | 88 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 76 insertions(+), 12 deletions(-) diff --git a/src/g2cf.F90 b/src/g2cf.F90 index f9d00066..335240fa 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -8,14 +8,17 @@ module g2cf use g2c_interface + !> Maximum name length. + integer, parameter :: G2_MAX_NAME = 1024 + !> Maximum number of entries in a PDS template. - integer, parameter :: MAX_PDS_TEMPLATE_LEN = 55 + integer, parameter :: G2_MAX_PDS_TEMPLATE_LEN = 50 !> Maximum number of entries in a GDS template. - integer, parameter :: MAX_GDS_TEMPLATE_LEN = 55 + integer, parameter :: G2_MAX_GDS_TEMPLATE_LEN = 50 !> Maximum number of entries in a DRS template. - integer, parameter :: MAX_DRS_TEMPLATE_LEN = 55 + integer, parameter :: G2_MAX_DRS_TEMPLATE_LEN = 55 contains !> Add a C_NULL_CHAR to a string to create a C compatible @@ -287,22 +290,21 @@ function g2cf_inq_prod(g2id, msg_num, prod_num, pds_template_len, pds_template, use g2c_interface implicit none - integer, intent(in) :: g2id - integer, intent(in) :: msg_num - integer, intent(out) :: prod_num, pds_template_len - integer(kind = 8), intent(out) :: pds_template(MAX_PDS_TEMPLATE_LEN) + integer, intent(in) :: g2id, msg_num, prod_num + integer, intent(out) :: pds_template_len + integer(kind = 8), intent(out) :: pds_template(*) integer, intent(out) :: gds_template_len - integer(kind = 8), intent(out) :: gds_template(MAX_GDS_TEMPLATE_LEN) + integer(kind = 8), intent(out) :: gds_template(*) integer, intent(out) :: drs_template_len - integer(kind = 8), intent(out) :: drs_template(MAX_DRS_TEMPLATE_LEN) + integer(kind = 8), intent(out) :: drs_template(*) integer(c_int) :: g2cid, cmsg_num integer(c_int) :: cprod_num, cpds_template_len - integer(c_long_long) :: cpds_template(MAX_PDS_TEMPLATE_LEN) + integer(c_long_long) :: cpds_template(G2_MAX_PDS_TEMPLATE_LEN) integer(c_int) :: cgds_template_len - integer(c_long_long) :: cgds_template(MAX_GDS_TEMPLATE_LEN) + integer(c_long_long) :: cgds_template(G2_MAX_GDS_TEMPLATE_LEN) integer(c_int) :: cdrs_template_len - integer(c_long_long) :: cdrs_template(MAX_DRS_TEMPLATE_LEN) + integer(c_long_long) :: cdrs_template(G2_MAX_DRS_TEMPLATE_LEN) integer(c_int) :: cstatus integer :: status, i @@ -333,6 +335,68 @@ function g2cf_inq_prod(g2id, msg_num, prod_num, pds_template_len, pds_template, end function g2cf_inq_prod + !> Learn about a dimension. + !> + !> @param[in] g2id The ID of the open file + !> @param[in] msg_num The message number in the file (first message is 1). + !> @param[in] prod_num The product number in the message (first product is 1). + !> @param[in] dim_num The dimension number in the product (first dimension is 1). + !> @param[out] len Length of dimension. + !> @param[out] name Name of dimension. + !> @param[out] val Array of values along the dimension. + !> + !> @return 0 for success, error code otherwise. + !> + !> @author Edward Hartnett @date 2024-12-22 + ! function g2cf_inq_dim(g2id, msg_num, prod_num, dim_num, len, name, val) result(status) + ! use iso_c_binding + ! use g2c_interface + ! implicit none + + ! integer, intent(in) :: g2id, msg_num, prod_num, dim_num + ! integer(kind = 8), intent(out) :: len + ! character, intent(out) :: name(*) + ! real, intent(out) :: val(*) + + ! integer(c_int) :: g2cid, cmsg_num, cprod_num, cdim_num + ! integer(c_size_t) :: clen + ! character(c_char) :: cname(G2_MAX_NAME) + ! real(c_float) :: cval(*) + + ! integer(c_int) :: cstatus + ! integer :: status + + ! ! Copy input params to C types. + ! g2cid = g2id + ! cmsg_num = msg_num - 1 ! C is 0-based. + ! cprod_num = prod_num - 1 ! C is 0-based. + ! cdim_num = dim_num - 1 ! C is 0-based. + + ! ! Call the C function. + ! cstatus = g2c_inq_dim(g2cid, cmsg_num, cprod_num, cdim_num, clen, cname, cval) + + ! ! Copy output params to Fortran types. + ! len = clen + ! name = cname + ! do i = 1, len + ! val(i) = cval(i) + ! end do + ! status = cstatus + + ! end function g2cf_inq_dim + + ! /* Getting data. */ + ! int g2c_get_prod(int g2cid, int msg_num, int prod_num, int *num_data_points, + ! float *data); + ! function g2c_get_prod(g2id, msg_num, prod_num, num_data_points, data) bind(c) + ! use iso_c_binding + ! integer(c_int), value :: g2id + ! integer(c_int), value :: msg_num + ! integer(c_int), value :: prod_num + ! integer(c_int), intent(out) :: num_data_points + ! real(c_float), intent(out) :: data + ! integer(c_int) :: g2c_get_prod + ! end function g2c_get_prod !> Close a GRIB2 file. !> !> @param g2id The ID of the open file From 198b655904427c35638a91cc68c412ed3939f173 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sun, 22 Dec 2024 09:05:13 -0700 Subject: [PATCH 23/33] more fortran wrappers --- src/g2cf.F90 | 66 ++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/g2cf.F90 b/src/g2cf.F90 index 335240fa..875c9cb3 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -348,42 +348,42 @@ end function g2cf_inq_prod !> @return 0 for success, error code otherwise. !> !> @author Edward Hartnett @date 2024-12-22 - ! function g2cf_inq_dim(g2id, msg_num, prod_num, dim_num, len, name, val) result(status) - ! use iso_c_binding - ! use g2c_interface - ! implicit none - - ! integer, intent(in) :: g2id, msg_num, prod_num, dim_num - ! integer(kind = 8), intent(out) :: len - ! character, intent(out) :: name(*) - ! real, intent(out) :: val(*) + function g2cf_inq_dim(g2id, msg_num, prod_num, dim_num, len, name, val) result(status) + use iso_c_binding + use g2c_interface + implicit none + + integer, intent(in) :: g2id, msg_num, prod_num, dim_num + integer(kind = 8), intent(out) :: len + character, intent(out) :: name(*) + real, intent(out) :: val(*) - ! integer(c_int) :: g2cid, cmsg_num, cprod_num, cdim_num - ! integer(c_size_t) :: clen - ! character(c_char) :: cname(G2_MAX_NAME) - ! real(c_float) :: cval(*) - - ! integer(c_int) :: cstatus - ! integer :: status - - ! ! Copy input params to C types. - ! g2cid = g2id - ! cmsg_num = msg_num - 1 ! C is 0-based. - ! cprod_num = prod_num - 1 ! C is 0-based. - ! cdim_num = dim_num - 1 ! C is 0-based. - - ! ! Call the C function. - ! cstatus = g2c_inq_dim(g2cid, cmsg_num, cprod_num, cdim_num, clen, cname, cval) + integer(c_int) :: g2cid, cmsg_num, cprod_num, cdim_num + integer(c_size_t) :: clen + character(c_char) :: cname(G2_MAX_NAME) + real(c_float) :: cval(*) + + integer(c_int) :: cstatus + integer :: status + + ! Copy input params to C types. + g2cid = g2id + cmsg_num = msg_num - 1 ! C is 0-based. + cprod_num = prod_num - 1 ! C is 0-based. + cdim_num = dim_num - 1 ! C is 0-based. + + ! Call the C function. + cstatus = g2c_inq_dim(g2cid, cmsg_num, cprod_num, cdim_num, clen, cname, cval) - ! ! Copy output params to Fortran types. - ! len = clen - ! name = cname - ! do i = 1, len - ! val(i) = cval(i) - ! end do - ! status = cstatus + ! Copy output params to Fortran types. + len = clen + name = cname + do i = 1, len + val(i) = cval(i) + end do + status = cstatus - ! end function g2cf_inq_dim + end function g2cf_inq_dim ! /* Getting data. */ ! int g2c_get_prod(int g2cid, int msg_num, int prod_num, int *num_data_points, From 76d4f4a52627c17e875ce4016482fa527217cf5e Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sun, 22 Dec 2024 09:07:42 -0700 Subject: [PATCH 24/33] more fortran wrappers --- src/g2c_interface.F90 | 2 +- src/g2cf.F90 | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/g2c_interface.F90 b/src/g2c_interface.F90 index b7d717d5..a9e277c0 100644 --- a/src/g2c_interface.F90 +++ b/src/g2c_interface.F90 @@ -82,7 +82,7 @@ function g2c_inq_dim(g2id, msg_num, prod_num, dim_num, len, name, val) bind(c) integer(c_int), intent(out) :: prod_num, dim_num integer(c_size_t), intent(out) :: len character(c_char), intent(in) :: name(*) - real(c_float), intent(out) :: val + real(c_float), intent(out) :: val(*) integer(c_int) :: g2c_inq_dim end function g2c_inq_dim diff --git a/src/g2cf.F90 b/src/g2cf.F90 index 875c9cb3..d29078af 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -361,10 +361,11 @@ function g2cf_inq_dim(g2id, msg_num, prod_num, dim_num, len, name, val) result(s integer(c_int) :: g2cid, cmsg_num, cprod_num, cdim_num integer(c_size_t) :: clen character(c_char) :: cname(G2_MAX_NAME) - real(c_float) :: cval(*) + real(c_float) :: cval(10) integer(c_int) :: cstatus integer :: status + integer(kind = 8) :: i ! Copy input params to C types. g2cid = g2id @@ -377,7 +378,8 @@ function g2cf_inq_dim(g2id, msg_num, prod_num, dim_num, len, name, val) result(s ! Copy output params to Fortran types. len = clen - name = cname + name(1) = '' + !name = cname do i = 1, len val(i) = cval(i) end do From 82282232dffa29d90c7a0a6a32fc2f675625b38a Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Sun, 22 Dec 2024 09:41:53 -0700 Subject: [PATCH 25/33] more fortran wrappers --- tests/test_g2cf.F90 | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/test_g2cf.F90 b/tests/test_g2cf.F90 index d0c205a9..1157a97c 100644 --- a/tests/test_g2cf.F90 +++ b/tests/test_g2cf.F90 @@ -7,35 +7,45 @@ program test_g2cf use g2cf implicit none character (len = *), parameter :: fileName = "data/gdaswave.t00z.wcoast.0p16.f000.grib2" - integer :: g2cid, num_msg + integer :: g2id, num_msg integer(kind = 1) :: discipline integer(kind = 4) :: num_fields, num_local integer(kind = 2) :: center, subcenter integer(kind = 1) :: master_version, local_version + integer(kind = 1) :: sig_ref_time + integer(kind = 2) :: year + integer(kind = 1) :: month, day, hour, minute, second integer :: ierr print *, 'Testing g2cf API...' !ierr = g2cf_set_log_level(1) ! Open the test file. - ierr = g2cf_open(fileName, 0, g2cid) + ierr = g2cf_open(fileName, 0, g2id) if (ierr .ne. 0) stop 2 ! Check number of messages. - ierr = g2cf_inq(g2cid, num_msg) + ierr = g2cf_inq(g2id, num_msg) 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, & + ierr = g2cf_inq_msg(g2id, 19, discipline, num_fields, num_local, center, subcenter, & master_version, local_version) if (ierr .ne. 0) stop 100 !print *, 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 time of the last message. + ierr = g2cf_inq_msg_time(g2id, 19, sig_ref_time, year, & + month, day, hour, minute, second) + !print *, sig_ref_time, year, month, day, hour, minute, second + if (sig_ref_time .ne. 1 .or. year .ne. 2021 .or. month .ne. 11 .or. day .ne. 30 .or. & + hour .ne. 0 .or. minute .ne. 0 .or. second .ne. 0) stop 101 + ! Close the file. - ierr = g2cf_close(g2cid) + ierr = g2cf_close(g2id) if (ierr .ne. 0) stop 20 print *, 'SUCCESS!' From ba91f2d566395b56d3aab67bb2220592b54b652a Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 23 Dec 2024 06:24:37 -0700 Subject: [PATCH 26/33] more wrapper work --- src/g2cf.F90 | 61 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/src/g2cf.F90 b/src/g2cf.F90 index d29078af..5f03cd86 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -8,6 +8,9 @@ module g2cf use g2c_interface + !> Return value from functions when there is no error. + integer, parameter :: G2_NOERR = 0 + !> Maximum name length. integer, parameter :: G2_MAX_NAME = 1024 @@ -62,6 +65,38 @@ function addcnullchar(string, nlen) result(cstring) endif end function addcnullchar + !> Check cstring for a c null char, strip it off and + !> return regular string. Limit length of cstring loaded + !> into string to nlen. + !> + !> @param[in] cstring String which may have null char. + !> @param[in] nlen Length of string. + !> + !> @return String with NULL removed. + !> + !> This function was originally written by, Richard Weed, Ph.D., as part of + !> netcdf-fortran. + !> + !> @author Edward Hartnett @date 2024-12-23 + function stripcnullchar(cstring, nlen) result(string) + use iso_c_binding + implicit none + + character(len=*), intent(in) :: cstring + integer, intent(in) :: nlen + character(len=nlen) :: string + integer :: ie, inull + + ie = len_trim(cstring) + inull = scan(cstring, c_null_char) + + if (inull > 1) ie = inull-1 + ie = max(1, min(ie, nlen)) ! limit ie to 1 or nlen + string = repeat(" ", nlen) + string(1:ie) = cstring(1:ie) + + end function stripcnullchar + !> Open a GRIB2 file. !> !> @param path The path to the file @@ -348,39 +383,45 @@ end function g2cf_inq_prod !> @return 0 for success, error code otherwise. !> !> @author Edward Hartnett @date 2024-12-22 - function g2cf_inq_dim(g2id, msg_num, prod_num, dim_num, len, name, val) result(status) + function g2cf_inq_dim(g2id, msg_num, prod_num, dim_num, dimlen, name, val) result(status) use iso_c_binding use g2c_interface implicit none integer, intent(in) :: g2id, msg_num, prod_num, dim_num - integer(kind = 8), intent(out) :: len + integer(kind = 8), intent(out) :: dimlen character, intent(out) :: name(*) real, intent(out) :: val(*) integer(c_int) :: g2cid, cmsg_num, cprod_num, cdim_num - integer(c_size_t) :: clen - character(c_char) :: cname(G2_MAX_NAME) + integer(c_size_t) :: cdimlen real(c_float) :: cval(10) + character(len = G2_MAX_NAME) :: tmpname + integer(kind = 8) :: i + integer :: nlen integer(c_int) :: cstatus integer :: status - integer(kind = 8) :: i ! Copy input params to C types. g2cid = g2id cmsg_num = msg_num - 1 ! C is 0-based. cprod_num = prod_num - 1 ! C is 0-based. cdim_num = dim_num - 1 ! C is 0-based. + nlen = len(name) ! Call the C function. - cstatus = g2c_inq_dim(g2cid, cmsg_num, cprod_num, cdim_num, clen, cname, cval) + cstatus = g2c_inq_dim(g2cid, cmsg_num, cprod_num, cdim_num, cdimlen, tmpname, cval) ! Copy output params to Fortran types. - len = clen - name(1) = '' - !name = cname - do i = 1, len + dimlen = cdimlen + if (cstatus == G2_NOERR) then + ! Strip c null char from tmpname if present and set end of string. + name(:nlen) = stripcnullchar(tmpname, nlen) + endif + + ! Copy values. + do i = 1, dimlen val(i) = cval(i) end do status = cstatus From df8798af0db813741fea02d6df3f7800c413f6b1 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 23 Dec 2024 07:00:14 -0700 Subject: [PATCH 27/33] more wrapper work --- src/g2cf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g2cf.F90 b/src/g2cf.F90 index 5f03cd86..bd212736 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -376,7 +376,7 @@ end function g2cf_inq_prod !> @param[in] msg_num The message number in the file (first message is 1). !> @param[in] prod_num The product number in the message (first product is 1). !> @param[in] dim_num The dimension number in the product (first dimension is 1). - !> @param[out] len Length of dimension. + !> @param[out] dimlen Length of dimension. !> @param[out] name Name of dimension. !> @param[out] val Array of values along the dimension. !> From 6579edefb8868eeb99367ac2eaf35561084cd8d5 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 23 Dec 2024 08:22:26 -0700 Subject: [PATCH 28/33] progress with g2f_inq_prod() --- src/g2c_interface.F90 | 5 ++--- src/g2cf.F90 | 24 +++++++++++++++--------- tests/test_g2cf.F90 | 31 ++++++++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/src/g2c_interface.F90 b/src/g2c_interface.F90 index a9e277c0..76a8179e 100644 --- a/src/g2c_interface.F90 +++ b/src/g2c_interface.F90 @@ -62,9 +62,8 @@ end function g2c_inq_msg_time function g2c_inq_prod(g2id, msg_num, prod_num, pds_template_len, pds_template, gds_template_len, & gds_template, drs_template_len, drs_template) bind(c) use iso_c_binding - integer(c_int), value :: g2id - integer(c_int), value :: msg_num - integer(c_int), intent(out) :: prod_num, pds_template_len + integer(c_int), value :: g2id, msg_num, prod_num + integer(c_int), intent(out) :: pds_template_len integer(c_long_long), intent(out) :: pds_template(*) integer(c_int), intent(out) :: gds_template_len integer(c_long_long), intent(out) :: gds_template(*) diff --git a/src/g2cf.F90 b/src/g2cf.F90 index bd212736..018deaca 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -355,17 +355,23 @@ function g2cf_inq_prod(g2id, msg_num, prod_num, pds_template_len, pds_template, ! Copy output params to Fortran types. pds_template_len = cpds_template_len - do i = 1, pds_template_len - pds_template(i) = cpds_template(i) - end do + if (pds_template_len .gt. 0) then + do i = 1, pds_template_len + pds_template(i) = cpds_template(i) + end do + endif gds_template_len = cgds_template_len - do i = 1, gds_template_len - gds_template(i) = cgds_template(i) - end do + if (gds_template_len .gt. 0) then + do i = 1, gds_template_len + gds_template(i) = cgds_template(i) + end do + endif drs_template_len = cdrs_template_len - do i = 1, drs_template_len - drs_template(i) = cdrs_template(i) - end do + if (drs_template_len .gt. 0) then + do i = 1, drs_template_len + drs_template(i) = cdrs_template(i) + end do + endif status = cstatus end function g2cf_inq_prod diff --git a/tests/test_g2cf.F90 b/tests/test_g2cf.F90 index 1157a97c..42ee6288 100644 --- a/tests/test_g2cf.F90 +++ b/tests/test_g2cf.F90 @@ -14,7 +14,16 @@ program test_g2cf integer(kind = 1) :: master_version, local_version integer(kind = 1) :: sig_ref_time integer(kind = 2) :: year - integer(kind = 1) :: month, day, hour, minute, second + integer(kind = 1) :: month, day, hour, minute, second + integer :: pds_template_len, gds_template_len, drs_template_len + integer(kind = 8) :: pds_template(G2_MAX_PDS_TEMPLATE_LEN), gds_template(G2_MAX_GDS_TEMPLATE_LEN), & + drs_template(G2_MAX_DRS_TEMPLATE_LEN) + integer(kind = 8) :: expected_pds_template(15) = (/ 2, 1, 2, 0, 11, 0, 0, 1, & + 0, 1, 0, 1, 255, 0, 0 /) + integer(kind = 8) :: expected_gds_template(19) = (/ 6, 0, 0, 0, 0, 0, 0, 241, & + 151, 0, 0, 50000000, 210000000, 48, 25000000, 250000000, 166667, 166667, 0 /) + integer(kind = 8) :: expected_drs_template(7) = (/ 1092616192, 0, 2, 11, 0, 0, 255 /) + integer :: i integer :: ierr print *, 'Testing g2cf API...' @@ -40,10 +49,30 @@ program test_g2cf ! Check the time of the last message. ierr = g2cf_inq_msg_time(g2id, 19, sig_ref_time, year, & month, day, hour, minute, second) + if (ierr .ne. 0) stop 200 !print *, sig_ref_time, year, month, day, hour, minute, second if (sig_ref_time .ne. 1 .or. year .ne. 2021 .or. month .ne. 11 .or. day .ne. 30 .or. & hour .ne. 0 .or. minute .ne. 0 .or. second .ne. 0) stop 101 + ! Learn about the first product in the last message. + ierr = g2cf_inq_prod(g2id, 1, 1, pds_template_len, pds_template, gds_template_len, & + gds_template, drs_template_len, drs_template) + if (ierr .ne. 0) stop 300 + !print *, pds_template_len, gds_template_len, drs_template_len + if (pds_template_len .ne. 15 .or. gds_template_len .ne. 19 .or. drs_template_len .ne.7) stop 301 + !print *, pds_template + do i = 1, pds_template_len + if (pds_template(i) .ne. expected_pds_template(i)) stop 302 + end do + !print *, gds_template + do i = 1, gds_template_len + if (gds_template(i) .ne. expected_gds_template(i)) stop 302 + end do + !print *, drs_template + do i = 1, drs_template_len + if (drs_template(i) .ne. expected_drs_template(i)) stop 302 + end do + ! Close the file. ierr = g2cf_close(g2id) if (ierr .ne. 0) stop 20 From b95af971e34f2df79a2dd970616dce11fdb475ee Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Fri, 27 Dec 2024 05:38:00 -0700 Subject: [PATCH 29/33] more --- src/g2cf.F90 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/g2cf.F90 b/src/g2cf.F90 index 018deaca..96909910 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -88,7 +88,7 @@ function stripcnullchar(cstring, nlen) result(string) integer :: ie, inull ie = len_trim(cstring) - inull = scan(cstring, c_null_char) + inull = scan(cstring, C_NULL_CHAR) if (inull > 1) ie = inull-1 ie = max(1, min(ie, nlen)) ! limit ie to 1 or nlen @@ -397,7 +397,7 @@ function g2cf_inq_dim(g2id, msg_num, prod_num, dim_num, dimlen, name, val) resul integer, intent(in) :: g2id, msg_num, prod_num, dim_num integer(kind = 8), intent(out) :: dimlen character, intent(out) :: name(*) - real, intent(out) :: val(*) + real, intent(out), optional :: val(*) integer(c_int) :: g2cid, cmsg_num, cprod_num, cdim_num integer(c_size_t) :: cdimlen @@ -417,8 +417,14 @@ function g2cf_inq_dim(g2id, msg_num, prod_num, dim_num, dimlen, name, val) resul nlen = len(name) ! Call the C function. - cstatus = g2c_inq_dim(g2cid, cmsg_num, cprod_num, cdim_num, cdimlen, tmpname, cval) - + if (present(val)) then + cstatus = g2c_inq_dim(g2cid, cmsg_num, cprod_num, cdim_num, cdimlen, & + tmpname, cval) + else + cstatus = g2c_inq_dim(g2cid, cmsg_num, cprod_num, cdim_num, cdimlen, & + tmpname, C_NULL_CHAR) + endif + ! Copy output params to Fortran types. dimlen = cdimlen if (cstatus == G2_NOERR) then From f48d7d9359f352aa3e3254cfa5e9df601e3a7ef9 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Fri, 27 Dec 2024 05:45:01 -0700 Subject: [PATCH 30/33] use g2c_inq_dim_info() --- src/g2c_interface.F90 | 10 ++++++++++ src/g2cf.F90 | 18 +++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/g2c_interface.F90 b/src/g2c_interface.F90 index 34845781..16c936ab 100644 --- a/src/g2c_interface.F90 +++ b/src/g2c_interface.F90 @@ -85,6 +85,16 @@ function g2c_inq_dim(g2id, msg_num, prod_num, dim_num, len, name, val) bind(c) integer(c_int) :: g2c_inq_dim end function g2c_inq_dim + function g2c_inq_dim_info(g2id, msg_num, prod_num, dim_num, len, name) bind(c) + use iso_c_binding + integer(c_int), value :: g2id + integer(c_int), value :: msg_num + integer(c_int), intent(out) :: prod_num, dim_num + integer(c_size_t), intent(out) :: len + character(c_char), intent(in) :: name(*) + integer(c_int) :: g2c_inq_dim_info + end function g2c_inq_dim_info + ! /* Getting data. */ ! int g2c_get_prod(int g2cid, int msg_num, int prod_num, int *num_data_points, ! float *data); diff --git a/src/g2cf.F90 b/src/g2cf.F90 index 96909910..fbc5b40f 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -421,21 +421,25 @@ function g2cf_inq_dim(g2id, msg_num, prod_num, dim_num, dimlen, name, val) resul cstatus = g2c_inq_dim(g2cid, cmsg_num, cprod_num, cdim_num, cdimlen, & tmpname, cval) else - cstatus = g2c_inq_dim(g2cid, cmsg_num, cprod_num, cdim_num, cdimlen, & - tmpname, C_NULL_CHAR) + cstatus = g2c_inq_dim_info(g2cid, cmsg_num, cprod_num, cdim_num, cdimlen, & + tmpname) endif ! Copy output params to Fortran types. - dimlen = cdimlen if (cstatus == G2_NOERR) then + dimlen = cdimlen ! Strip c null char from tmpname if present and set end of string. name(:nlen) = stripcnullchar(tmpname, nlen) + + ! Copy values. + if (present(val)) then + do i = 1, dimlen + val(i) = cval(i) + end do + endif endif - ! Copy values. - do i = 1, dimlen - val(i) = cval(i) - end do + ! Copy exit status. status = cstatus end function g2cf_inq_dim From 213d71f20ebaa7660716af35fec8483c4da959ec Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Fri, 27 Dec 2024 05:48:13 -0700 Subject: [PATCH 31/33] require g2c-2.1.0 --- CMakeLists.txt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7593b28..e671129e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,6 @@ option(BUILD_D "Build libg2_d.a" ON) option(BUILD_WITH_W3EMC "Build with NCEPLIBS-w3emc, enabling some GRIB1 functionality" ON) option(BUILD_UTILS "Build grib utilities" ON) option(USE_AEC "Build with AEC (CCSDS) compression support" OFF) -option(G2C_COMPARE "Enable copygb2 tests using g2c_compare" OFF) # Developers can use this option to specify a local directory which # holds the test files. They will be copied instead of fetching the @@ -73,7 +72,7 @@ endif() # There was a bug in jasper for the intel compiler that was fixed in # 2.0.25. find_package(Jasper 2.0.25 REQUIRED) -find_package(g2c REQUIRED) +find_package(g2c 2.1.0 REQUIRED) find_package(PNG REQUIRED) find_package(bacio REQUIRED) if(bacio_VERSION LESS 2.5.0) @@ -89,11 +88,6 @@ if (BUILD_WITH_W3EMC) endif() endif() -# We need g2c if G2C_COMPARE is chosen. -if (G2C_COMPARE) - find_package(g2c 1.7.0 REQUIRED) -endif() - # Figure whether user wants a _4, a _d, or both libraries. if(BUILD_4 AND BUILD_D) set(kinds "4" "d") From c9064310017e452b54439c37c0047531a087eadd Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 30 Dec 2024 08:44:17 -0700 Subject: [PATCH 32/33] change to activate CI --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e671129e..1f12028c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ # This is the main CMake file for NCEPLIBS-g2. # # Mark Potts, Kyle Gerheiser, Ed Hartnett + cmake_minimum_required(VERSION 3.15) # Read the current version number from file VERSION. From bed2ef357289336295d96881277f30d2b2715914 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 30 Dec 2024 08:52:08 -0700 Subject: [PATCH 33/33] working on build --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f12028c..bc97435f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,6 +73,7 @@ endif() # There was a bug in jasper for the intel compiler that was fixed in # 2.0.25. find_package(Jasper 2.0.25 REQUIRED) +message(STATUS "Looking for NCEPLIBS-g2c...") find_package(g2c 2.1.0 REQUIRED) find_package(PNG REQUIRED) find_package(bacio REQUIRED)