Tweaking of README, intro, and tests.
This commit is contained in:
parent
a377b3a845
commit
7bc8a845ab
5 changed files with 227 additions and 27 deletions
66
README.md
66
README.md
|
|
@ -12,10 +12,11 @@ I'm using this code to explore human survivability given global warming. The fol
|
|||
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/)
|
||||
5. [Exploration of what happened on 26th June this year](https://www.journeyman.cc/blog/posts-output/2026-08-13-Exploration-of-what-happened-on-26th-June-this-year/)
|
||||
|
||||
## Status
|
||||
## Disclaimer
|
||||
|
||||
Alpha-quality code. It more or less works but it isn't at all polished.
|
||||
This library is supplied in the hope that it may be useful, but results computed with it should not be taken as authoritative but should be checked against other sources. I do not have enough expertise to guarantee its results are correct.
|
||||
|
||||
## General architecture
|
||||
|
||||
|
|
@ -29,13 +30,13 @@ for some of the following keywords:
|
|||
1. `:dew-point-celsius`
|
||||
2. `:pressure-pascals`
|
||||
3. `:pressure-millibars`
|
||||
4. `:saturation-vapour-pressure` *Pascals*
|
||||
5. `:relative-humidity` *percentage, 0...100.*
|
||||
4. `:relative-humidity` *percentage, 0...100.*
|
||||
5. `:saturation-vapour-pressure` *Pascals*
|
||||
6. `:temperature` *assumed to be ° Celsius*
|
||||
7. `:temperature-celsius`
|
||||
8. `:temperature-kelvin`
|
||||
9. `:volume` *in metres<sup>3</sup>, relative to 1 at standard temperature and pressure.*
|
||||
10. `:wet-bulb-temperature` *in ° Celsius.*
|
||||
10. `:wet-bulb-temperature-celsius` *in ° Celsius.*
|
||||
|
||||
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
|
||||
|
|
@ -52,9 +53,58 @@ 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.
|
||||
### Naming
|
||||
|
||||
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`.
|
||||
Associated with each variable there is a namespace of the same name which contains a function, whose name is the name of the variable with `-fn` appended, that takes a packet, and, provided that packet contains enough information to compute that variable, returns a numeric value, else `nil`.
|
||||
|
||||
### Validation
|
||||
|
||||
A packet may be validated by calling the function `validate`. This recalculates all values in the packet, and, by default, tolerates discrepancies of up to 1%. This tolerance can be varied by binding the dynamic variable `*validation-limit*`. Validation merely checks that the values within the packet are consistent with one another, and does not properly account for pressure, so will not be valid at altitude.
|
||||
|
||||
```clojure
|
||||
humidity.core=> (validate {:absolute-humidity 3953.618101887827,
|
||||
#_=> :actual-vapour-pressure 4765.10094206357,
|
||||
#_=> :dew-point-celsius 35.00000000000001,
|
||||
#_=> :pressure-millibars 1013.25,
|
||||
#_=> :pressure-pascals 101325,
|
||||
#_=> :relative-humidity 100,
|
||||
#_=> :saturation-vapour-pressure 5622.488734516426,
|
||||
#_=> :temperature-celsius 35,
|
||||
#_=> :temperature-kelvin 308.15,
|
||||
#_=> :volume 1.1281347245103424,
|
||||
#_=> :wet-bulb-temperature-celsius 35.11625928298915}
|
||||
#_=> )
|
||||
true
|
||||
|
||||
humidity.core=> (validate {:absolute-humidity 3953.618101887827,
|
||||
#_=> :actual-vapour-pressure 4765.10094206357,
|
||||
#_=> :dew-point-celsius 35.00000000000001,
|
||||
#_=> :pressure-millibars 1013.25,
|
||||
#_=> :pressure-pascals 101325,
|
||||
#_=> :relative-humidity 95, ;; <-- intentionally wrong
|
||||
#_=> :saturation-vapour-pressure 5622.488734516426,
|
||||
#_=> :temperature-celsius 35,
|
||||
#_=> :temperature-kelvin 308.15,
|
||||
#_=> :volume 1.1281347245103424,
|
||||
#_=> :wet-bulb-temperature-celsius 35.11625928298915}
|
||||
#_=> )
|
||||
ERROR: key: :dew-point-celsius; a: 35.00000000000001; b 34.07737599732603; errror: 2.857142925262451%.
|
||||
false
|
||||
|
||||
humidity.core=> (binding [*validation-limit* 5]
|
||||
#_=> (validate {:absolute-humidity 3953.618101887827,
|
||||
#_=> :actual-vapour-pressure 4765.10094206357,
|
||||
#_=> :dew-point-celsius 35.00000000000001,
|
||||
#_=> :pressure-millibars 1013.25,
|
||||
#_=> :pressure-pascals 101325,
|
||||
#_=> :relative-humidity 95, ;; <-- intentionally wrong
|
||||
#_=> :saturation-vapour-pressure 5622.488734516426,
|
||||
#_=> :temperature-celsius 35,
|
||||
#_=> :temperature-kelvin 308.15,
|
||||
#_=> :volume 1.1281347245103424,
|
||||
#_=> :wet-bulb-temperature-celsius 35.11625928298915}))
|
||||
true
|
||||
```
|
||||
|
||||
## Developing
|
||||
|
||||
|
|
@ -66,6 +116,8 @@ lein repl
|
|||
|
||||
and hook in your preferred editor as appropriate for that editor.
|
||||
|
||||
Full documentation is available [here](https://www.journeyman.cc/humidity).
|
||||
|
||||
## 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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue