Skip to content

Commit c78730b

Browse files
committed
Further implementation of Cullen's suggestions
1 parent ab61213 commit c78730b

2 files changed

Lines changed: 30 additions & 7 deletions

File tree

R/global_variables.R

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,31 @@
22
# This is because we are referencing column names in dplyr / data.table objects which use
33
# Non-Standard Evaluation.
44

5-
globalVariables(c("cell_area_km2", "coverage_fraction", "day", "era5_grid",
6-
"hour", "month", "minute", "poly_id", "sum_weight", "value",
7-
"w_area", "w_sum", "weight", "x", "y", "year", ".",
8-
"is_right_xmin", "is_left_xmax", "x_low", "x_high", "y_low",
9-
"y_high", "..cols_to_keep"))
5+
globalVariables(
6+
c(
7+
"cell_area_km2",
8+
"coverage_fraction",
9+
"day",
10+
"era5_grid",
11+
"hour",
12+
"month",
13+
"minute",
14+
"poly_id",
15+
"sum_weight",
16+
"value",
17+
"w_area",
18+
"w_sum",
19+
"weight",
20+
"x",
21+
"y",
22+
"year",
23+
".",
24+
"is_right_xmin",
25+
"is_left_xmax",
26+
"x_low",
27+
"x_high",
28+
"y_low",
29+
"y_high",
30+
"..cols_to_keep"
31+
)
32+
)

R/staggregate.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ daily_aggregation <- function(data, overlay_weights, daily_agg, time_interval='1
7575
}
7676

7777
# Check for the final case in which the polygons just span the entire globe
78-
if(length(unique(weights_dt[,x] >= terra::ncol(clim_stack)))){
78+
if(length(unique(weights_dt[,x])) >= terra::ncol(clim_stack)){
7979
polygons_split <- FALSE
8080
}
8181

@@ -506,7 +506,7 @@ staggregate_polynomial <- function(data, overlay_weights, daily_agg, time_agg =
506506
layer_names <- setup_list[[2]] # Pulls the saved layer names
507507

508508
# Polynomial transformation
509-
poly_orders <- seq(1:degree) # Compute values from 1 to degree
509+
poly_orders <- 1:degree # Compute values from 1 to degree
510510
list_length <- length(poly_orders) # How many lists are in the final object
511511
list_names <- sapply(1:list_length, FUN=function(x){paste("order", poly_orders[x], sep="_")})
512512

0 commit comments

Comments
 (0)