Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:NOAA-EMC/wgrib2 into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
webisu committed Apr 19, 2024
2 parents 40eda58 + 8e09b8c commit 4024a36
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 3 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/Linux_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,27 @@ jobs:
- {
options: "-DUSE_IPOLATES=1"
}
- {
options: "-DUSE_AEC=ON"
}

steps:

- name: install
run: |
sudo apt-get update
sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config
sudo apt-get install libpng-dev autotools-dev autoconf
sudo apt-get install libpng-dev autotools-dev autoconf libaec-dev
- name: cache-jasper
id: cache-jasper
uses: actions/cache@v3
with:
path: ~/jasper
key: jasper-${{ runner.os }}-1.900.1

- name: checkout-jasper
if: steps.cache-jasper.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: jasper-software/jasper
Expand Down Expand Up @@ -123,3 +134,4 @@ jobs:
cd b
cmake ${{ matrix.config.options }} -DCMAKE_PREFIX_PATH="~/sp;~/ip;~/ip2" ..
make VERBOSE=1
ctest --verbose --output-on-failure --rerun-failed
8 changes: 8 additions & 0 deletions .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@ jobs:
sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config
sudo apt-get install libpng-dev autotools-dev autoconf gcovr
- name: cache-jasper
id: cache-jasper
uses: actions/cache@v3
with:
path: ~/jasper
key: jasper-${{ runner.os }}-1.900.1

- name: checkout-jasper
if: steps.cache-jasper.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: jasper-software/jasper
Expand Down
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,13 @@ if(USE_PNG)
find_package(PNG REQUIRED)
endif()

# write config.h. This is used internally by wgrib2 code and is not
# installed.
# Find required packages to use AEC
message(STATUS "Checking of the user wants to use AEC...")
if(USE_AEC)
find_package(libaec 1.0.6 REQUIRED)
endif()

# write config.h
message(STATUS "Writing config.h...")
FILE(WRITE "wgrib2/config.h" "/* config.h generated by cmake */\n")
FILE(APPEND "wgrib2/config.h" "#ifndef _CONFIG_H\n")
Expand Down
31 changes: 31 additions & 0 deletions cmake/Findlibaec.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Find libaec
#
# LIBAEC_FOUND - if false, do not try to use libaec
# LIBAEC_INCLUDE_DIRS - the libaec include directories
# LIBAEC_LIBRARIES - the libraries to link against to use libaec
#
# This file is part of NCEPLIBS-g2c. Distributed under the LGPL v3.0.

find_package(PkgConfig QUIET)
pkg_check_modules(LIBAEC_PKGCONF QUIET libaec aec)
set(LIBAEC_VERSION ${LIBAEC_PKGCONF_VERSION})

find_path(LIBAEC_INCLUDE_DIRS
NAMES libaec.h
HINTS ${LIBAEC_PKGCONF_INCLUDEDIR} ${LIBAEC_PKGCONF_INCLUDE_DIRS}
)

find_library(LIBAEC_LIBRARIES
NAMES libaec aec
HINTS ${LIBAEC_PKGCONF_LIBDIR} ${LIBAEC_PKGCONF_LIBRARY_DIRS}
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(libaec
FOUND_VAR LIBAEC_FOUND
REQUIRED_VARS LIBAEC_LIBRARIES LIBAEC_INCLUDE_DIRS
VERSION_VAR LIBAEC_VERSION
)

mark_as_advanced(LIBAEC_INCLUDE_DIRS LIBAEC_LIBRARIES)
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ endfunction()
# Copy test data file into buiild directory for testing.
copy_test_data(gdaswave.t00z.wcoast.0p16.f000.grib2)
copy_test_data(ref_gdaswave.t00z.wcoast.0p16.f000.grib2.inv)
copy_test_data(ref_npts_gdaswave.t00z.wcoast.0p16.f000.grib2.txt)

# Run these shell tests.
shell_test(run_wgrib2_tests)
19 changes: 19 additions & 0 deletions tests/data/ref_npts_gdaswave.t00z.wcoast.0p16.f000.grib2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
1:0:npts=36391
2:15254:npts=36391
3:37897:npts=36391
4:53794:npts=36391
5:69064:npts=36391
6:79482:npts=36391
7:91308:npts=36391
8:108541:npts=36391
9:116716:npts=36391
10:128832:npts=36391
11:140848:npts=36391
12:151732:npts=36391
13:161021:npts=36391
14:173676:npts=36391
15:189425:npts=36391
16:205285:npts=36391
17:218263:npts=36391
18:237035:npts=36391
19:259223:npts=36391
5 changes: 5 additions & 0 deletions tests/run_wgrib2_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ ls -l ../wgrib2
cat tmp.txt
cmp tmp.txt data/ref_gdaswave.t00z.wcoast.0p16.f000.grib2.inv

# Returns number of grid points in grid
../wgrib2/wgrib2 data/gdaswave.t00z.wcoast.0p16.f000.grib2 -npts > npts.txt
cat npts.txt
cmp npts.txt data/ref_npts_gdaswave.t00z.wcoast.0p16.f000.grib2.txt

echo "*** SUCCESS!"
exit 0
5 changes: 5 additions & 0 deletions wgrib2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ target_link_libraries(obj_lib PUBLIC gctpc -lm)

# Link to gctpc directly because oobject libraries do not link transitively
target_link_libraries(wgrib2_exe PRIVATE gctpc)

if(${USE_AEC} STREQUAL ON)
target_link_libraries(wgrib2_exe PRIVATE aec)
endif()

target_link_libraries(wgrib2_exe PRIVATE obj_lib)

if(BUILD_LIB)
Expand Down

0 comments on commit 4024a36

Please sign in to comment.