Skip to content

Commit

Permalink
Add hints for NetCDFcxx not found error; fix typos (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
btschwertfeger authored May 17, 2023
1 parent 17244dc commit 6490976
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 33 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
56 changes: 56 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
## Checks the code logic, style and more
# -*- coding: utf-8 -*-
# Copyright (C) 2023 Benjamin Thomas Schwertfeger
# Github: https://github.com/btschwertfeger
#
# Workflow to apply pre-commit, build, test and upload the docker
# image(s).

name: CI/CD

on:
push:
branches:
- "**"

concurrency:
group: CICD-${{ github.ref }}
cancel-in-progress: true

jobs:
## Run the pre-commit content
Pre-Commit:
uses: ./.github/workflows/_pre_commit.yaml

## Build the BiasAdjustCXX command-line tool
##
Build:
needs: [Pre-Commit]
uses: ./.github/workflows/_build.yaml

## Build the documentation
##
Build-Doc:
needs: [Pre-Commit]
uses: ./.github/workflows/_build_doc.yaml
with:
os: "ubuntu-latest"
python-version: "3.11"

## Build the test suite and run the unit tests
##
Test:
needs: [Pre-Commit]
uses: ./.github/workflows/_test.yaml

## Create and upload a docker image
##
Docker:
if: success() && github.ref == 'refs/heads/dev'
needs: [Build, Test]
uses: ./.github/workflows/_build_docker.yaml
with:
TAG: ${{ github.ref_name }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
29 changes: 13 additions & 16 deletions .github/workflows/cicd.yml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,34 @@
# Github: https://github.com/btschwertfeger
#
# Workflow to apply pre-commit, build, test and upload the docker
# image(s).
# image. This job is only triggered during a release.

name: CI/CD
name: Release

on:
push:
branches:
- "**"
release:
types: [created]

concurrency:
group: CICD-${{ github.ref }}
group: Release-${{ github.ref }}
cancel-in-progress: true

jobs:
## Run the pre-commit content
Pre-Commit:
uses: ./.github/workflows/_pre_commit.yml
uses: ./.github/workflows/_pre_commit.yaml

## Build the BiasAdjustCXX command-line tool
##
Build:
needs: [Pre-Commit]
uses: ./.github/workflows/_build.yml
uses: ./.github/workflows/_build.yaml

## Build the documentation
##
Build-Doc:
needs: [Pre-Commit]
uses: ./.github/workflows/_build_doc.yml
uses: ./.github/workflows/_build_doc.yaml
with:
os: "ubuntu-latest"
python-version: "3.11"
Expand All @@ -41,14 +40,13 @@ jobs:
##
Test:
needs: [Pre-Commit]
uses: ./.github/workflows/_test.yml
uses: ./.github/workflows/_test.yaml

## Create and upload a docker image
## Create and upload the tagged docker image
##
Docker:
if: success() && github.ref == 'refs/heads/dev'
Docker-tag:
needs: [Build, Test]
uses: ./.github/workflows/_build_docker.yml
uses: ./.github/workflows/_build_docker.yaml
with:
TAG: ${{ github.ref_name }}
secrets:
Expand All @@ -59,8 +57,7 @@ jobs:
##
Docker-latest:
needs: [Build, Test]
if: success() && github.ref == 'refs/heads/master'
uses: ./.github/workflows/_build_docker.yml
uses: ./.github/workflows/_build_docker.yaml
with:
TAG: latest
secrets:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
.ipynb_checkpoints
build/
output/
.vscode/
*tmp*
qdm_result.nc
del/
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [Unreleased](https://github.com/btschwertfeger/BiasAdjustCXX/tree/HEAD)

[Full Changelog](https://github.com/btschwertfeger/BiasAdjustCXX/compare/v1.9.0...HEAD)

**Merged pull requests:**

- Add release workflow [\#27](https://github.com/btschwertfeger/BiasAdjustCXX/pull/27) ([btschwertfeger](https://github.com/btschwertfeger))
- Clarified difference between stochastic and non-stochastic climate variables in doc and readme [\#26](https://github.com/btschwertfeger/BiasAdjustCXX/pull/26) ([btschwertfeger](https://github.com/btschwertfeger))
- Added more checks during testing [\#25](https://github.com/btschwertfeger/BiasAdjustCXX/pull/25) ([btschwertfeger](https://github.com/btschwertfeger))

## [v1.9.0](https://github.com/btschwertfeger/BiasAdjustCXX/tree/v1.9.0) (2023-04-20)

[Full Changelog](https://github.com/btschwertfeger/BiasAdjustCXX/compare/v1.8.1...v1.9.0)
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
include(FindNetCDFCxx)

if(netCDFCxx_FOUND)
message (STATUS "NetCDFCxx found!")
message (STATUS "NetCDFCXX found!")
include_directories(${NetCDFCxx_INCLUDE_DIRS})
else()
message (FATAL_ERROR "Cannot find NetCDFCxx!")
message (FATAL_ERROR "Cannot find NetCDFCXX. Make sure that `ncxx4-config` is globally executable!")
endif()

add_subdirectory(src)
Expand Down
12 changes: 8 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ BiasAdjustCXX command-line tool for the application of fast and efficient bias c
.. |DOI badge| image:: https://zenodo.org/badge/495881923.svg
:target: https://zenodo.org/badge/latestdoi/495881923

.. |Publication bage| image:: https://img.shields.io/badge/Publication-doi.org%2F10.1016%2Fj.softx.2023.101379-blue
.. |Publication badge| image:: https://img.shields.io/badge/Publication-doi.org%2F10.1016%2Fj.softx.2023.101379-blue
:target: https://doi.org/10.1016/j.softx.2023.101379

.. LINKS
Expand Down Expand Up @@ -82,7 +82,7 @@ BiasAdjustCXX command-line tool for the application of fast and efficient bias c

|GitHub badge| |License badge| |C++ badge| |CICD badge|
|Docker pulls badge| |GCC badge| |CMake badge|
|Release date badge| |Release tag badge| |DOI badge| |Publication bage|
|Release date badge| |Release tag badge| |DOI badge| |Publication badge|

**The documentation can be found here: https://biasadjustcxx.readthedocs.io/en/latest.**

Expand Down Expand Up @@ -186,7 +186,7 @@ Notes regarding the scaling-based techniques
match the techniques described by `Teutschbein et al. (2012)`_ and `Beyer et al. (2020)`_. On the other hand the
long-term 31-day interval procedures are customized variations and prevent
disproportionately high differences in the long-term mean values at the monthly transitions.
Thats why the long-term 31-day interval variant is the preferred method and is enabled by
That's why the long-term 31-day interval variant is the preferred method and is enabled by
default for all scaling-based techniques.


Expand All @@ -204,6 +204,7 @@ the BiasAdjustCXX command-line tool.

- NetCDF-4 C++ library (`How to install NetCDF-4 C++`_)
- CMake v3.10+ (`How to install CMake`_)
- GNU Make (see https://www.gnu.org/software/make/)
- [optional] Climate Data Operators (`How to install cdo`_)

Please have a look at the following code blocks that demonstrate how to download, build and install
Expand All @@ -228,6 +229,9 @@ The tool can be uninstalled using the following command within the project direc
After the installation, the tool can be executed using the command listed below. This repository
also serves example data to test this. See the documentation for more information (https://biasadjustcxx.readthedocs.io/en/latest).

If the netcdf-cxx4 libraries cannot be found - make sure that ``ncxx4-config`` is globally executable, since this tool is used
to determine the location of these libraries.

.. code:: bash
BiasAdjustCXX \
Expand All @@ -244,7 +248,7 @@ also serves example data to test this. See the documentation for more informatio
Docker 🐳
~~~~~~~~~~~~~~~

The execution of BiasAdjustCXX is also possiblie within a Docker container.
The execution of BiasAdjustCXX is also possible within a Docker container.
This is the preferred option when the installation of `NetCDF-4 C++`_, `CMake`_ or `BiasAdjustCXX`_
on the local system is not desired. It also makes easier to access this tool since Docker
container can run on nearly every operating system.
Expand Down
14 changes: 7 additions & 7 deletions src/CMethods.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ std::vector<std::vector<float>> CMethods::get_long_term_dayofyear(std::vector<fl
*
* @param factor value to check
* @param max_factor max allowed factor (will be casted to positive value, cannot be zero)
* @return either `factor` if ths ok or `max_factor`
* @return either `factor` if it's ok or `max_factor`
*/
double CMethods::get_adjusted_scaling_factor(double factor, double max_factor) {
const double abs_max_factor = std::abs(max_factor);
Expand Down Expand Up @@ -339,7 +339,7 @@ void CMethods::Variance_Scaling(
/**
* Method to adjust 1-dimensional climate data by the delta method.
* Based on Beyer, R. and Krapp, M. and Manica, A.: An empirical evaluation of bias
* correction methods for palaeoclimate simulations (https://doi.org/10.5194/cp-16-1493-2020)
* correction methods for paleoclimate simulations (https://doi.org/10.5194/cp-16-1493-2020)
*
* NOTE: `v_reference.size()` must be equal to `v_scenario.size()`
* @param v_output 1D output vector that stores the adjusted time series
Expand Down Expand Up @@ -426,8 +426,8 @@ void CMethods::Delta_Method(

/**
* Returns the probability boundaries based on two input time series
* -> This is required to compute the bin boundaries for the Probability Density and Cumulative Distribution Funtion.
* -> Used by Quantile and Quantile Delta Mapping by invoking this funtion to get the bins based on the time
* -> This is required to compute the bin boundaries for the Probability Density and Cumulative Distribution Function.
* -> Used by Quantile and Quantile Delta Mapping by invoking this function to get the bins based on the time
* series of the control period.
*
* @param a time series
Expand Down Expand Up @@ -534,7 +534,7 @@ void CMethods::Quantile_Mapping(
MathUtils::interpolate(v_xbins, contr_cdf, (double)v_scenario[ts], false)
); // Eq. 1

// ? Invert in inversed CDF and return
// ? Invert in invers CDF and return
for (unsigned ts = 0; ts < v_scenario.size(); ts++)
v_output[ts] = (float)MathUtils::interpolate(ref_cdf, v_xbins, cdf_values[ts], false); // Eq. 1

Expand All @@ -544,7 +544,7 @@ void CMethods::Quantile_Mapping(
cdf_values.push_back((y >= 0) ? y : 0);
}

// ? Invert in inversed CDF and return
// ? Invert in invers CDF and return
for (unsigned ts = 0; ts < v_scenario.size(); ts++) {
float y = (float)MathUtils::interpolate(ref_cdf, v_xbins, cdf_values[ts], true); // Eq. 1
v_output[ts] = (y >= 0) ? y : 0;
Expand Down Expand Up @@ -621,7 +621,7 @@ void CMethods::Quantile_Delta_Mapping(
for (unsigned ts = 0; ts < v_scenario.size(); ts++)
QDM1.push_back(MathUtils::interpolate(ref_cdf, v_xbins, epsilon[ts], false)); // Eq. 1.2

// ? Invert, insert in inversed CDF and return
// ? Invert, insert in invers CDF and return
if (isAdd) {
for (unsigned ts = 0; ts < v_scenario.size(); ts++)
v_output[ts] = (float)(QDM1[ts] + v_scenario[ts] - MathUtils::interpolate(contr_cdf, v_xbins, epsilon[ts], false)); // Eq. 1.3f.
Expand Down
6 changes: 3 additions & 3 deletions src/MathUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ MathUtils::~MathUtils() {}
/**
* Returns the pointer to a function based on `name`
*
* @param name name of the desired funtion
* @param name name of the desired function
* @return point to desired funciton
*/
Func_one MathUtils::get_method_for_1_ds(std::string name) {
Expand All @@ -81,8 +81,8 @@ Func_one MathUtils::get_method_for_1_ds(std::string name) {
/**
* Returns the pointer to a function based on `name`
*
* @param name name of the desired funtion
* @return point to desired funciton
* @param name name of the desired function
* @return point to desired function
*/
Func_two MathUtils::get_method_for_2_ds(std::string name) {
if (name == "rmse")
Expand Down
2 changes: 1 addition & 1 deletion src/main.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
*/

/**
* Command-line output of the duraton between a start time
* Command-line output of the duration between a start time
*
* @param start_time start time to calculate the duration
*/
Expand Down

0 comments on commit 6490976

Please sign in to comment.