# CSX project work
## Links
[Challenge Description](https://multiform-uon.github.io/mathgeo/dundee_challenges/CSX_final.pdf)
[Evans, C.D., Peacock, M., Baird, A.J. et al. Overriding water table control on managed peatland greenhouse gas emissions. Nature 593, 548–552 (2021).](https://doi.org/10.1038/s41586-021-03523-1)
[Fereidoun's talk](https://multiform-uon.github.io/mathgeo/dundee_challenges/Fereidoun.pdf)
### Project members:
Daniel Norman, Dundee University, dznorman@dundee.ac.uk
Fereidoun Rezanezhad, University of Waterloo, frezanez@uwaterloo.ca
Nina Fischer, University of Edinburgh, n.fischer@ed.ac.uk
Mark Hopper, Climate Solutions Exchange Ltd, mark.hopper@csxcarbon.com
Lawrence Bull, University of Glasgow, lawrence.bull@glasgow.ac.uk
Liam Godwin, ERI UHI, liam.godwin@uhi.ac.uk
Garry Hayman, UK Centre for Ecology & Hydrology, garr@ceh.ac.uk
## Sensing IoT hardware
- Rasberry Pi IoT
- 1 base-station, connteted to around 10 sensors
- Water table loggers - via Chambers inverness
- Solar power and battery power for both the base-station and sensors
- Callibration in the field, automatic callibration innefective to 420 each day
- Co2 +/- ~30ppm
## Model
- Mapping from water table to Co2 flux
## Data
Three sites
### Site 1
Cheaper sensors, no correction
### Site 2
Automatic self-callibration on
- methane
- soil moisture
- infra red
- drone images
### Site 3
## Discussion
- Options to inlcude some form of windspeed/direction sensing
- Arrangement of the sensor array to measure flux over an area (differencing)
- Sensor design: option for controlled environment to measure flux with a single sensor
Parallel to satellite column measurements to derive emissions of CO2 for cities, large point sources, ....:
Jacobs et al. (2016, 2022)
https://doi.org/10.5194/acp-16-14371-2016
https://doi.org/10.5194/acp-22-9617-2022
DECC Tall Tower network to evaluate UK greenhouse gas emission inventories: https://openghg.github.io/decc_dashboard/
Review paper from 2016 on NDIR gas sensors
https://doi.org/10.1016/j.snb.2016.03.040
Principles of Eddy Correlation:
https://www.tern.org.au/news/what-is-an-eddy-covariance-flux-tower/#:~:text=Measuring%20the%20relationship%20(covariance)%20between,eddy%20covariance'%20flux%20towers%20work
Flux data
https://catalogue.ceh.ac.uk/documents/06d7c463-298c-4c7e-a4c3-55d003aa91cb
Skyline system for chamber measurements
https://www.york.ac.uk/research/themes/skyline/
### Aim
Rather than a closed/controlled environment, can diff/averaging/smoothing be used to infer flux over an area defined by the sensing array
### Sensing ideas
Rather than measure flux directly [e.g. flux tower], with an array of concentration sensors, one can utlise the advection-diffusion equation to estimate flux over a lager space.
#### Modelling
- Flux sensors work by some form of differencing
- For flux towers, the space/volume is small

- These reduce the problem to mass balancing
```mermaid
flowchart LR
A["Inflow (x,y)"] --> C["Control Volume"]
C --> B["Outflow (x,y)"]
C --> E["Vertical Flux (Fz)"]
style C fill:#f9f,stroke:#333,stroke-width:1px
style E stroke-dasharray: 5 5
```
- What if we apply the same principle to a larger area,
$$
\frac{\partial c}{\partial t} = \nabla \cdot (K \nabla c - \vec{u} \cdot c) + R
$$
$$
\frac{\partial c}{\partial t} = \nabla \cdot (\vec{u} \cdot c) + R
$$
- Back to force balancing over a larger area [**control plane in the laminar layer**],

### Optimal array?
What layout do we need to have around a ground truthing experiment such as a flux tower?
- We might need to have an array of 10+ towers around a flux tower and then record all the data with a wind sensor. Then to find the minimum number of sensors needed we can randomly knock out data from sensor pairs after the experiment and see how accuracy is affected.
- Have a wind sensor in the middle, with paired sensors around the site? Or would across travel be sufficient, i.e. measure the change in CO2 from points across a site (with weightings and wind speed and distance) to calculate change in CO2 and maybe therefore flux?
- Correcting weekly should be ok, with maybe a back calculation at the end of each week to ensure the signal decay change over the week is corrected.
### Data visualisation for Cluster 3 in 2024
#### CO2 measurements for ~ two weeks

#### CO2 measurements and temperature for ~ two weeks

#### CO2 measurements and water table for ~ two weeks

#### CO2 measurements and water table for a few months


### Carbon dioxide concentration time series graphs per sensor in Cluster 2
WTD state is from the daily WTD value, converted to a continuous value with interpolation. Increasing/Decreasing at a rate >0.05 labels the WTD state as rising/falling or otherwise Stable.
We can track the average CO2 emission during each hour of the day per sensor. For sensors 32, 34 and 39 the three states align closely on CO2 level. Sensor 37 has a common mid day peak in CO2 which is strongest in the rising state, while Sensor 40 has peaks in the stable state in the middle of the day which aren't seen in rising or falling. However we've been informed that 37 and 40 have a history of faults which may explain these results.

This table shows a trend of falling water levels annually for each sensor.
| Sensor | Falling | Rising | Stable | Total | % Falling | % Rising | % Stable |
|--------|--------|-------|--------|-------|-----------|----------|----------|
| 32 | 3415 | 1506 | 976 | 5897 | 57.9% | 25.5% | 16.6% |
| 34 | 7223 | 2765 | 1632 | 11620 | 62.1% | 23.8% | 14.0% |
| 37 | 7276 | 2791 | 1611 | 11678 | 62.3% | 23.9% | 13.8% |
| 39 | 7273 | 2787 | 1620 | 11680 | 62.3% | 23.9% | 13.9% |
| 40 | 6802 | 2716 | 1486 | 11004 | 61.8% | 24.7% | 13.5% |
After some statistical issues were pointed out, these graphs were created, showing a scatter plot of CO2 values for each hour per sensor coloured by WTD sensor with a lowes curve for each sensor type.

For completeness there is the same information without the WTD subcatogories to verify the dat

## Redemption maths
Integrate in the vertical direction
\begin{align}
\frac{1}{h} \int_0^h \left( \partial_t c + \operatorname{div}(k \nabla c) \right) \, dz
= \left( \partial_t c + \operatorname{div}(k \nabla c) \right)+\frac{1}{h} \int_0^h \left( \frac{d^2}{dz^2}(kc) \right) dz,
\end{align}
where $\operatorname{div}$ and $\nabla$ are the divergence and gradient differential operators. Thus, we are led to
\begin{align}
= \left( \partial_t c + \operatorname{div}^s(k \nabla^s c) \right)
+\frac{1}{h} \left. \frac{d}{dz}(kc) \right|_0^h,
\end{align}
where $\operatorname{div}^s$ and $\nabla^s$ are the divergence and gradient differential operators on te surface (that is, removing the normal component). The last term can be interpreted as a source term, that is,
\begin{align}
\partial_t c + \operatorname{div}(k \nabla c) + R = 0,
\end{align}
with
\begin{align}
R = \frac{1}{h} \left[ \frac{d}{dz}(kc) \right]_0^h.
\end{align}