Skip to content

Commit

Permalink
update example script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongchen Zhang committed Feb 22, 2025
1 parent 589794c commit 480bfce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 39 deletions.
2 changes: 1 addition & 1 deletion modules/data.atmosphere/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export(debias.met.regression)
export(download.Ameriflux)
export(download.AmerifluxLBL)
export(download.CRUNCEP)
export(download.ERA5_cds_annual)
export(download.ERA5_cds)
export(download.FACE)
export(download.Fluxnet2015)
export(download.FluxnetLaThuile)
Expand Down
2 changes: 1 addition & 1 deletion modules/data.atmosphere/R/ERA5_download.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#'
#' @importFrom magrittr %>%
#' @author Dongchen Zhang
download.ERA5_cds_annual <- function(outfolder, start_date, end_date, extent, variables, auto.create.key = T, timeout = 36000) {
download.ERA5_cds <- function(outfolder, start_date, end_date, extent, variables, auto.create.key = T, timeout = 36000) {
# check shell environments.
if ("try-error" %in% class(try(system("grib_to_netcdf"), silent = T))) {
PEcAn.logger::logger.info("The grib_to_netcdf function is not detected in shell command.")
Expand Down
55 changes: 18 additions & 37 deletions modules/data.atmosphere/inst/ERA5/ERA5_NA_download.R
Original file line number Diff line number Diff line change
@@ -1,37 +1,18 @@
library(reticulate)
library(future)
library(purrr)
library(furrr)
outdir <- "/projectnb/dietzelab/dongchen/anchorSites/ERA5/"
years <- 2012:2024
months <- list('01','02','03',
'04','05','06',
'07','08','09',
'10','11','12')
days <- list('01','02','03',
'04','05','06',
'07','08','09',
'10','11','12',
'13','14','15',
'16','17','18',
'19','20','21',
'22','23','24',
'25','26','27',
'28','29','30',
'31')
times <- list('00:00','03:00','06:00',
'09:00','12:00','15:00',
'18:00','21:00')
area <- "85/-179/7/-20"
variables <- list( "2m_temperature","surface_pressure",
"2m_dewpoint_temperature","total_precipitation",
"10m_u_component_of_wind","10m_v_component_of_wind",
"surface_solar_radiation_downwards","surface_thermal_radiation_downwards")
paths <- PEcAn.data.atmosphere::ERA5_cds_annual_download(years = year,
months = months,
days = days,
times = times,
area = area,
variables = variables,
outdir = outdir,
auto.create.key = T)
outfolder <- "/projectnb/dietzelab/dongchen/anchorSites/ERA5/"
start_date <- "2012-01-01"
end_date <- "2021-12-31"
extent <- c(-179, -20, 7, 85)
variables <- c("2m_temperature",
"surface_pressure",
"2m_dewpoint_temperature",
"total_precipitation",
"10m_u_component_of_wind",
"10m_v_component_of_wind",
"surface_solar_radiation_downwards",
"surface_thermal_radiation_downwards")
results <- PEcAn.data.atmosphere::download.ERA5_cds(outfolder = outfolder,
start_date = start_date,
end_date = end_date,
extent = extent,
variables = variables,
auto.create.key = T)

0 comments on commit 480bfce

Please sign in to comment.