How to enable JPG feature in ecCodes on MacOS
Grid point fields in some grib files are encoded into the JPEG 2000 code. To process these fields with eccodes, you need to enable the JPG feature. On MacOS, there are some details should be showed.
According to the wiki page about ecCodes installation, ecCodes uses CMake for compilation and installation. If you wish to enable JPG feature of ecCodes, you are advised to configure the build with:
cmake -DENABLE_JPG=ON ...
This option of cmake should look for Jasper or OpenJPG. Install openjpeg
package with Homebrew for MacOS:
brew install openjpeg
openjpeg
has been installed at /usr/local/Cellar/openjpeg/2.3.1
.
Then we need to make cmake recognize the installed openjpeg.
cmake -DENABLE_JPG=ON -DOPENJPEG_INCLUDE_DIR=/usr/local/Cellar/openjpeg/2.3.1/include/openjpeg-2.3
In the printed debug information, you will see:
-- The following OPTIONAL packages have been found: * Git * HDF5 * NumPy * CMath * JPEG * OpenJPEG
You have enabled JPG feature successfully.