# humidity Functions to compute relative humidity, absolute humidity, wet bulb temperature, and other values related to humidity of air, given 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 ### The packet The 'packet', in the terminology of this library, is a map which has bindings for some of the following keywords: 1. `:absolute-humidity` 2. `:actual-vapour-pressure` *not yet implemented* 1. `:dew-point` *not yet implemented* 2. `:pressure-pascals` 3. `:pressure-millibars` 4. `:saturation-vapour-pressure` 5. `:relative-humidity` 6. `:temperature` *assumed to be celsius* 7. `:temperature-celsius` 8. `:temperature-kelvin` 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 compute others. 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. Thus: ```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. 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`. ## 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.