Sounding and Hodograph Analysis and Research Program (SHARP) C++ library for conducting analysis of atmospheric sounding profiles. Based on the NSHARP routines written by John Hart and Rich Thompson at the NWS Storm Prediction Center in Norman, Oklahoma.
Code is designed to target the C++17 standard -std=c++17
, and generally should not use C++2X features. This library is written to work on RHEL8 systems, and with careful configuration, backwards to RHEL7, and should not attempt to use bleeding edge features at risk of breaking compatibility. The C++ 17 standard is not supported by the default RHEL7 compilers, but a version of GCC that supports the C++17 standard can be acquired through the devtoolset RHEL channel.
Though there are likely to be instances where it will need to be deviated from, this code generally attempts to abide by the ISO C++ Core Guidelines. While line width requirements are generally archaic, where possible we attempt to keep line lengths to a maximum of 80 characters in order to preserve split screen code editing.
Another note to the Style Guide is that, where possible/appropriate, full or verbose variable names are preferred to abbreviated ones when working with function parameters. For example, temperature
or pressure
is preferable to temp
or pres
when defining function arguments, so that it is abundantly clear to the code reader what is being passed through. This is especially the case with temperature, as temp
is commonly used to refer to temporary variables, leading to confusion.
SHARPlib has some light-weight dependencies for testing, benchmarking, documentation building, string formatting, and creating python bindings. These can easily be downloaded for building by runing the following command to download the dependencies from GitHub over SSH:
git submodule update --init --recursive
To build SHARPlib, execute the following commands in the project root directory:
cmake -B build .
cmake --build build -j N_BUILD_PROCESSES
This will build the static library in the {$POJECT_ROOT}/build
directory in parallel with N_BUILD_PROCESSES. This isn't terribly useful by itself, so to install the static library, you can execute:
cmake -B build . --install-prefix=/path/to/where/you/want/SHARPlib
cmake --build build -j N_BUILD_PROCESSES
cmake --install build
If you wish to create a debug build, simply pass the following arguments to CMake:
cmake --build build -j N_BUILD_PROCESSES --config Debug
SHARPlib C++ code can be called from Python using nanobind to handle the wrapping. Building SHARPlib with its Python bindings is quite easy-- you can simply install it via pip from the current directory:
pip install .
If you desire to manually build the SHARPlib library + python bindings, you may execute:
cmake -B build . -DBUILD_PYBIND=ON
cmake --build build -j N_BUILD_PROCESSES
For unit tests, we make use of the doctest singe header source library found in the tests
directory. In order to build and run the tests, execute the following commands from the project root directory:
cmake -B build .
cmake --build build -j N_BUILD_PROCESSES --target SHARPlib_tests
ctest --test-dir build
To build the HTML documentation pages, the following can be executed in the terminal from the project root:
doxygen Doxyfile
This will generate the HTML pages using the docstring in the header files. Obviously, it requires that Doxygen be installed, which can be found here.
Documentation is automatically built on push, and can be found here