Added dew point; implemented actual vapour pressure, but don't have test data.
This commit is contained in:
parent
ce32cd285e
commit
970a320a84
8 changed files with 118 additions and 16 deletions
|
|
@ -26,14 +26,16 @@
|
|||
|
||||
(deftest resolution-test
|
||||
(testing "resolution")
|
||||
(let [expected {:relative-humidity 100,
|
||||
:temperature-celsius 35,
|
||||
(let [expected {:absolute-humidity 3953.618101887827,
|
||||
:pressure-pascals 101325,
|
||||
:temperature-celsius 35,
|
||||
:dew-point-celsius 35.00000000000001,
|
||||
:pressure-millibars 1013.25,
|
||||
:saturation-vapour-pressure 5622.488734516426,
|
||||
:volume 1.1281347245103424,
|
||||
:temperature-kelvin 308.15,
|
||||
:absolute-humidity 3953.618101887827,
|
||||
:volume 1.1281347245103424}
|
||||
:relative-humidity 100,
|
||||
:saturation-vapour-pressure 5622.488734516426,
|
||||
:actual-vapour-pressure 4765.10094206357}
|
||||
packet {:relative-humidity 100 :temperature-celsius 35}
|
||||
actual (resolution packet)]
|
||||
(is (= actual expected))))
|
||||
|
|
|
|||
|
|
@ -1 +1,36 @@
|
|||
(ns humidity.dew-point-test)
|
||||
(ns humidity.dew-point-test
|
||||
(:require [clojure.test :refer [deftest is testing]]
|
||||
[humidity.constants :refer [celsius-offset]]
|
||||
[humidity.dew-point :refer [dew-point-celsius-fn]]))
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;
|
||||
;;; Copyright (C) 2026 Simon Brooke
|
||||
;;;
|
||||
;;; This program is free software; you can redistribute it and/or
|
||||
;;; modify it under the terms of the GNU General Public License
|
||||
;;; as published by the Free Software Foundation; either version 2
|
||||
;;; of the License, or (at your option) any later version.
|
||||
;;;
|
||||
;;; This program is distributed in the hope that it will be useful,
|
||||
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;;; GNU General Public License for more details.
|
||||
;;;
|
||||
;;; You should have received a copy of the GNU General Public License
|
||||
;;; along with this program; if not, write to the Free Software
|
||||
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
;;; USA.
|
||||
;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(deftest dew-point-test
|
||||
(testing "definitional"
|
||||
(let [min-expected 34.9
|
||||
max-expected 35.1
|
||||
actual (dew-point-celsius-fn :relative-humidity 100
|
||||
:temperature-celsius 35)]
|
||||
(is (< min-expected actual max-expected))))
|
||||
(testing "missing data"
|
||||
(let [expected nil
|
||||
actual (dew-point-celsius-fn :relative-humidity 100)]
|
||||
(is (= expected actual)))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue