create_data {InterpolateR} | R Documentation |
Create a Unified Observation Dataset in the BD_Obs Format from Multiple CSV Files
This function constructs a unified dataset (BD_Obs
structure) by merging multiple CSV files,
each containing in-situ observations from different stations. The function standardizes the format
required by downstream interpolation or bias correction algorithms by aligning all station data
into a single data.table
, with dates as rows and station identifiers as columns.
Description
Each input CSV file must contain exactly two columns: the first with dates (Date
) and the second
with the in-situ measurements of the variable to be interpolated.
Usage
create_data(file.path, Start_date, End_Date, ncores = NULL, max.na = NULL)
Arguments
file.path |
|
Start_date |
|
End_Date |
|
ncores |
|
max.na |
|
Value
If max.na
is NULL
, the function returns a data.table
structured in the BD_Obs
format,
where the first column contains the dates and the remaining columns correspond to individual stations.
This format preserves the full dataset without filtering for missing values.
If max.na
is not NULL
, the function returns a named list containing:
data
A
data.table
in theBD_Obs
format that includes only stations with a percentage of missing values less than or equal tomax.na
.Na_stations
A
data.table
summarizing the percentage of missing values for each station, useful for assessing data quality and supporting decisions about station selection.
Author(s)
Jonnathan Augusto landi Bermeo, jonnathan.landi@outlook.com
Examples
# Example usage
file.path <- system.file("extdata/Folds_ejs_create_data", package = "InterpolateR")
# Create a data with all stations
data <- create_data(file.path, Start_date = "2015-01-01", End_Date = "2015-03-01", ncores = NULL)