Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
32 changes: 19 additions & 13 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
Package: matilda
Type: Package
Title: A Probabilistic Framework for the Hector Simple Climate Model
Version: 0.1.0
Author: c(person("Joseph", "Brown",
email = "joseph.brown@pnnl.gov",
role = "aut",
comment = c(ORCID = "0000-0002-3828-4729")),
Version: 1.0.0
Authors@R: c(
person("Joseph", "Brown",
email = "joseph.brown@pnnl.gov",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-3828-4729")),
person("Ben", "Bond-Lamberty",
email = "bondlamberty@pnnl.gov",
role = "aut",
comment = c(ORCID = "0000-0001-9525-4633")),
person("Leeya", "Pressburger")
email = "leeya.pressburger@pnnl.gov",
role = "aut",
comment = c(ORCID = "0000-0002-6850-2504")))
Maintainer: Joseph Brown <joseph.brown@pnnl.gov>
email = "bondlamberty@pnnl.gov",
role = "aut",
comment = c(ORCID = "0000-0001-9525-4633")),
person("Leeya", "Pressburger",
email = "leeya.pressburger@pnnl.gov",
role = "aut",
comment = c(ORCID = "0000-0002-6850-2504")),
person("Kalyn", "Dorheim",
email = "kalyn.dorheim@pnnl.gov",
role = "ctb",
comment = c(ORCID = "0000-0001-8093-8397")),
person("Melat", "Ghebreselassie",
role = "ctb"))
Description: Provides a probabilistic framework for climate variable projections
using the Hector simple climate model. Using this framework you can change
parameters, run the model, retrieve targeted model outputs, and quantify
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ S3method(print,h_metric)
export(RMSE_calc)
export(criterion_co2_obs)
export(criterion_gmst_obs)
export(criterion_ocean_c_uptake_obs)
export(generate_params)
export(hector_matrix)
export(is.criterion)
Expand Down
2 changes: 1 addition & 1 deletion R/example_hector_result.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' a single hector. The model results include the GMST() Hector variable for
#' the years 1745:2300.
#'
#' @format \code{hector_result} {is a data frame with 556 rows and 5 columns:}
#' @format hector_result is a data frame with 556 rows and 5 columns:
#' \describe{
#' \item{scenario}{Scenario being used for the analysis}
#' \item{year}{Years}
Expand Down
2 changes: 1 addition & 1 deletion R/example_matilda_result.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' This ensures that data being saved from the core includes the data needed to
#' score the Hector runs.
#'
#' @format \code{matilda_result} {is a data frame with 2820 rows and 6 columns:}
#' @format matilda_result is a data frame with 2820 rows and 6 columns:
#' \describe{
#' \item{scenario}{Scenario being used for the analysis}
#' \item{year}{Years}
Expand Down
31 changes: 27 additions & 4 deletions R/new_criterion.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ is.criterion <- function(x) {
#' @examples
#' criterion_co2_obs()
criterion_co2_obs <- function() {
get("observed_co2_data", envir = asNamespace("matilda"))
new_criterion(CONCENTRATIONS_CO2(),
years = observed_data_co2$year,
obs_values = observed_data_co2$co2_ppm
years = observed_co2_data$year,
obs_values = observed_co2_data$co2_ppm
)
}

Expand All @@ -105,8 +106,30 @@ criterion_co2_obs <- function() {
#' @examples
#' criterion_gmst_obs()
criterion_gmst_obs <- function() {
get("observed_gmst_data", envir = asNamespace("matilda"))
new_criterion(GMST(),
years = adjusted_gmst_data$year,
obs_values = adjusted_gmst_data$anomaly_C
years = observed_gmst_data$year,
obs_values = observed_gmst_data$anomaly_C
)
}


#' Screening criterion using Global Carbon Project ocean carbon uptake
#'
#' @description This is a criterion identifier for screening Hector runs using
#' observed ocean carbon uptake from the Global Carbon Project's 2023 Global Carbon Budget.
#'
#' @return A criterion identifier using GCP ocean carbon uptake
#' @note This function uses ocean carbon uptake data from
#' \href{ https://globalcarbonbudgetdata.org/latest-data.html}{ https://globalcarbonbudgetdata.org/latest-data.html}
#' @export
#'
#' @examples
#' criterion_ocean_c_uptake_obs()
criterion_ocean_c_uptake_obs <- function() {
get("observed_ocean_c_uptake_data", envir = asNamespace("matilda"))
new_criterion(OCEAN_UPTAKE(),
years = observed_ocean_c_uptake_data$year,
obs_values = observed_ocean_c_uptake_data$ocean_uptake
)
}
5 changes: 4 additions & 1 deletion R/score_runs.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ score_runs <- function(x, criterion, score_function, ...) {
stop("criterion year and variable combination not represented in data")
}

# retains run_number from x
run_numbers <- unique(x_subset$run_number)

# converts x_subset to matrix - columns are vectors of values for each model iteration
model_matrix <- hector_matrix(x_subset, columns = "value")

Expand All @@ -69,6 +72,6 @@ score_runs <- function(x, criterion, score_function, ...) {

return(data.frame(
weights = score_norm,
run_number = 1:length(scores)
run_number = run_numbers
))
}
Binary file modified R/sysdata.rda
Binary file not shown.
57 changes: 0 additions & 57 deletions data-raw/Had_temp_data-adjusted.R

This file was deleted.

13 changes: 0 additions & 13 deletions data-raw/MaunaLoa_co2_data.R

This file was deleted.

File renamed without changes.
Loading