Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Basic Validation

on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '26 3 20 * *'

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"

jobs:
build-and-test:

name: Build and Test

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Prepare environment
run: |
rustup update stable
cargo clean
- name: Build with cargo
run: |
cargo build --features "double_precision"
cargo build --features "debug"
cargo build --release
cargo clean
- name: Test with cargo
run: |
cargo test
cargo test --features "double_precision"
cargo test --features "debug"
cargo clean
19 changes: 19 additions & 0 deletions .github/workflows/clippy-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on: pull_request

name: Cargo Clippy

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"

jobs:
clippy_check:
name: Check

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Clippy
run: |
rustup component add clippy
cargo clippy -- -D warnings
45 changes: 45 additions & 0 deletions .github/workflows/doc-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Cargo Doc

on:
pull_request

jobs:
pr-comment:
name: Check Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
- name: Fetch base
run: git fetch origin ${{ github.event.pull_request.base.sha }}
- name: Checkout base
run: git checkout ${{ github.event.pull_request.base.sha }}
- name: Calculate base doc coverage
uses: bewee/rustdoc-coverage-action@v1
- name: Fetch head
run: git fetch origin ${{ github.event.pull_request.head.sha }}
- name: Checkout head
run: git checkout ${{ github.event.pull_request.head.sha }}
- name: Calculate doc coverage
id: coverage
uses: bewee/rustdoc-coverage-action@v1
- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "## Documentation Coverage:"
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## Documentation Coverage:
${{ steps.coverage.outputs.table }}
edit-mode: replace
46 changes: 0 additions & 46 deletions .github/workflows/rust.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "floccus"
version = "0.3.7"
version = "0.4.0"
authors = ["Jakub Lewandowski <scaleweather@gmail.com>"]
edition = "2021"
description = "Formulae for air thermodynamic calculations"
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![License](https://img.shields.io/github/license/ScaleWeather/floccus)](https://choosealicense.com/licenses/apache-2.0/)
[![Crates.io](https://img.shields.io/crates/v/floccus)](https://crates.io/crates/floccus)
[![dependency status](https://deps.rs/repo/github/ScaleWeather/floccus/status.svg)](https://deps.rs/repo/github/ScaleWeather/floccus)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ScaleWeather/floccus/rust.yml?branch=main&label=cargo%20build)](https://github.com/ScaleWeather/floccus/actions)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ScaleWeather/floccus/basic.yml?branch=main&label=cargo%20build)](https://github.com/ScaleWeather/floccus/actions)

Rust crate providing formulae for air thermodynamic calculations.

Expand Down Expand Up @@ -58,6 +58,9 @@ To prevent any unexpected behavior, all functions check whether provided inputs
Exact limits are specified in the documentation of each function.
If the input is out of range the function will return an `InputError::OutOfRange` with erroneous input specified.

Each function also has `_unchecked` and `_validate` versions. The `_validate` version only checks the inputs with bounds defined for its "parent" function.
The `_unchecked` version performs only the calculation without any input checking. All "parent" functions simply call `_validate` and then `_unchecked`.

## Debugging

If additional information is needed about which function returns the error and why, `debug` feature can be enabled.
Expand All @@ -66,6 +69,4 @@ information about the error. This feature potentially is not zero-cost so it is

## Benchmarks

Functions provided in this crate are intended for use in, i. a., numerical models. To provide the user information about performance overhead of each function all functions are benchmarked using [criterion.rs](https://bheisler.github.io/criterion.rs/book/index.html). Github Actions automatically runs all benchmarks.

To check the latest benchmark results the newest workflow on [Github Actions page of floccus](https://github.com/ScaleWeather/floccus/actions).
Functions provided in this crate are intended for use in, i. a., numerical models. To provide the user information about performance overhead of each function all functions are can be benchmarked using [criterion.rs](https://bheisler.github.io/criterion.rs/book/index.html).
92 changes: 92 additions & 0 deletions benches/results/0_3_7.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
equivalent_potential_temperature::bryan1
time: [37.789 ns 37.794 ns 37.799 ns]

mixing_ratio::general1
time: [2.2452 ns 2.2497 ns 2.2572 ns]

mixing_ratio::performance1
time: [6.9944 ns 6.9992 ns 7.0044 ns]

mixing_ratio::accuracy1
time: [10.147 ns 10.163 ns 10.178 ns]

potential_temperature::davies_jones1
time: [11.339 ns 11.340 ns 11.341 ns]

relative_humidity::general1
time: [1.3266 ns 1.3268 ns 1.3273 ns]

relative_humidity::general2
time: [1.3271 ns 1.3276 ns 1.3281 ns]

relative_humidity::general3
time: [8.7762 ns 8.7767 ns 8.7772 ns]

relative_humidity::general4
time: [10.631 ns 10.640 ns 10.649 ns]

relative_humidity::general5
time: [22.791 ns 22.795 ns 22.800 ns]

specific_humidity::general1
time: [1.4529 ns 1.4541 ns 1.4554 ns]

vapour_pressure::general1
time: [1.3643 ns 1.3831 ns 1.4079 ns]

vapour_pressure::tetens1
time: [4.0723 ns 4.0742 ns 4.0760 ns]

vapour_pressure::buck1
time: [5.8277 ns 5.8288 ns 5.8304 ns]

vapour_pressure::buck2
time: [5.8274 ns 5.8276 ns 5.8279 ns]

vapour_pressure::buck3
time: [4.7666 ns 4.7670 ns 4.7673 ns]

vapour_pressure::buck4
time: [4.7652 ns 4.7657 ns 4.7661 ns]

vapour_pressure::buck3_simplified
time: [4.0155 ns 4.0195 ns 4.0232 ns]

vapour_pressure::buck4_simplified
time: [4.0485 ns 4.0518 ns 4.0553 ns]

vapour_pressure::saturation_specific1
time: [1.3148 ns 1.3183 ns 1.3218 ns]

vapour_pressure::saturation_specific2
time: [1.3265 ns 1.3265 ns 1.3266 ns]

vapour_pressure::wexler1
time: [8.5303 ns 8.5305 ns 8.5308 ns]

vapour_pressure::wexler2
time: [7.8834 ns 7.8839 ns 7.8846 ns]

vapour_pressure_deficit::general1
time: [1.2693 ns 1.2754 ns 1.2816 ns]

vapour_pressure_deficit::general2
time: [9.3893 ns 9.3896 ns 9.3900 ns]

vapour_pressure_deficit::general3
time: [6.4139 ns 6.4157 ns 6.4180 ns]

virtual_temperature::general1
time: [1.6099 ns 1.6103 ns 1.6109 ns]

virtual_temperature::general2
time: [1.8563 ns 1.8564 ns 1.8564 ns]

virtual_temperature::general3
time: [1.2598 ns 1.2603 ns 1.2608 ns]

wet_bulb_potential_temperature::davies_jones1
time: [10.616 ns 10.616 ns 10.617 ns]

wet_bulb_temperature::stull1
time: [27.765 ns 27.767 ns 27.770 ns]
Loading