Generate AmeriFlux meteorological ensembles
Source:R/Ameriflux_met_ensemble.R
AmeriFlux_met_ensemble.RdDownloads AmeriFlux data, applies ERA5 fallback for missing radiation and soil moisture, performs gap-filling, and generates ensembles. This function provides a complete pipeline from raw AmeriFlux data to CF-compliant ensemble meteorological files.
Usage
AmeriFlux_met_ensemble(
site_id,
start_date,
end_date,
outfolder,
ameriflux_username = "pecan",
ameriflux_useremail = "@",
overwrite = FALSE,
verbose = FALSE,
format = NULL,
n_ens = 10,
w_len = 30,
era5_user = NULL,
era5_key = NULL,
threshold = 0.5,
dirs = NULL,
...
)Arguments
- site_id
character. AmeriFlux site identifier (e.g, "US-Ha1") The 'SITE_ID' field in list of Ameriflux sites
- start_date
character or date. Start date in "YYYY-MM-DD" format
- end_date
character or date. End date in "YYYY-MM-DD" format
- outfolder
character. Output directory path for ensemble files
- ameriflux_username
character. AmeriFlux username for data access.
- ameriflux_useremail
character. Email address for AmeriFlux authentication (must contain "@")
- overwrite
logical. Whether to overwrite existing files. Default: FALSE
- verbose
logical. Whether to print detailed logs. Default: FALSE
- format
data frame or List. format specifications for CF conversion. Default: NULL The AmerifluxLBL format is Bety record 5000000002. which could be returned from PEcAn.DB::query.format.vars(format.id=5000000002, bety = con)
- n_ens
integer. Number of ensemble members to generate. Default: 10
- w_len
integer. Window length in days. Default: 20
- era5_user
character. CDS user ID (UID) from your CDS profile. Required for authentication.
- era5_key
character. CDS API key from your CDS profile. Required for authentication.
- threshold
numeric. Coverage threshold (0-1) for triggering ERA5 fallback. Default: 0.5
- dirs
named list. Optional configuration for existing data directory paths. Default: NULL
- ...
additional arguments passed to download.AmerifluxLBL
Examples
if (FALSE) { # \dontrun{
result <- AmeriFlux_met_process(
site_id = "US-Ha1",
start_date = "2010-01-01",
end_date = "2010-12-31",
outfolder = "/path/to/output",
ameriflux_username = "your_username",
ameriflux_useremail = "your.email@domain.com",
format = format,
era5_user = "your_cds_user",
era5_key = "your_cds_api_key",
n_ens = 5,
verbose = TRUE
)
} # }