Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRS Template 5.42 which references CCSDS/AEC Compression #424

Closed
edwardhartnett opened this issue Jul 5, 2023 · 5 comments
Closed

DRS Template 5.42 which references CCSDS/AEC Compression #424

edwardhartnett opened this issue Jul 5, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@edwardhartnett
Copy link
Contributor

Add support for DRS Template 5.42 which references CCSDS/AEC Compression

@edwardhartnett edwardhartnett added the enhancement New feature or request label Jul 5, 2023
@edwardhartnett edwardhartnett self-assigned this Jul 5, 2023
@EricEngle-NOAA
Copy link
Contributor

Any movement on this? I could take a shot at implementing this.

@edwardhartnett
Copy link
Contributor Author

Sorry I'm still pretty far from implementing this.

I've been working on the Fortran library and utilities, which have had a long backlog of important bugs to fix. Once those are caught up I will return to the C library.

If you want to implement this, that would be fantastic. You will not neglect unit testing, I'm sure...

edwardhartnett added a commit that referenced this issue Oct 24, 2023
* Initial commit for libaec support

This commit modifies the top-level and source CMake configuration files
to link to libaec to add support for AEC/CCSDS compression, as specified
by GRIB2 DRT 5.42.

NOTE:  At this time, libaec v1.0.6 places cmake config files in
/usr/lib64 on RHEL-based systems, so to build g2c, you need to add
-DCMAKE_PREFIX_PATH=/usr/lib64

This commit references #424

[skip ci]

* Encoding support for AEC/CCSDS compression

This commit allows for the ability to encode data into a GRIB2 message
using AEC/CCSDS specified by DRS template 5.42.

drstemplates.c now defines template 5.42 and its byte mapping.

g2_addfield.c contains the proper logic to call aecpack.c

New source file, aecpack.c performs the preparation of data for packing

New source file, decenc_aec.c contains the encoding function, enc_aec

Finally, grib2.h.in and grib2_int.h have been updated for AEC.

This commit references #424

* Update for grib2.h.in to add more AEC defs.

This commit references #424

* Update decenc_aec.c to use g2c logging.

This commit references #424

* Update for aecpack.c

This commit builds out the capabilities of aecpack.c to handle data as
float or double and establish g2c v2 API calls.. using jpcpack.c as a
blueprint.

This commit references #424

* Update CMakeList.txt files for AEC

In the top-level CMake config, added aecunpack.c to sources for AEC

In utils/CMakeLists.txt, added ${AEC_LIBRARIES}

* Update g2c include files.

Added aec pack/unpack and encode/decode function definitions.

* Update g2_unpack7 to support AEC unpacking.

* Commit for AEC compression codes.

New source file, aecunpack.c contains functions for handling the
unpacking of data.  Floats and doubles are accommodated here. This
source file mimmics jpcunpack.c

Clean up of aecpack.c

Adding dec_aec() to decenc_aec.c as well as documentation.

* Cleanup of aecpack.c

General clean up of aecpack.c.

In the function, logic has been added to default values for the
AEC/CCSDS parameters if they are set to zero in the input DRS
template For nbits, added logic to round up the value to
the next base 2 integer.  For example, nbits set to 12 in the scaling
part of the code will be rounded to 16.

* Update for aecpack()

Updated how nbits is handled from the template to the encoder.

If nbits is set by the user, the value will be used and rounded to the
next base 2 integer, otherwise, the value of nbits from scaling
procedures will be used.

* Update for aecpack.c

Repositioned code block that fills ctemp with ifld data to after the
settings of the AEC compression parameters since nbits can be modified
in that process.

* Update for aecunpack.c

Removed (char *) type setting for cpack in call to dec_aec().  This was
not needed.

Added check for return for call to dec_aec().

General cleanup of whitespace.

* Commit for adding tests for AEC compression.

* Update CI tests for AEC compression

Also updated spack configuration for AEC.

* Update decenc_aec.c

Fixed typo in documentation of "data" to "date".

[skip ci]

* Update README.md

Updated README.md to include information about LibAEC.

* Update for tst_aec.c

Redefined lcpack to g2int to match argument for aecpack().

* Update for macOS GitHub workflow

Added logic to identify the root directory for libaec installed via
Homebrew.

* Another try at macOS GitHub Workflow.

Using env var libaec_DIR now.

* Another try for macOS GitHub workflow

Also cleaned up a fprintf line in aecunpack.c that was tripping up
another workflow.

* Fix a sloppy typo by me in aecunpack.c

* Update for tests CMake config

Setting AEC_LIBRARIES and AEC_INCLUDE_DIR.

* Update for tst_aec.c

I realized that none of the 3rd party compression test include their
respective library include files.

This removes the need to have libaec.h.

* Update for tst_aec.c

Define lcpack as size_t when testing g2c_aecpackd()/g2c_aecunpackd().

* Update for tests/CMakeLists.txt

Removing setting AEC_* CMake vars.  This is not needed.

* Update for CMake config for libaec

Added Findlibaec.cmake file to perform custom commands for finding
libaec include and libraries files/paths. It seems that libaec on Linux
does not provide cmake or pkg-config (.pc) files.

Update other CMake config files to work with vars set from
cmake/Findlibaec.cmake.

These changes were tested on my Ubuntu 22.04 VM and build/test
was successful.

* Clean up aecpack/aecunpack

Cleaning up some unsed variables in aecpack.c and aecunpack.c

Added tests configs to Linux_options to round out the various test
scenarios wrt Jasper, OpenJPEG, PNG, and AEC libraries.

* Update for GitHub workflow macOS

Removed setting libaec_DIR env var -- no longer needed.

* Update .gitignore

Added .DS_Store

[skip ci]

---------

Co-authored-by: Eric Engle <[email protected]>
Co-authored-by: Edward Hartnett <[email protected]>
@edwardhartnett
Copy link
Contributor Author

I believe this is now complete.

@JKrobNESDIS
Copy link

JKrobNESDIS commented Nov 2, 2023

Glad to see progress on this issue - will the Fortran library be updated as well, by chance (as per the original request)?

@edwardhartnett
Copy link
Contributor Author

The next g2 release will depend on g2c and will include fortran wrappers around the AEC compression. In other words, yes, the next g2 release will support this compression, but it will not re-implement this code, it will simply start to use the C library.

There are other cases where there are duplicate code and functionality between the two libraries. I will start to clean that away, with all the core functionality in the g2c library, exposed by wrappers in g2 library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants