From 7e10ea5ae41a543e5da5d20306b55d3212703bcd Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:32:17 -0700 Subject: [PATCH 01/14] cmake support for openjpeg --- .github/workflows/Linux_options.yml | 3 +++ .github/workflows/developer.yml | 2 +- CMakeLists.txt | 16 ++++++++++------ tests/CMakeLists.txt | 3 +++ tests/run_jpeg_tests.sh | 10 ++++++++++ 5 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 tests/run_jpeg_tests.sh diff --git a/.github/workflows/Linux_options.yml b/.github/workflows/Linux_options.yml index 037b2376..07c2bda8 100644 --- a/.github/workflows/Linux_options.yml +++ b/.github/workflows/Linux_options.yml @@ -39,6 +39,9 @@ jobs: - { options: "-DBUILD_WGRIB=ON" } + - { + options: "-DUSE_OPENJPEG=ON" + } steps: diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml index 9ece03e8..cc7c3cda 100644 --- a/.github/workflows/developer.yml +++ b/.github/workflows/developer.yml @@ -141,7 +141,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 .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2;~/sp" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON + cmake .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2;~/sp" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=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 diff --git a/CMakeLists.txt b/CMakeLists.txt index a7472af6..d6a3d18a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,10 @@ if(USE_NETCDF4) list(APPEND definitions_list -DUSE_NETCDF4 -DUSE_HDF5 -DHDF5="hdf5") endif() +if(USE_OPENJPEG AND USE_JASPER) + message(FATAL_ERROR "USE_OPENJPEG OR USE_JASPER, not both") +endif() + message(STATUS "Checking if the user wants to use Jasper...") if(USE_JASPER) list(APPEND definitions_list -DUSE_JASPER) @@ -113,6 +117,12 @@ if(USE_JASPER) endif() endif() +# Find required packages to use OpenJPEG +message(STATUS "Checking of the user wants to use OpenJPEG...") +if(USE_OPENJPEG) + find_package(OpenJPEG REQUIRED) +endif() + message(STATUS "Checking if the user want to use OpenMP...") if(USE_OPENMP) find_package(OpenMP) @@ -130,12 +140,6 @@ if(USE_PNG) find_package(PNG REQUIRED) endif() -# Find required packages to use OpenJPEG -message(STATUS "Checking of the user wants to use OpenJPEG...") -if(USE_OPENJPEG) - find_package(OpenJPEG REQUIRED) -endif() - # Find required packages to use AEC message(STATUS "Checking of the user wants to use AEC...") if(USE_AEC) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0f25a28e..3e34f26f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -128,6 +128,9 @@ endif() if (USE_AEC) shell_test(run_wgrib2_aec_tests) endif() +if (USE_JASPER OR USE_OPENJPEG) + shell_test(run_jpeg_tests) +endif() if (FTP_TEST_FILES) copy_test_data(ref_WW3_Regional_US_West_Coast_20220718_0000.grib2.inv) diff --git a/tests/run_jpeg_tests.sh b/tests/run_jpeg_tests.sh new file mode 100644 index 00000000..bfe3aec9 --- /dev/null +++ b/tests/run_jpeg_tests.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# This tests support for jpeg2000 compressed grib files. +# Only available if USE_JASPER=ON or USE_OPENJPEG=ON CMake. +# +# Alyson Stahl 7/26/2024 + +set -e + +echo "*** SUCCESS!" +exit 0 \ No newline at end of file From 564dcf36945c70db5ba8b4369e984611e474dc1d Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:34:23 -0700 Subject: [PATCH 02/14] some typos --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d6a3d18a..cbe0b426 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,7 +118,7 @@ if(USE_JASPER) endif() # Find required packages to use OpenJPEG -message(STATUS "Checking of the user wants to use OpenJPEG...") +message(STATUS "Checking if the user wants to use OpenJPEG...") if(USE_OPENJPEG) find_package(OpenJPEG REQUIRED) endif() @@ -134,14 +134,14 @@ if(USE_OPENMP) # endif() endif() -message(STATUS "Checking of the user wants to use PNG...") +message(STATUS "Checking if the user wants to use PNG...") if(USE_PNG) find_package(ZLIB REQUIRED) find_package(PNG REQUIRED) endif() # Find required packages to use AEC -message(STATUS "Checking of the user wants to use AEC...") +message(STATUS "Checking if the user wants to use AEC...") if(USE_AEC) find_package(libaec 1.0.6 REQUIRED) endif() From 89b32331ca6390e612cd73a62b7d6b0f6a92fa5f Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:43:32 -0700 Subject: [PATCH 03/14] set path to jasper --- .github/workflows/developer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml index cc7c3cda..998764f6 100644 --- a/.github/workflows/developer.yml +++ b/.github/workflows/developer.yml @@ -141,7 +141,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 .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2;~/sp" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=ON + cmake .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2;~/sp;~/jasper" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=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 From c8db8cdd8a4b82f4b907c809c2eb513dc5e52b9b Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:48:11 -0700 Subject: [PATCH 04/14] typo --- .github/workflows/developer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml index 998764f6..bcf67700 100644 --- a/.github/workflows/developer.yml +++ b/.github/workflows/developer.yml @@ -141,7 +141,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 .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2;~/sp;~/jasper" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=ON + cmake .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2;~/sp;~/Jasper" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=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 From 3fee3797197c4db31e888755c54c7c22f5e035e3 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:57:06 -0700 Subject: [PATCH 05/14] Update developer.yml --- .github/workflows/developer.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml index bcf67700..f8734021 100644 --- a/.github/workflows/developer.yml +++ b/.github/workflows/developer.yml @@ -53,7 +53,7 @@ jobs: if: steps.cache-jasper.outputs.cache-hit != 'true' run: | cd jasper - ./configure --prefix=$HOME/Jasper + ./configure --prefix=$HOME/jasper make make install @@ -141,7 +141,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 .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2;~/sp;~/Jasper" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=ON + cmake .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2;~/sp;~/jasper" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=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 From a810b8754100ce43a1ff8874cbca0ee1e0955dde Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:08:09 -0700 Subject: [PATCH 06/14] debugging --- .github/workflows/developer.yml | 4 ++-- .vscode/settings.json | 5 +++++ wgrib2/Config.c | 3 --- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml index f8734021..bcf67700 100644 --- a/.github/workflows/developer.yml +++ b/.github/workflows/developer.yml @@ -53,7 +53,7 @@ jobs: if: steps.cache-jasper.outputs.cache-hit != 'true' run: | cd jasper - ./configure --prefix=$HOME/jasper + ./configure --prefix=$HOME/Jasper make make install @@ -141,7 +141,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 .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2;~/sp;~/jasper" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=ON + cmake .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2;~/sp;~/Jasper" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=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 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..3faec544 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "grb2.h": "c" + } +} \ No newline at end of file diff --git a/wgrib2/Config.c b/wgrib2/Config.c index 823b050b..8d0ff323 100644 --- a/wgrib2/Config.c +++ b/wgrib2/Config.c @@ -4,9 +4,6 @@ #include #include #include "wgrib2.h" -#ifdef USE_JASPER -#include -#endif #include "grb2.h" #include "fnlist.h" From 9746a0273b684f1e2a6937ab15139e18a026f0d5 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:15:18 -0700 Subject: [PATCH 07/14] more debugging --- CMakeLists.txt | 1 + wgrib2/Config.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cbe0b426..b0a3078c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,6 +112,7 @@ message(STATUS "Checking if the user wants to use Jasper...") if(USE_JASPER) list(APPEND definitions_list -DUSE_JASPER) find_package(Jasper REQUIRED) + include_directories(JASPER_INCLUDE_DIR) if(JASPER_VERSION_STRING VERSION_GREATER_EQUAL "1.900.25") list(APPEND definitions_list -DJAS_VERSION_MAJOR=2) endif() diff --git a/wgrib2/Config.c b/wgrib2/Config.c index 8d0ff323..67abbc68 100644 --- a/wgrib2/Config.c +++ b/wgrib2/Config.c @@ -4,6 +4,9 @@ #include #include #include "wgrib2.h" +#ifdef USE_JASPER +#include +#endif #include "grb2.h" #include "fnlist.h" From 5642344469b92f4aa8995cda506545ea8e3b5eb6 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:44:35 -0700 Subject: [PATCH 08/14] Delete settings.json --- .vscode/settings.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 3faec544..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "files.associations": { - "grb2.h": "c" - } -} \ No newline at end of file From e5c7b03c9cda1c487649873f2e6a79916af3b4e4 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:57:09 -0700 Subject: [PATCH 09/14] more debugging --- CMakeLists.txt | 1 - wgrib2/CMakeLists.txt | 1 + wgrib2/Config.c | 2 +- wgrib2/enc_jpeg2000_clone.c | 2 +- wgrib2/unpk.c | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b0a3078c..cbe0b426 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,7 +112,6 @@ message(STATUS "Checking if the user wants to use Jasper...") if(USE_JASPER) list(APPEND definitions_list -DUSE_JASPER) find_package(Jasper REQUIRED) - include_directories(JASPER_INCLUDE_DIR) if(JASPER_VERSION_STRING VERSION_GREATER_EQUAL "1.900.25") list(APPEND definitions_list -DJAS_VERSION_MAJOR=2) endif() diff --git a/wgrib2/CMakeLists.txt b/wgrib2/CMakeLists.txt index dfd4881b..2afc7325 100644 --- a/wgrib2/CMakeLists.txt +++ b/wgrib2/CMakeLists.txt @@ -90,6 +90,7 @@ if(USE_NETCDF4) endif() if(USE_JASPER) + include_directories(${JASPER_INCLUDE_DIR}) target_include_directories(obj_lib PUBLIC ${JASPER_INCLUDE_DIR}) target_link_libraries(obj_lib PUBLIC ${JASPER_LIBRARIES}) endif() diff --git a/wgrib2/Config.c b/wgrib2/Config.c index 67abbc68..b2725762 100644 --- a/wgrib2/Config.c +++ b/wgrib2/Config.c @@ -5,7 +5,7 @@ #include #include "wgrib2.h" #ifdef USE_JASPER -#include +#include "jasper.h" #endif #include "grb2.h" #include "fnlist.h" diff --git a/wgrib2/enc_jpeg2000_clone.c b/wgrib2/enc_jpeg2000_clone.c index 680dc6e5..43a0625a 100644 --- a/wgrib2/enc_jpeg2000_clone.c +++ b/wgrib2/enc_jpeg2000_clone.c @@ -3,7 +3,7 @@ #include "wgrib2.h" #ifdef USE_JASPER -#include +#include "jasper.h" #define JAS_1_700_2 diff --git a/wgrib2/unpk.c b/wgrib2/unpk.c index 42b3e854..f8d7574b 100644 --- a/wgrib2/unpk.c +++ b/wgrib2/unpk.c @@ -17,7 +17,7 @@ int i; #endif #ifdef USE_JASPER - #include + #include "jasper.h" #endif #ifdef USE_AEC From 94b4efa32a5a6471ce97d4710381ef5666786a88 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 26 Jul 2024 14:03:30 -0700 Subject: [PATCH 10/14] debug --- .github/workflows/Linux_options.yml | 2 +- .github/workflows/developer.yml | 4 ++-- wgrib2/Config.c | 2 +- wgrib2/enc_jpeg2000_clone.c | 2 +- wgrib2/unpk.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/Linux_options.yml b/.github/workflows/Linux_options.yml index 07c2bda8..7d1f1cb6 100644 --- a/.github/workflows/Linux_options.yml +++ b/.github/workflows/Linux_options.yml @@ -70,7 +70,7 @@ jobs: if: steps.cache-jasper.outputs.cache-hit != 'true' run: | cd jasper - ./configure --prefix=$HOME/Jasper + ./configure --prefix=$HOME/jasper make make install diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml index bcf67700..f8734021 100644 --- a/.github/workflows/developer.yml +++ b/.github/workflows/developer.yml @@ -53,7 +53,7 @@ jobs: if: steps.cache-jasper.outputs.cache-hit != 'true' run: | cd jasper - ./configure --prefix=$HOME/Jasper + ./configure --prefix=$HOME/jasper make make install @@ -141,7 +141,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 .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2;~/sp;~/Jasper" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=ON + cmake .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2;~/sp;~/jasper" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=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 diff --git a/wgrib2/Config.c b/wgrib2/Config.c index b2725762..823b050b 100644 --- a/wgrib2/Config.c +++ b/wgrib2/Config.c @@ -5,7 +5,7 @@ #include #include "wgrib2.h" #ifdef USE_JASPER -#include "jasper.h" +#include #endif #include "grb2.h" #include "fnlist.h" diff --git a/wgrib2/enc_jpeg2000_clone.c b/wgrib2/enc_jpeg2000_clone.c index 43a0625a..680dc6e5 100644 --- a/wgrib2/enc_jpeg2000_clone.c +++ b/wgrib2/enc_jpeg2000_clone.c @@ -3,7 +3,7 @@ #include "wgrib2.h" #ifdef USE_JASPER -#include "jasper.h" +#include #define JAS_1_700_2 diff --git a/wgrib2/unpk.c b/wgrib2/unpk.c index f8d7574b..42b3e854 100644 --- a/wgrib2/unpk.c +++ b/wgrib2/unpk.c @@ -17,7 +17,7 @@ int i; #endif #ifdef USE_JASPER - #include "jasper.h" + #include #endif #ifdef USE_AEC From 810c7915e6c3f9c421a7f3b8d683a4e593e09d34 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 26 Jul 2024 14:09:10 -0700 Subject: [PATCH 11/14] debugging --- wgrib2/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgrib2/CMakeLists.txt b/wgrib2/CMakeLists.txt index 2afc7325..bd12b0f0 100644 --- a/wgrib2/CMakeLists.txt +++ b/wgrib2/CMakeLists.txt @@ -90,7 +90,7 @@ if(USE_NETCDF4) endif() if(USE_JASPER) - include_directories(${JASPER_INCLUDE_DIR}) + #include_directories(${JASPER_INCLUDE_DIR}) target_include_directories(obj_lib PUBLIC ${JASPER_INCLUDE_DIR}) target_link_libraries(obj_lib PUBLIC ${JASPER_LIBRARIES}) endif() From 70ab51e26e7cca7e8b357022ad000ea3aeb6e39e Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 26 Jul 2024 14:11:38 -0700 Subject: [PATCH 12/14] Update CMakeLists.txt --- wgrib2/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgrib2/CMakeLists.txt b/wgrib2/CMakeLists.txt index bd12b0f0..2afc7325 100644 --- a/wgrib2/CMakeLists.txt +++ b/wgrib2/CMakeLists.txt @@ -90,7 +90,7 @@ if(USE_NETCDF4) endif() if(USE_JASPER) - #include_directories(${JASPER_INCLUDE_DIR}) + include_directories(${JASPER_INCLUDE_DIR}) target_include_directories(obj_lib PUBLIC ${JASPER_INCLUDE_DIR}) target_link_libraries(obj_lib PUBLIC ${JASPER_LIBRARIES}) endif() From 2f5bc1ca1a29337bc390df3fe7fb2621941083ee Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Tue, 30 Jul 2024 11:36:50 -0700 Subject: [PATCH 13/14] adding test --- tests/run_jpeg_tests.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/run_jpeg_tests.sh b/tests/run_jpeg_tests.sh index bfe3aec9..c1c0f1d9 100644 --- a/tests/run_jpeg_tests.sh +++ b/tests/run_jpeg_tests.sh @@ -5,6 +5,18 @@ # Alyson Stahl 7/26/2024 set -e +echo "*** Running jpeg tests" + +echo "create a new grib file with integer values" +../wgrib2/wgrib2 data/gdaswave.t00z.wcoast.0p16.f000.grib2 -rpn floor -set_scaling 0 0 -set_grib_type same -grib_out jpeg.grb +../wgrib2/wgrib2 jpeg.grb -v2 -s > jpeg.txt + +echo "*** Converting from jpeg to simple packing and back" +../wgrib2/wgrib2 jpeg.grb -set_grib_type simple -grib_out jpeg2simple.grb +../wgrib2/wgrib2 jpeg2simple.grb -set_grib_type jpeg -grib_out simple2jpeg.grb +../wgrib2/wgrib2 simple2jpeg.grb -v2 -s > simple2jpeg.txt +touch simple2jpeg.txt +diff -w simple2jpeg.txt jpeg.txt echo "*** SUCCESS!" exit 0 \ No newline at end of file From bf6d59f3c4839a7ae443d11b984b9769aec519ae Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Tue, 30 Jul 2024 13:37:45 -0700 Subject: [PATCH 14/14] swapped out test --- tests/CMakeLists.txt | 1 + tests/data/ref_jpeg2simple.txt | 19 +++++++++++++++++++ tests/run_jpeg_tests.sh | 18 +++++------------- 3 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 tests/data/ref_jpeg2simple.txt diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 01e885e5..4889a49c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -157,6 +157,7 @@ if (USE_AEC) endif() if (USE_JASPER OR USE_OPENJPEG) shell_test(run_jpeg_tests) + copy_test_data(ref_jpeg2simple.txt) endif() if (FTP_TEST_FILES) diff --git a/tests/data/ref_jpeg2simple.txt b/tests/data/ref_jpeg2simple.txt new file mode 100644 index 00000000..194644cb --- /dev/null +++ b/tests/data/ref_jpeg2simple.txt @@ -0,0 +1,19 @@ +1:0:00Z30nov2021:WIND Wind Speed [m/s]:lvl1=(1,1) lvl2=(255,missing):surface:anl: +2:19910:00Z30nov2021:WDIR Wind Direction (from which blowing) [deg]:lvl1=(1,1) lvl2=(255,missing):surface:anl: +3:46720:00Z30nov2021:UGRD U-Component of Wind [m/s]:lvl1=(1,1) lvl2=(255,missing):surface:anl: +4:66630:00Z30nov2021:VGRD V-Component of Wind [m/s]:lvl1=(1,1) lvl2=(255,missing):surface:anl: +5:87920:00Z30nov2021:HTSGW Significant Height of Combined Wind Waves and Swell [m]:lvl1=(1,1) lvl2=(255,missing):surface:anl: +6:105070:00Z30nov2021:PERPW Primary Wave Mean Period [s]:lvl1=(1,1) lvl2=(255,missing):surface:anl: +7:123600:00Z30nov2021:DIRPW Primary Wave Direction [deg]:lvl1=(1,1) lvl2=(255,missing):surface:anl: +8:147650:00Z30nov2021:WVHGT Significant Height of Wind Waves [m]:lvl1=(1,1) lvl2=(255,missing):surface:anl: +9:158136:00Z30nov2021:SWELL Significant Height of Swell Waves [m]:lvl1=(241,1) lvl2=(255,missing):1 in sequence:anl: +10:175286:00Z30nov2021:SWELL Significant Height of Swell Waves [m]:lvl1=(241,2) lvl2=(255,missing):2 in sequence:anl: +11:190969:00Z30nov2021:SWELL Significant Height of Swell Waves [m]:lvl1=(241,3) lvl2=(255,missing):3 in sequence:anl: +12:204751:00Z30nov2021:WVPER Mean Period of Wind Waves [s]:lvl1=(1,1) lvl2=(255,missing):surface:anl: +13:216517:00Z30nov2021:SWPER Mean Period of Swell Waves [s]:lvl1=(241,1) lvl2=(255,missing):1 in sequence:anl: +14:236427:00Z30nov2021:SWPER Mean Period of Swell Waves [s]:lvl1=(241,2) lvl2=(255,missing):2 in sequence:anl: +15:256219:00Z30nov2021:SWPER Mean Period of Swell Waves [s]:lvl1=(241,3) lvl2=(255,missing):3 in sequence:anl: +16:275175:00Z30nov2021:WVDIR Direction of Wind Waves [deg]:lvl1=(1,1) lvl2=(255,missing):surface:anl: +17:290139:00Z30nov2021:SWDIR Direction of Swell Waves [deg]:lvl1=(241,1) lvl2=(255,missing):1 in sequence:anl: +18:314189:00Z30nov2021:SWDIR Direction of Swell Waves [deg]:lvl1=(241,2) lvl2=(255,missing):2 in sequence:anl: +19:340827:00Z30nov2021:SWDIR Direction of Swell Waves [deg]:lvl1=(241,3) lvl2=(255,missing):3 in sequence:anl: diff --git a/tests/run_jpeg_tests.sh b/tests/run_jpeg_tests.sh index c1c0f1d9..fbaf1d3a 100644 --- a/tests/run_jpeg_tests.sh +++ b/tests/run_jpeg_tests.sh @@ -4,19 +4,11 @@ # # Alyson Stahl 7/26/2024 -set -e -echo "*** Running jpeg tests" - -echo "create a new grib file with integer values" -../wgrib2/wgrib2 data/gdaswave.t00z.wcoast.0p16.f000.grib2 -rpn floor -set_scaling 0 0 -set_grib_type same -grib_out jpeg.grb -../wgrib2/wgrib2 jpeg.grb -v2 -s > jpeg.txt - -echo "*** Converting from jpeg to simple packing and back" -../wgrib2/wgrib2 jpeg.grb -set_grib_type simple -grib_out jpeg2simple.grb -../wgrib2/wgrib2 jpeg2simple.grb -set_grib_type jpeg -grib_out simple2jpeg.grb -../wgrib2/wgrib2 simple2jpeg.grb -v2 -s > simple2jpeg.txt -touch simple2jpeg.txt -diff -w simple2jpeg.txt jpeg.txt +echo "*** Converting from jpeg to simple packing" +../wgrib2/wgrib2 data/gdaswave.t00z.wcoast.0p16.f000.grib2 -set_grib_type simple -grib_out jpeg2simple.grb +../wgrib2/wgrib2 jpeg2simple.grb -v2 -s > jpeg2simple.txt +touch jpeg2simple.txt +diff -w jpeg2simple.txt data/ref_jpeg2simple.txt echo "*** SUCCESS!" exit 0 \ No newline at end of file