View source: R/fnc_write_agg.R
fnc_write_agg | R Documentation |
LWFBrook90 creates a lot of output files. In order to keep data storage to a minimum, both run_LWFB90
and run_multisite_LWFB90
provide an output_fun
- argument that can be used to reduce the output and directly write it to a database. This is what this function is made for.
In comparison to fnc_write
, which only reduces the columns returned by run_LWFB90
(see help page), this function enables aggregation over vegperiod and monthly, plus a more detailed selection of drought indices. See detail section.
IMPORTANT: FOR RUNNING THIS AGGREGATE FUNCTION, output
in run_multiside_LWFB90
MUST BE SET TO A df.output
AS SET BY THE CODE IN THE EXAMPLE SECTION
The function writes .rds files with the desired output for each point. fnc_write_to_sql
can be used to convert these files into a SQLite-DB. This "step-in-between" is necessary because SQLite does not support parallel writing.
fnc_write_agg(
x,
aggr_tp,
col_select_day = NA,
col_select_mon = NA,
col_select_vp = NA,
col_select_yr = NA,
dir_name = NA
)
x |
one of the intermediate producs of |
aggr_tp |
a string containing the desired aggregation time period. Can be |
col_select_day |
a string containing the desired columns from the daily-aggregation (see details) |
col_select_mon |
a string containing the desired columns from the monthly-aggregation (see details) |
col_select_vp |
a string containing the desired columns from the vegperiod-aggregation (see details) |
col_select_yr |
a string containing the desired columns from the yearly-aggregation (see details) |
dir_name |
directory for tmp files, if |
Returns the desired output to .rds files
IT IS HIGHLY RECOMMENDED TO MAKE A SUBSELECTION, OR THERE WILL BE A LOT (>100) OF COLUMNS.
For a complete list of possible output types plus description, see "U:/db_brook90_output/whh_db_documentation"
# setting for df.output:
df.output <- set_outputLWFB90()
df.output[,] <- 0L
df.output[c("Abov", "Evap", "Flow", "Swat"), c("Day")] <- 1
# for full example, see help page of ?fnc_write_to_sql
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.