This function combines 3 miljotools functions in a single gridded data retrieval and processing pipeline to write and assign weather data to a SWAT+ setup. The functions involved are

swat_weather_input_chain(
  area,
  swat_setup,
  directory = NULL,
  from = NULL,
  to = NULL,
  area_buffer = 1500,
  verbose = TRUE,
  precision = 2,
  write_wgn = TRUE,
  sqlite_path = NULL
)

Arguments

area

The catchment area to retrieve data for. (must be a shapefile)

swat_setup

The path to your SWAT+ setup (input files, aka TxtInOut)

directory

directory to download and process data in

from

start of the to-be-dowloaded timeseries (ie. and min: "2012-09-01 10:00:00")

to

end of the to-be-dowloaded timeseries (ie. and max: "2023-01-31 10:00:00")

area_buffer

optional buffer in meters around the provided area

verbose

print status messages?

precision

Optional, which precision (integer) should the hourly data be rounded down to when converted from daily to hourly. Default is '2' decimal places.

write_wgn

would you like to calculate and write the weather generator?

sqlite_path

optionally, you can pass the path of your .sqlite file in order to update the database with your new met files

Details

  1. get_metno_reanalysis3() downloads and processes the hourly gridded reanalysis data for the nordics

  2. reanalysis3_daily() converts these hourly timeseries into daily.

  3. reanalysis3_swatinput() converts these timeseries into a SWAT+ compatible format as well as generating the weather generator, and updating SWAT+ input files with the help of the R-package SWARTprepR

For more details please see the help pages of the individual functions. Also please note the the package SWATprepR is required for this pipeline.

Author

Moritz Shore, Svajunas Plunge