fleshed out the README a bit more.
This commit is contained in:
parent
507a365682
commit
115e3d65b5
2 changed files with 60 additions and 12 deletions
71
README.md
71
README.md
|
|
@ -4,6 +4,21 @@ Functions to compute relative humidity, absolute humidity, wet bulb
|
||||||
temperature, and other values related to humidity of air, given
|
temperature, and other values related to humidity of air, given
|
||||||
partial data.
|
partial data.
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
I'm using this code to explore human survivability given global warming. The following essays of mine are relevant:
|
||||||
|
|
||||||
|
1. [The Everyone Dies Event Class](https://www.journeyman.cc/blog/posts-output/2021-11-15-the-everyone-dies-event-class/)
|
||||||
|
2. [The 'everyone dies' event comes home](https://www.journeyman.cc/blog/posts-output/2026-07-15-Everyone-dies-UK/)
|
||||||
|
3. [Extreme Heat](https://www.journeyman.cc/blog/posts-output/2026-07-31-Extreme-Heat/)
|
||||||
|
4. [Analysis of 2026 heatwaves UK](https://www.journeyman.cc/blog/posts-output/2026-08-04-Analysis-of-2026-heatwaves-UK/)
|
||||||
|
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
|
||||||
|
Alpha-quality code. It more or less works but it isn't at all polished.
|
||||||
|
|
||||||
## General architecture
|
## General architecture
|
||||||
|
|
||||||
### The packet
|
### The packet
|
||||||
|
|
@ -13,12 +28,12 @@ for some of the following keywords:
|
||||||
|
|
||||||
1. `:absolute-humidity`
|
1. `:absolute-humidity`
|
||||||
2. `:actual-vapour-pressure` *not yet implemented*
|
2. `:actual-vapour-pressure` *not yet implemented*
|
||||||
1. `:dew-point`
|
1. `:dew-point` *not yet implemented*
|
||||||
2. `:pressure-pascals`
|
2. `:pressure-pascals`
|
||||||
3. `:pressure-millibars`
|
3. `:pressure-millibars`
|
||||||
4. `:saturation--vapour-pressure`
|
4. `:saturation-vapour-pressure`
|
||||||
5. `:relative-humidity`
|
5. `:relative-humidity`
|
||||||
6. `:temperature`
|
6. `:temperature` *assumed to be celsius*
|
||||||
7. `:temperature-celsius`
|
7. `:temperature-celsius`
|
||||||
8. `:temperature-kelvin`
|
8. `:temperature-kelvin`
|
||||||
|
|
||||||
|
|
@ -26,14 +41,48 @@ These keywords represent variables in the pressure equations, and they are all
|
||||||
to a degree inter-related; so if you have (or can assume) some of them, you can
|
to a degree inter-related; so if you have (or can assume) some of them, you can
|
||||||
compute others.
|
compute others.
|
||||||
|
|
||||||
Rather than having a mess of functions all of which call one another, which
|
Rather than having a tangle of functions all of which call one another, which seemed likely to result in horrible messes and potential infinite recursion, there is one central function, `humidity.core/resolution`, which takes a partial packet and repeatedly tries to compute the values for more variables until it can compute no more, and then returns the enhanced packet.
|
||||||
seemed likely to result in horrible messes and potential infinite recursion,
|
|
||||||
there is one central function, `humidity.core/resolution`, which takes a
|
Thus:
|
||||||
partial package and repeatedly tries to compute the values for more variables
|
|
||||||
until it can compute no more, and then returns the enhanced packet.
|
```clojure
|
||||||
|
humidity.core=> (use 'humidity.core :reload)
|
||||||
|
nil
|
||||||
|
humidity.core=> (resolution :relative-humidity 100 :temperature-celsius 35)
|
||||||
|
{: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}
|
||||||
|
```
|
||||||
|
|
||||||
At present there are no checks to ensure that the packet makes sense.
|
At present there are no checks to ensure that the packet makes sense.
|
||||||
|
|
||||||
Associated with each variable there is a namespace which takes a packet, and,
|
Associated with each variable there is a namespace which contains a function that takes a packet, and, provided that packet contains enough information to compute that variable, returns a numeric value, else `nil`.
|
||||||
if that packet contains enough information to compute that variable, returns
|
|
||||||
a numeric value, else `nil`.
|
## Developing
|
||||||
|
|
||||||
|
This is a fairly standard [leiningen](https://leiningen.org/) project. I anticipate that most Clojure developers will have leininen installed, even if they no longer use it much. Start a repl with
|
||||||
|
|
||||||
|
```
|
||||||
|
lein repl
|
||||||
|
```
|
||||||
|
|
||||||
|
and hook in your preferred editor as appropriate for that editor.
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
Tests are reasonably complets but all could do with more examples, especially around the crucial 35° C wet bulb area and towards the extremities of normal weather range. If you are contributing additional code, I would appreciate it being accompanied by tests.
|
||||||
|
|
||||||
|
I suggest running tests using
|
||||||
|
|
||||||
|
```
|
||||||
|
lein cloverage
|
||||||
|
```
|
||||||
|
|
||||||
|
As this gives not only pass/fail output, but also test coverage output.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Pull requests are welcomed, provided they do not contain AI generated code. I'm not going to waste time debugging Claude's mess, my own is bad enough.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Copyright © 2026 Simon Brooke. Licensed under the GNU General Public License,
|
||||||
|
version 2.0 or (at your option) any later version.
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,6 @@
|
||||||
(println (format "Expected: %s...%s; actual: %s" min-expected max-expected actual))
|
(println (format "Expected: %s...%s; actual: %s" min-expected max-expected actual))
|
||||||
(is (< min-expected actual max-expected)))
|
(is (< min-expected actual max-expected)))
|
||||||
|
|
||||||
|
|
||||||
(let [min-expected 31
|
(let [min-expected 31
|
||||||
max-expected 34
|
max-expected 34
|
||||||
temperature 40
|
temperature 40
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue