Skip to content

Commit

Permalink
Major catchup (#142)
Browse files Browse the repository at this point in the history
* Data, studies, code tweaks for 2021-2022
* Add misc calculation files
* Fix bad USA longitudes
* Fix a LOT of duplicated studies
* Update srdb_check.R, README.md, and check-srdb.yaml
  • Loading branch information
bpbond authored Oct 13, 2024
1 parent 35a61e1 commit 6223733
Show file tree
Hide file tree
Showing 32 changed files with 1,548 additions and 15,588 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check-srdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-pandoc@v2
- name: Install any needed packages
run: |
install.packages(c("ncdf4"))
Expand Down
Binary file modified R/growth_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 36 additions & 6 deletions R/srdb_check.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Run checks on SRDB data for consistency, columns types, out of bounds, etc.
# BBL 2019-09-17
# Checks SRDB data for consistency, columns types, out of bounds, etc.,
# BBL 2019-09-17; updated 2024-09-27

if(basename(getwd()) != "srdb") stop("Working directory must be srdb/")

# Helper functions ---------------------------------------------------------

contiguous <- function(x) all(diff(x) == 1)

check_numeric <- function(d, dname = deparse(substitute(d))) {
message("Checking ", dname, " is numeric")
if(!is.numeric(d)) {
Expand Down Expand Up @@ -85,6 +88,16 @@ stop("Study_number values in srdb-data not found in srdb_studies: ",
paste(unique(srdb$Study_number[!present]), collapse = ", "))
}

# Every study number should be contiguous in the data file
contig_problem <- FALSE
for(st in unique(srdb$Study_number)) {
x <- which(srdb$Study_number == st)
if(!contiguous(x)) {
message("\tStudy ", st, " is not contiguous")
contig_problem <- TRUE
}
}
if(contig_problem) stop("Non-contiguous study numbers are probably duplicates")

# srdb-info.txt ---------------------------------------------------------

Expand Down Expand Up @@ -120,12 +133,29 @@ with(srdb, {
check_bounds(YearsOfData, c(1, 99))
check_bounds(Latitude, c(-90, 90))
check_bounds(Longitude, c(-180, 180))
check_bounds(Elevation, c(0, 7999))

# Special check for U.S. studies with mis-entered longitude
bad_USA <- srdb$Country == "USA" & srdb$Longitude > 0 & srdb$Region != "Guam"
bad_USA[is.na(bad_USA)] <- FALSE
if(any(bad_USA)) {
stop("'USA' entries with positive longitude: ",
paste(which(bad_USA), collapse = " "))
}

check_bounds(Elevation, c(-10, 7999))

# Manipulation is a mess, unfortunately
controls <- srdb$Manipulation %in% c("Control", "CK", "CT")
if(any(controls)) {
stop("'Control' or 'CK' or 'CT' entries in Manipulation; should be 'None': ",
paste(which(controls), collapse = " "))
}

check_bounds(Age_ecosystem, c(0, 999))
check_bounds(Age_disturbance, c(0, 999))
check_labels(Ecosystem_state, c("Managed", "Unmanaged", "Natural", ""))

# Ecosystem_type is really varied, unfortunately
# Ecosystem_type is also varied
unmanaged_ag <- srdb$Ecosystem_type == "Agriculture" & srdb$Ecosystem_state != "Managed"
if(any(unmanaged_ag)) {
stop("Non-managed agriculture in rows: ", paste(which(unmanaged_ag), collapse = " "))
Expand Down Expand Up @@ -153,10 +183,10 @@ with(srdb, {
check_bounds(Soil_sand, c(0.0, 999.9))
check_bounds(Soil_silt, c(0.0, 999.9))
check_bounds(Soil_clay, c(0.0, 999.9))
check_bounds(MAT, c(-30, 40))
check_bounds(MAT, c(-30, 55))
check_bounds(MAP, c(0, 9999))
check_bounds(PET, c(0, 9999))
check_bounds(Study_temp, c(-30, 40))
check_bounds(Study_temp, c(-30, 46))
check_bounds(Study_precip, c(0, 9999))
# TODO: meas_method one of a few values
check_bounds(Meas_interval, c(0.01, 365))
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,39 @@
# srdb

Global soil respiration database
Last data update: 09 October 2022
Last data update: 12 October 2024

## About

The global soil respiration database (SRDB) is a database of published
studies about the flux of CO2 from the soil surface to the atmosphere ("soil
respiration"") in the field. It's intended to serve as a resource for
respiration") in the field. It's intended to serve as a resource for
scientific analysis.

## Files in this repository

File | Description
----------------------------|------------------------------------------------
calculations | Directory of spreadsheets (generally data estimated from figures)
corrections-additions.xls | Excel workbook for corrections/additions
expanded_field_notes.txt | More info on some fields and their uses
LICENSE | The SRDB uses the MIT license, which is short, simple, and permissive
LICENSE | The MIT license: short, simple, and permissive
R | R check script directory
README.md | Generates this README
srdb-data_fields.txt | Metadata for the srdb-data file
srdb-data.csv | Main database
srdb-equations_fields.csv | Metadata for the srdb-equations file_
srdb-equations_fields.csv | Metadata for the srdb-equations file
srdb-equations.csv | Temperature and moisture sensitivity equations
srdb-studies_fields.txt | Metadata for the srdb-studies file
srdb-studies.csv | Studies database

Note that the `srdb-equations.csv` entries used to be part of the main data file,
but it was a lot of work, and didn't seem to be used, so we stopped updating it.

## Major changelog

Date | Change
-------- | ------------------------------------------------------------
20241012 | Data up to 2022 entered by Gabriela Aguilar-Martinez, Melat Ghebreselassie, Alanna Hart, Brandon Kim, and Carly Pierce.
20221009 | New 2018-2019 data entered by Elon Atlaw, Mahlet Dagnachew, and Emily Kang.
20210621 | Many (400+) corrections to location, time, ecosystem type, etc.; thanks to Ni Huang! See PR #126.
20210522 | New 2017 data entered by Shoshi Hornum and Hope Ng.
Expand Down
Binary file not shown.
Binary file added calculations/13194 Wang PLOSONE 2019.xlsx
Binary file not shown.
Binary file added calculations/13232 Gatis MiresPeat.xlsx
Binary file not shown.
Binary file added calculations/13430 Wang - EnviPollution.xlsx
Binary file not shown.
Binary file added calculations/13451 Ma STE 2018.xls
Binary file not shown.
Binary file added calculations/13503 Li.xlsx
Binary file not shown.
Binary file not shown.
Binary file added calculations/13576 Yang PLOSONE 2018.xlsx
Binary file not shown.
Binary file added calculations/13674 Bracho Journal(1).xlsx
Binary file not shown.
Binary file added calculations/13674 Bracho Journal.xlsx
Binary file not shown.
Binary file added calculations/13680 Sanchez-Canete Journal.xlsx
Binary file not shown.
Binary file added calculations/13703 Li FrontEarSci.xlsx
Binary file not shown.
Binary file added calculations/14762 Li Geoderma.xlsx
Binary file not shown.
Binary file added calculations/14857 Adame-Castro.xlsx
Binary file not shown.
Binary file added calculations/14964 Li STE 2020.xlsx
Binary file not shown.
Binary file added calculations/15091 Hawkes SBB.xlsx
Binary file not shown.
Binary file added calculations/15289 Valente LDD 2021.xlsx
Binary file not shown.
Binary file added calculations/15304 Yan AFM 2021.xlsx
Binary file not shown.
Binary file not shown.
Binary file added calculations/15321 Wang Forests 2021.xlsx
Binary file not shown.
Binary file added calculations/15322 Dai Biogeochem 2021.xlsx
Binary file not shown.
Binary file added calculations/15339 Li ESS 2021.xlsx
Binary file not shown.
Binary file added calculations/15345 Fu STE 2022.xlsx
Binary file not shown.
Binary file added calculations/16522 Yan Geoderma 2022.xlsx
Binary file not shown.
Binary file added calculations/16608 Zhang Atmosphere 2022.xlsx
Binary file not shown.
Binary file removed corrections-additions.xls
Binary file not shown.
Loading

0 comments on commit 6223733

Please sign in to comment.