Skip to content

Commit

Permalink
Merge pull request #143 from NOAA-EMC/we_ip_4
Browse files Browse the repository at this point in the history
use external NCEPLIBS-ip develop branch
  • Loading branch information
AlysonStahl-NOAA authored Jul 3, 2024
2 parents a3197c9 + 865e8d5 commit 9f8624f
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 1,028 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/Linux_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
matrix:
config:
- {
options: "-DUSE_IPOLATES=1"
options: "-DUSE_IPOLATES=ON"
}
- {
options: "-DUSE_AEC=ON"
Expand Down Expand Up @@ -92,15 +92,15 @@ jobs:
uses: actions/cache@v3
with:
path: ~/ip
key: ip-${{ runner.os }}-${{ matrix.ip-version }}
key: ip-${{ runner.os }}-develop

- name: checkout-ip
if: steps.cache-ip.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: NOAA-EMC/NCEPLIBS-ip
path: ip
ref: v3.3.3
ref: develop

- name: build-ip
if: steps.cache-ip.outputs.cache-hit != 'true'
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,22 @@ jobs:
make -j2
make install
- name: checkout-ip
uses: actions/checkout@v4
with:
repository: NOAA-EMC/NCEPLIBS-ip
path: ip
ref: develop

- name: build-ip
run: |
cd ip
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/ip -DCMAKE_PREFIX_PATH=~
make -j2
make install
- name: checkout
uses: actions/checkout@v4
with:
Expand All @@ -105,7 +121,7 @@ jobs:
export CFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0'
export FCFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0'
export FFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0'
cmake .. -DFTP_TEST_FILES=ON -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON
cmake .. -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON
make VERBOSE=1
ctest --verbose --output-on-failure --rerun-failed
gcovr --root .. -v --html-details --exclude ../tests --exclude CMakeFiles --print-summary -o test-coverage.html &> /dev/null
Expand Down
15 changes: 3 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ option(USE_HDF5 "Use HDF5?" off)
option(USE_REGEX "Use Regex?" on)
option(USE_TIGGE "Use tigge?" on)
option(USE_MYSQL "Use MySQL?" off)
option(USE_IPOLATES "iplib=0,1,3?" 3)
option(USE_IPOLATES "Use Ipolates" off)
option(USE_UDF "Use UDF?" off)
option(USE_OPENMP "Use OpenMP?" on)
option(USE_PROJ4 "Use Proj4?" off)
Expand Down Expand Up @@ -75,7 +75,6 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS_DEBUG "-ggdb -O0")
endif()


message(STATUS "Checking if user wants to use NCEPLIBS-g2c...")
if(USE_G2CLIB)
if(USE_PNG)
Expand All @@ -93,17 +92,10 @@ endif()

# If user wants to use NCEPLIBS-ip, find it and the sp library.
message(STATUS "Checking if the user want to use NCEPLIBS-ip...")
if(USE_IPOLATES EQUAL 1)
if(USE_IPOLATES)
find_package(ip CONFIG REQUIRED)
find_package(sp CONFIG REQUIRED)
elseif(USE_IPOLATES EQUAL 3)
find_package(ip2 CONFIG REQUIRED)
endif()

if(NOT USE_IPOLATES EQUAL 0)
list(APPEND definitions_list -DIPOLATES_LIB="ipolates_lib")
list(APPEND definitions_list -DIPOLATES_LIB="ipolates_lib_4")
endif()
list(APPEND definitions_list -DUSE_IPOLATES=${USE_IPOLATES})

message(STATUS "Checking if the user want to use NetCDF...")
if(USE_NETCDF4)
Expand Down Expand Up @@ -213,4 +205,3 @@ include(CTest)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()

21 changes: 3 additions & 18 deletions wgrib2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Import_grib_fs.c Import_lonlat.c Import_netcdf.c init.c int8.c
intpower.c Inv.c Inv_no.c Irr_grids.c itoshort_a.c JMA.c jpeg_pk.c
Last.c lat2ij.c Latlon.c Level.c Limit.c Lola.c Lvl.c Macro.c
manage_inv_out.c Match.c Match_fs.c Match_inv.c Mem_buffer.c Merge.c
Misc.c missing.c mk_gdt.c mk_kgds.c Model_version_date.c Mod_grib.c
Misc.c missing.c mk_gdt.c Model_version_date.c Mod_grib.c
Mysql.c Mysql_dump.c Mysql_speed.c Names.c ncep_grids.c NCEP_norm.c
NCEP_uv.c Ncpu.c Ndate.c Ndates.c Netcdf.c Netcdf_sup.c New_grid.c
new_grid_lambertc.c New_grid_order.c openmp_util.c parse_loop.c
Expand Down Expand Up @@ -105,23 +105,8 @@ endif()
if(USE_G2CLIB)
endif()

if(USE_IPOLATES EQUAL 1)
target_link_libraries(obj_lib PUBLIC ip::ip_d)
target_link_libraries(obj_lib PUBLIC sp::sp_d)

# Link to the Fortran runtime library for each compiler if using ip2.
# The wgrib2 exectuable is created using the C compiler and
# doesn't link the necessary Fortran library required for ip2.
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
target_link_libraries(wgrib2_exe PRIVATE "-lifcore")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
target_link_libraries(wgrib2_exe PRIVATE "-lgfortran")
endif()

endif()

if(USE_IPOLATES EQUAL 3)
target_link_libraries(obj_lib PUBLIC ip2::ip2_d)
if(USE_IPOLATES)
target_link_libraries(obj_lib PUBLIC ip::ip_4)

# Link to the Fortran runtime library for each compiler if using ip2.
# The wgrib2 exectuable is created using the C compiler and
Expand Down
8 changes: 2 additions & 6 deletions wgrib2/Config.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,9 @@ int f_config(ARG0) {
strcat(inv_out, "tigge package is not installed\n");
#endif

#if USE_IPOLATES > 0
#ifdef USE_IPOLATES
inv_out += strlen(inv_out);
sprintf(inv_out, "IPOLATES " IPOLATES_LIB " (option %d) is installed", USE_IPOLATES);
#if USE_SPECTRAL > 0
strcat(inv_out, " with spectral interpolation");
#endif
strcat(inv_out, ", default vectors:\n");
sprintf(inv_out, "IPOLATES NCEPLIBS-ip\n");
#else
strcat(inv_out, "interpolation package is not installed, default vectors:\n");
#endif
Expand Down
Loading

0 comments on commit 9f8624f

Please sign in to comment.