Skip to content

Commit

Permalink
fix filename and subset of cftfrac
Browse files Browse the repository at this point in the history
  • Loading branch information
David Hoetten authored and David Hoetten committed May 29, 2024
1 parent a2498ee commit 5f2ed96
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions R/Metric_subclasses.R
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,13 @@ GlobSumTimeAvgTablePFT_harvest <- # nolint: object_name_linter.
public = list(
#' @description
#' Weigh by cft_frac and then do the same as GlobSumTimeAvgTable
#' @param data LpjmlDataCalc object to be summarized
#' @param data LPJmLDataCalc object to be summarized
summarize = function(data) {
cft_frac <- read_file(data$meta$.__enclos_env__$private$.data_dir, "cft_frac")
cft_frac <- subset(cft_frac, band = data$meta$band_names)
cft_frac <- read_file(data$meta$.__enclos_env__$private$.data_dir,
"cftfrac")
cft_frac <- subset(cft_frac,
band = data$meta$band_names,
time = dimnames(data$data)[[2]])
super$summarize(data * cft_frac)
},

Expand All @@ -401,7 +404,7 @@ GlobSumTimeAvgTablePFT_harvest <- # nolint: object_name_linter.
#' initialize with an extended description
initialize = function() {
self$description <- paste0(self$description, " In addition to terr_area
the output is also weighted by cft_frac.")
the output is also weighted by cftfrac.")
}
)
)
Expand All @@ -416,7 +419,7 @@ GlobSumTimeAvgTableFPC <- R6::R6Class( # nolint: object_name_linter.
public = list(
#' @description
#' Weigh by natural stand fraction and then do the same as GlobSumTimeAvgTable
#' @param data LpjmlDataCalc object to be summarized
#' @param data LPJmLDataCalc object to be summarized
summarize = function(data) {
nat_stand_frac <- subset(data, band = "natural stand fraction")
bands <- data$meta$band_names
Expand Down Expand Up @@ -449,10 +452,13 @@ GlobSumAnnTimeseriesPFT_harvest <- # nolint: object_name_linter.
public = list(
#' @description
#' Weigh by cft_frac and then do the same as GlobSumAnnAvgTimeseries
#' @param data LpjmlDataCalc object to be summarized
#' @param data LPJmLDataCalc object to be summarized
summarize = function(data) {
cft_frac <- read_file(data$meta$.__enclos_env__$private$.data_dir, "cft_frac")
cft_frac <- subset(cft_frac, band = data$meta$band_names)
cft_frac <- read_file(data$meta$.__enclos_env__$private$.data_dir,
"cftfrac")
cft_frac <- subset(cft_frac,
band = data$meta$band_names,
time = dimnames(data$data)[[2]])
super$summarize(data * cft_frac)
},

Expand All @@ -464,7 +470,7 @@ GlobSumAnnTimeseriesPFT_harvest <- # nolint: object_name_linter.
#' initialize with an extended description
initialize = function() {
self$description <- paste0(self$description, " In addition to terr_area
the output is also weighted by cft_frac.")
the output is also weighted by cftfrac.")
}
)
)
Expand All @@ -480,7 +486,7 @@ GlobSumAnnTimeseriesFPC <- R6::R6Class( # nolint: object_name_linter.
#' @description
#' Weigh by natural stand fraction and then do the same as
#' GlobSumAnnAvgTimeseries
#' @param data LpjmlDataCalc object to be summarized
#' @param data LPJmLDataCalc object to be summarized
summarize = function(data) {
nat_stand_frac <- subset(data, band = "natural stand fraction")
bands <- data$meta$band_names
Expand Down

0 comments on commit 5f2ed96

Please sign in to comment.