Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal carbon pool model #134

Merged
merged 51 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
53b361d
Added skelton SoilCarbon class
jacobcook1995 Dec 13, 2022
893c098
Add basic pools init
jacobcook1995 Dec 13, 2022
3ae2dba
Created draft function for pool update function
jacobcook1995 Dec 13, 2022
363d0f3
Started to flesh out mineral_association function
jacobcook1995 Dec 13, 2022
fbd56a5
Wrote function for soil moisture scalar
jacobcook1995 Dec 14, 2022
02333af
Wrote function for soil temperature scalar
jacobcook1995 Dec 14, 2022
df6aab4
Added unit annotations
jacobcook1995 Dec 14, 2022
86e1929
Defined a time step for the function update
jacobcook1995 Dec 14, 2022
1a82ba1
Added error handling for bad soil carbon pool initialisation
jacobcook1995 Dec 15, 2022
ae2efd7
Merge branch 'develop' into feature/dummy_carbon
jacobcook1995 Dec 15, 2022
6cc5f3c
Added tests for scalar calculating functions
jacobcook1995 Dec 15, 2022
07b94fd
Added test for mineral association function
jacobcook1995 Dec 15, 2022
713f0af
Added test for update pools function
jacobcook1995 Dec 15, 2022
088e735
Changed qa python version to see if that fixes the 'Expected — Waitin…
jacobcook1995 Dec 15, 2022
3e0625a
Moved plant and soil module folders into new models folder
jacobcook1995 Dec 16, 2022
32fdf62
Updated test paths to match new models/soil/ directory structure
jacobcook1995 Dec 16, 2022
e0c1a2c
Switch to using np.exp and np.pi
jacobcook1995 Dec 16, 2022
7fcbbc1
Converted comments to docstrings
jacobcook1995 Dec 16, 2022
a1a0f57
Switched to returning single flux
jacobcook1995 Dec 16, 2022
5704337
Improved naming of scalar generating functions
jacobcook1995 Dec 16, 2022
9907355
Switched to using float for pool update time step
jacobcook1995 Dec 16, 2022
c2ec463
Started using np.allclose
jacobcook1995 Jan 3, 2023
ceedb05
Removed repeated dictionary accesses for temperature scalar
jacobcook1995 Jan 3, 2023
988b325
Switched to using np.any
jacobcook1995 Jan 3, 2023
ae8af43
Switched to defining attributes as docstrings rather than init docstring
jacobcook1995 Jan 9, 2023
bf18cc4
Added multiple tests for soil moisture and temp scalars
jacobcook1995 Jan 16, 2023
b0c048b
Made smaller functions for mineral association calculations
jacobcook1995 Jan 17, 2023
0cbd846
Nested binding affinity calculation
jacobcook1995 Jan 17, 2023
a8df83e
Added test for Langmuir binding coef function
jacobcook1995 Jan 17, 2023
a049f08
Added test function for Max soprtion capacity
jacobcook1995 Jan 17, 2023
820745b
Added test for equilibrium maom function
jacobcook1995 Jan 17, 2023
f84159c
Improved unit test for mineral association
jacobcook1995 Jan 17, 2023
d9e2a17
Paramaterised update_pools test
jacobcook1995 Jan 18, 2023
6b0621a
Adjusted api tree to reflect new models dir structure
jacobcook1995 Jan 18, 2023
f8bc6b0
Added details of units
jacobcook1995 Jan 18, 2023
a103e88
Added sanity checks for obviously bad but hard to spot input
jacobcook1995 Jan 18, 2023
01fdd56
Fixed minor issue with using any rather than np.any
jacobcook1995 Jan 18, 2023
9cf48f2
Switched to new api docs structure
jacobcook1995 Jan 18, 2023
e934c0a
Merge branch 'develop' into feature/dummy_carbon
jacobcook1995 Jan 24, 2023
21d5e0d
Caught pinned python version I previously missed
jacobcook1995 Jan 24, 2023
a848ff0
Merging changes from develop in and updating docs index to match new …
jacobcook1995 Jan 30, 2023
5026a22
Improved docstring style for soil.carbon module
jacobcook1995 Feb 2, 2023
1e1b759
Removed deprecated log_and_raise function from the soil.carbon module
jacobcook1995 Feb 2, 2023
4a82512
Removed unnecessary mocking from test_calculate_equilibrium_maom
jacobcook1995 Feb 2, 2023
040a1f7
Removed unneeded mocking from test_mineral_association
jacobcook1995 Feb 2, 2023
056dbdd
Removed unnecessary mocking from test_update_pools
jacobcook1995 Feb 3, 2023
7009b60
Merged in changes from develop
jacobcook1995 Feb 3, 2023
8d985d2
Fixed various problems with the docs
jacobcook1995 Feb 3, 2023
8c4d2d8
Converted dictonaries of fitting parameters to dataclasses
jacobcook1995 Feb 3, 2023
27f7498
Merge branch 'develop' into feature/dummy_carbon
jacobcook1995 Feb 3, 2023
4867277
Moved data classes to seperate constants.py script
jacobcook1995 Feb 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/source/api/soil.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ kernelspec:

# API reference for `soil` modules

This page contains the detailed documentation of the functions and classes in the
`virtual_rainforest.soil` modules.
The {mod}`~virtual_rainforest.models.soil` module is one of the component models of the
Virtual Rainforest. It is comprised of a number of submodules.

## The {mod}`~virtual_rainforest.soil.model` module
Each of the soil sub-modules has its own API reference page:

```{eval-rst}
.. automodule:: virtual_rainforest.soil.model
:autosummary:
:members:
```
* The {mod}`~virtual_rainforest.models.soil.model` submodule instantiates the SoilModel
class which consolidates the functionality of the soil module into a single class,
which the high level functions of the Virtual Rainforest can then make use of.
* The {mod}`~virtual_rainforest.models.soil.carbon` provides a model for the soil carbon
cycle.
23 changes: 23 additions & 0 deletions docs/source/api/soil/carbon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
jupytext:
cell_metadata_filter: -all
formats: md:myst
main_language: python
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.13.8
kernelspec:
display_name: vr_python3
language: python
name: vr_python3
---

# API documentation for the {mod}`~virtual_rainforest.soil.carbon` module

```{eval-rst}
.. automodule:: virtual_rainforest.models.soil.carbon
:autosummary:
:members:
```
23 changes: 23 additions & 0 deletions docs/source/api/soil/model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
jupytext:
cell_metadata_filter: -all
formats: md:myst
main_language: python
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.13.8
kernelspec:
display_name: vr_python3
language: python
name: vr_python3
---

# API documentation for the {mod}`~virtual_rainforest.soil.model` module

```{eval-rst}
.. automodule:: virtual_rainforest.models.soil.model
:autosummary:
:members:
```
6 changes: 4 additions & 2 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ team.
File readers <api/core/readers.md>
Core axes <api/core/axes.md>
Base Model <api/core/model.md>
Soil Model <api/soil.md>

Soil Overview <api/soil.md>
Soil Model <api/soil/model.md>
Soil Carbon <api/soil/carbon.md>
```

```{eval-rst}
Expand All @@ -110,6 +111,7 @@ team.
Docstring Style <development/documentation/docstring_style.md>
API Generation <development/documentation/api_generation.md>
Core Design <development/design/core.md>
Adding New Models <development/defining_new_models.md>
```

```{eval-rst}
Expand Down
65 changes: 22 additions & 43 deletions docs/source/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -183,47 +183,26 @@ @article{Metcalfe2015
}

@article{cheng_wei_2021,
author = {Cheng, Wei and
Dan, Li and
Deng, Xiangzheng and
Feng, Jinming and
Wang, Yongli and
Peng, Jing and
Tian, Jing and
Qi, Wei and
Liu, Zhu and
Zheng, Xinqi and
Zhou, Demin and
Jiang, Sijian and
Zhao, Haipeng and
Wang, Xiaoyu},
title = {{Global monthly distributions of atmospheric CO2
concentrations under the historical and future
scenarios}},
month = jun,
year = 2021,
note = {{The data records include 1 file Network Common
Data Form (NetCDF) format for CO2 distributions in
historical period named
CO2\_1deg\_month\_1850-2013.nc, and 8 files NetCDF
format with the naming convention
CO2\_SSP{XYY}\_2015\_2150.nc, where X and YY are the
shared socioeconomic pathway and radiative forcing
level at 2100, respectively, for CO2 distributions
in the future scenarios. Each NetCDF file includes
3 dimensions: time (month of the year expressed as
days since the first day of 1850, n = 1968 and
1632 for the historical and the future,
respectively); latitude (Degrees North of the
equator [cell centres], n = 180); longitude
(Degrees East of the Prime Meridian [cell
centres], n = 360). Each NetCDF file contains a
monthly variable representing mole fraction of
carbon dioxide in air (variable name: value in the
historical file and CO2 in the future scenario
files) with the unit ppm and the 1º × 1º
resolution.}},
publisher = {Zenodo},
doi = {10.5281/zenodo.5021361},
url = {https://doi.org/10.5281/zenodo.5021361}
author = {Cheng, Wei and
Dan, Li and
Deng, Xiangzheng and
Feng, Jinming and
Wang, Yongli and
Peng, Jing and
Tian, Jing and
Qi, Wei and
Liu, Zhu and
Zheng, Xinqi and
Zhou, Demin and
Jiang, Sijian and
Zhao, Haipeng and
Wang, Xiaoyu},
title = {{Global monthly distributions of atmospheric CO2
concentrations under the historical and future
scenarios [Data set]}},
journal = {Zenodo},
month = jun,
year = 2021,
doi = {10.5281/zenodo.5021361},
url = {https://doi.org/10.5281/zenodo.5021361}
}
2 changes: 1 addition & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
select_models,
vr_run,
)
from virtual_rainforest.soil.model import SoilModel
from virtual_rainforest.models.soil.model import SoilModel

from .conftest import log_check

Expand Down
2 changes: 1 addition & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from numpy import datetime64, timedelta64

from virtual_rainforest.core.model import BaseModel, InitialisationError
from virtual_rainforest.soil.model import SoilModel
from virtual_rainforest.models.soil.model import SoilModel

from .conftest import log_check

Expand Down
Loading