Convert data from infoworks output to gerris input format

iw_gerris_interface(
  interface_input_folder,
  interface_output_folder,
  simulation_name,
  return_after = "",
  return_output_table = FALSE,
  infoworks_time_format = "%d/%m/%Y %H:%M:%S",
  gerris_time_format = "%d.%m.%Y %H:%M",
  timestep_out = 15,
  skip_hours = 0,
  flow_threshold = 0.003,
  flow_only = FALSE,
  outlets_to_suppress = NULL
)

Arguments

interface_input_folder

Folder in which the inforowks output files are located

interface_output_folder

Folder where the gerris input files are saved

simulation_name

Either the whole name of the simulation or a unique part regarding all simulations in the defined folder

return_after

if a number is given, the function returns the data after thata data processing step. For more information see details

return_output_table

If TRUE the output table is returned, otherwise it is only saved in the speficied table

infoworks_time_format

The Inforworks time format default is "%d/%m/%Y %H:%M:%S". For manual adaption see details of strptime()

gerris_time_format

The Gerris time format default is "%d.%m.%Y %H:%M". For manual adaption see details of strptime()

timestep_out

The timesteps needed for Gerris in minutes (default is 15)

skip_hours

The hours to skip before Gerris input is needed. This is especially imnportant if infoworks needs a long start-up phase that should not be passed on the gerris

flow_threshold

A threshold underneath which the flow is set to 0 to avoid negative flows (in m3/s)

flow_only

If TRUE, a flow file is sufficient as interface input. All other available input files will also be processed but no total nitrogen is calculated that might lead to an error due to missing nitrogen input files

outlets_to_suppress

Character vector defining Infoworks outlet IDs for all outlets to be suppressed. For those outlets the flow will be constantly set to 0.

Value

One table containing all water quality and overflow data per outlet and timestamp at which an overflow occurred plus there very first timestemp of the simulation. One table with statistics per outlet over the whole simulation time. A log file with messages of the data processing.

Details

These are the steps within the function:

  1. load data

  2. set flow to 0 below threshold value

  3. change timesteps

  4. outlets that do not have an ID in Gerris are integrated into the closest vailable outlet in the model

  5. calculating concentration by parameters mass flow and water flow

  6. if TKN < NH4-N --> TKN = NH4-N (not done if floe_only = TRUE)

  7. new table for total Nitrogen (sum of TKN NO2, and NO3) (not done if floe_only = TRUE)

  8. Rename Parameters

  9. Add all Parameters with constant values

  10. Check if all parameters are within the gerris range between min and max and round to 3 significant digits

  11. reshape the data from data per parameter to data per outlet

  12. add a column with gerris id ("Randbedingung")

  13. delete all rows without flow (except for the very first time step, and the event surrounding timesteps) After that data is aggregated for the "stats" output files

  14. collect all data in one single table

  15. change time format

  16. Save table for use in gerris