Skip to content

Commit

Permalink
improve sampling of grids in evaluateWegen
Browse files Browse the repository at this point in the history
  • Loading branch information
tanerumit committed Jan 23, 2024
1 parent 4242a52 commit 0fd9bb1
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions R/generateWeatherSeries.R
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,8 @@ generateWeatherSeries <- function(

if(evaluate.model) {

# Sample evenly from the grid cells
#sampleGrids <- sf::st_as_sf(weather.grid[,c("x","y")], coords=c("x","y")) %>%
# sf::st_sample(size = min(evaluate.grid.num, ngrids), type="regular") %>%
# sf::st_cast("POINT") %>% sf::st_coordinates() %>% as_tibble() %>%
# left_join(weather.grid[,c("x","y","id")], by = c("X"="x","Y"="y")) %>%
# pull(id)

sampleGrids <- 1:(min(evaluate.grid.num, ngrids))
sampleGrids <sample(grids, size = min(evaluate.grid.num, ngrids))
#sampleGrids <- 1:(min(evaluate.grid.num, ngrids))

rlz_sample <- list()
for (n in 1:realization.num) {
Expand Down Expand Up @@ -341,9 +335,3 @@ generateWeatherSeries <- function(
return(list(resampled = resampled_dates, dates = sim_dates_d$date))

}






0 comments on commit 0fd9bb1

Please sign in to comment.