Skip to content

Commit

Permalink
Merge pull request #8 from fbenke-pik/master
Browse files Browse the repository at this point in the history
add getCs2Profiles
  • Loading branch information
fbenke-pik authored Apr 23, 2024
2 parents d2a54a7 + 6ee0c2a commit c1c4da8
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '178524'
ValidationKey: '198360'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'piamPlotComparison: Create comparison plots for your model results'
version: 0.0.9
version: 0.0.10
date-released: '2024-04-23'
abstract: A frameworks to create comparison plots for your model results.
authors:
Expand Down
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: piamPlotComparison
Title: Create comparison plots for your model results
Version: 0.0.9
Version: 0.0.10
Date: 2024-04-23
Authors@R: c(
person("Falk", "Benke", , "[email protected]", role = c("aut", "cre")),
Expand All @@ -12,6 +12,7 @@ License: LGPL-3
URL: https://github.com/pik-piam/piamPlotComparison
Imports:
dplyr,
jsonlite,
knitr,
magclass,
mip (>= 0.148.11),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export(calcTimeSeriesStats)
export(compareScenarios)
export(getCs2Profiles)
export(showStatsTable)
importFrom(dplyr,"%>%")
importFrom(dplyr,across)
Expand Down
24 changes: 24 additions & 0 deletions R/getCs2Profiles.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#' Get the List of cs2 Profiles
#'
#' A list of arguments to \code{\link{compareScenarios}} is called a (cs2-)
#' profile. This function loads a list of such profiles from a file. The default
#' argument is set such that the default profiles file of REMIND is loaded.
#'
#' @param path \code{character(1)}. Path to the profiles file.
#' @return A named list of profiles. The names are the names of the respective
#' profile. Each profile is a named list. Those names correspond to arguments
#' of \code{\link{compareScenarios}}.
#' @author Christof Schoetz
#' @examples
#' \dontrun{
#' profiles <- getCs2Profiles() # load from default location
#' profiles <- getCs2Profiles(path = "path/to/profiles.json")
#' }
#' @export
getCs2Profiles <- function(path = "./scripts/cs2/profiles.json") {
path <- normalizePath(path, mustWork = TRUE)
profiles <- jsonlite::read_json(path, simplifyVector = FALSE)
# Remove entries starting with "_". They are treated as comments.
profiles <- profiles[!startsWith(names(profiles), "_")]
return(profiles)
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Create comparison plots for your model results

R package **piamPlotComparison**, version **0.0.9**
R package **piamPlotComparison**, version **0.0.10**

[![CRAN status](https://www.r-pkg.org/badges/version/piamPlotComparison)](https://cran.r-project.org/package=piamPlotComparison) [![R build status](https://github.com/pik-piam/piamPlotComparison/workflows/check/badge.svg)](https://github.com/pik-piam/piamPlotComparison/actions) [![codecov](https://codecov.io/gh/pik-piam/piamPlotComparison/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/piamPlotComparison) [![r-universe](https://pik-piam.r-universe.dev/badges/piamPlotComparison)](https://pik-piam.r-universe.dev/builds)

Expand Down Expand Up @@ -46,7 +46,7 @@ In case of questions / problems please contact Falk Benke <[email protected]>

To cite package **piamPlotComparison** in publications use:

Benke F, Schoetz C (2024). _piamPlotComparison: Create comparison plots for your model results_. R package version 0.0.9, <https://github.com/pik-piam/piamPlotComparison>.
Benke F, Schoetz C (2024). _piamPlotComparison: Create comparison plots for your model results_. R package version 0.0.10, <https://github.com/pik-piam/piamPlotComparison>.

A BibTeX entry for LaTeX users is

Expand All @@ -55,7 +55,7 @@ A BibTeX entry for LaTeX users is
title = {piamPlotComparison: Create comparison plots for your model results},
author = {Falk Benke and Christof Schoetz},
year = {2024},
note = {R package version 0.0.9},
note = {R package version 0.0.10},
url = {https://github.com/pik-piam/piamPlotComparison},
}
```
2 changes: 1 addition & 1 deletion inst/compareScenarios/cs_main.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ options(warn = 1)
options(mip.mainReg = params$mainReg) # nolint
options(mip.yearsBarPlot = params$yearsBarPlot) # nolint
# Reference year for Kaya decomposition is params$yearRef or the first available year therafter.
# Reference year for Kaya decomposition is params$yearRef or the first available year thereafter.
options(kaya.refYear = min(params$yearsScen[params$yearsScen >= params$yearRef])) # nolint
# allow for duplicate chunk labels
Expand Down
30 changes: 30 additions & 0 deletions man/getCs2Profiles.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c1c4da8

Please sign in to comment.