R/provide_rain_data_for_bathing_spot.R
provide_rain_data.Rd
The function considers (i) the "catchment" area that is defined for the bathing spot and (ii) the date range that is taken from the range of dates for which measurements are available. Rain data are read from binary Radolan files, masked around the "catchment" area and and averaged over all layears for each raster cell. The resulting rain data are then stored in the Postgres database. IMPORTANT: Existing rain data will be overwritten in the database!
provide_rain_data(user_id, spot_id, sampling_time = "1050", date_range = NULL, blocksize = 10, control = NULL, info = TRUE, urls = NULL)
user_id | user id |
---|---|
spot_id | bathing spot id |
sampling_time | expected sampling time. Will be used to select the corresponding Radolan files. |
date_range | vector of two Date objects giving the first and last day of
rain data to be loaded. If |
blocksize | number of Radolan files to be downloaded and processed "at once", i.e. this number of files is downloaded, read, masked, averaged and written to the database before loading new files. By doing so, at least some data will be available in the database in case that too many files cause a crash. |
control | object returned by a former call to this function that contains the current state of the import process and takes care that the next block of required data is downloaded. When omitted, the function returns an object that can be used as a control object for a next call of this function. See example. |
info | if |
urls | vector of URLs to Radolan files. By default, the URLs are
determined within the function, considering the available measurements.
However, the user may override this behaviour by giving the URLs here.
Only used when |
vector of integer containing the IDs of the records inserted into the "rains" database table.
if (FALSE) { control <- provide_rain_data_for_bathing_spot(user_id = 5, spot_id = 41) while (control$remaining > 0) { control <- provide_rain_data_for_bathing_spot(control = control) } }