Tidied up documentation. This is more or less ready for others to play with.
This commit is contained in:
parent
91343b9c10
commit
507a365682
15 changed files with 337 additions and 40 deletions
|
|
@ -2,6 +2,26 @@
|
|||
(:require [clojure.test :refer [deftest is testing]]
|
||||
[humidity.constants :refer [celsius-offset]]
|
||||
[humidity.absolute :refer [abs-humidity]]))
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;
|
||||
;;; 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 absolute-humidity-test
|
||||
(testing "definitional"
|
||||
|
|
|
|||
38
test/humidity/core_test.clj
Normal file
38
test/humidity/core_test.clj
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
(ns humidity.core-test
|
||||
(:require
|
||||
[clojure.test :refer [deftest is testing]]
|
||||
[humidity.core :refer [resolution]]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;
|
||||
;;; 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 resolution-test
|
||||
(testing "resolution")
|
||||
(let [expected {:relative-humidity 100,
|
||||
:temperature-celsius 35,
|
||||
:pressure-pascals 101325,
|
||||
:pressure-millibars 4053/4,
|
||||
:saturation-vapour-pressure 5622.488734516426,
|
||||
:temperature-kelvin 308.15,
|
||||
:absolute-humidity 3953.618101887827}
|
||||
packet {:relative-humidity 100 :temperature-celsius 35}
|
||||
actual (resolution packet)]
|
||||
(is (= actual expected))))
|
||||
|
|
@ -3,6 +3,27 @@
|
|||
[humidity.constants :refer [celsius-offset]]
|
||||
[humidity.relative :refer [rel-humidity rel-humidity]]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;
|
||||
;;; 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 relative-humidity-test
|
||||
(testing "definitional"
|
||||
(let [min-expected 99
|
||||
|
|
|
|||
|
|
@ -1,10 +1,31 @@
|
|||
(ns humidity.saturation-vp-test(:require [clojure.test :refer [deftest is testing]]
|
||||
[humidity.constants :refer [celsius-offset]]
|
||||
[humidity.saturation-vp :refer [saturation-vp saturation-vp-tetens]]))
|
||||
(ns humidity.saturation-vp-test
|
||||
(:require [clojure.test :refer [deftest is testing]]
|
||||
[humidity.saturation-vp :refer [saturation-vp]]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;
|
||||
;;; 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 saturation-vp-test
|
||||
(testing "from online sources"
|
||||
(let [min-expected 5622
|
||||
max-expected 5629
|
||||
actual (saturation-vp {:temperature-celsius 35})]
|
||||
(is (< min-expected actual max-expected)))))
|
||||
max-expected 5629
|
||||
actual (saturation-vp {:temperature-celsius 35})]
|
||||
(is (< min-expected actual max-expected)))))
|
||||
|
|
|
|||
|
|
@ -2,6 +2,26 @@
|
|||
(:require [clojure.test :refer [deftest is testing]]
|
||||
[humidity.wet-bulb :refer [wet-bulb-temperature]]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;
|
||||
;;; 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 wet-bulb-test
|
||||
(testing "Example from paper"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue