Skip to content

SHARP C++ library for conducting analysis of atmospheric sounding profiles.

License

Notifications You must be signed in to change notification settings

a-urq/SHARPlib

 
 

Repository files navigation

SHARP-calc

C++ CI

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.

C++ Version

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.

Style Guide

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.

BEFORE YOU BUILD

SHARPlib has some light-weight dependencies for testing, benchmarking, documentation building, and string formatting. 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 

Unit Testing Framework

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:

mkdir build; cd build
cmake ..
make SHARPlib_tests
make test

NOTE: Right now, on Apple CLang, (and potentially CLang as a whole) some of the kinematics unit tests don't pass. Don't be alarmed if that's the case, it's just a difference in how the compilers treat certain things and will be remedied in the future.

Building the Static Library

To build the static library, simply run the following commands from the project root directory:

mkdir build; cd build
cmake .. 
make
make install

It will install the static library to PROJECT_ROOT/lib.

The library will be built in release mode by default, which sets the -O3 optimization flag. To build in debug mode, clean out the build directory (CMake will cache certain things) and run the following command and proceed to build normally:

cmake -DCMAKE_BUILD_TYPE=Debug ..

If you are planning on using the library with gridded data, you can turn off quality control checks traditionally only needed for observed sounding profile data. This can be disabled by running CMake with the following build flag:

cmake -DCMAKE_CXX_FLAGS="-DNO_QC" ..

This will also disable missing value checks in the tests directory.

If you would like a verbose compile process, run the make command in the following manner:

make VERBOSE=1

Building the Python bindings

To build the python bindings, simply nagivate to the swig directory and install via pip. The python bindings require having SWIG installed, as well as a C++17 compatible compiler. The bindings will be installed in the following namespace tree: nwsspc.sharp.calc.

WARNING: You will need SWIG >= 4.1 for the library to compile. This is available through the conda-forge channel: conda install -c conda-forge swig==4.1.

cd swig
CC=/path/to/compilers/g++ pip install .

Building the Docs

To build the HTML documentation pages, simply navigate your terminal to the docs directory and run:

cd docs
git submodule update --init --recursive ## download the CSS for the documentation
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.

About

SHARP C++ library for conducting analysis of atmospheric sounding profiles.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 74.1%
  • C 16.3%
  • SWIG 6.9%
  • Python 1.9%
  • CMake 0.8%