# mixr: Transfer of net rainfall and discharge simulation In transfR: Transfer of Hydrograph from Gauged to Ungauged Catchments

## Description

Combine net rainfall of gauged catchments to simulate the discharge of an ungauged catchment.

## Usage

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 mixr( obs, sim, mdist, distance = "rghosh", gres = 5, weightO = 0.8, weightC = 0.2, parallel = FALSE, cores = NULL, power = 1, ndonors = 5, donors = NULL, maxdist = 50000, flexible_donor = TRUE, cv = FALSE, save_donor = FALSE, verbose = TRUE ) 

## Arguments

 obs "transfR" object of the gauged catchments sim "transfR" object of the ungauged catchments mdist the distance matrix between gauged and ungauged catchments as computed by the function hdist distance the method to use for computing distance matrix if mdist is not provided. Possible values are "ghosh", "ghosh2", "rghosh", "points", "centroids", "combined" as available in the function hdist gres resolution of spatial discretisation (number of points by km²) for Ghosh distance (see the function hdist) weightO weight given to the distance between outlets if distance is "combined" (see the function hdist) weightC weight given to the distance between centroids if distance is "combined" (see the function hdist) parallel logical indicating if the computation should be parallelised cores the number of cores to use for parallel execution if parallel is TRUE. If not specified, the number of cores is set to the value of parallel::detectCores() power exponent applied in the inverse distance weighting strategy as defined by the function weightr ndonors maximum number of catchments to be used to simulate discharge of an ungauged catchment as defined by the function weightr donors vector of catchments id from which donors are selected. If empty, the ndonors closest catchments are used maxdist maximum distance between a gauged and an ungauged catchment to allow the net rainfall to be transfered. This threshold is applied on the mdist distance matrix. If no units is provided, maxdist is assumed to be in [m]. flexible_donor boolean indicating if the donor catchments can change during the simulation period according to the availability of discharge observations. See weightr for more details cv boolean indicating if cross validation evaluation should be done. If true, it will estimate the net rainfall of every gauged catchments (obs) as if they were ungauged (leave-one-out evaluation) save_donor boolean indicating if the net rainfall of each of the ndonors catchments should be stored in the sim object for further analysis. If true, it is adding three new space-time attributes in the sim object called "RnDonor", "Idonor" and "Wdonor" describing the net rainfall, the id and the weight of the donor catchments respectively verbose boolean indicating if information messages should be written to the console

## Details

This function is a wrapper function for hdist and weightr to directly estimate the net rainfall on a set of ungauged catchments (sim) from a set of gauged catchments (obs). It returns the simulated net rainfall as a new space-time attribute in the sim object called "RnSim". The simulated net rainfall of a given ungauged catchment i is a weighted average of the net rainfalls of ndonors gauged catchments j:

R_n^i =Σ_{j=1}^{ndonors} R_n^j \cdot λ_j

where λ_j are defined by a inverse distance weighting function (see weightr).

## Value

The sim object incremented by the new computed attributes.

  1 2 3 4 5 6 7 8 9 10 11 12 data(Oudon) object <- as_transfr(st=Oudon$obs,hl=Oudon$hl) object <- velocity(object) object <- uh(object) object <- lagtime(object) object <- rapriori(object) object <- inversion(object, parallel = TRUE, cores=2) mdist <- hdist(x=object, y=object, method="rghosh") object <- mixr(obs = object, mdist=mdist, parallel = TRUE, cores=2, cv=TRUE, flexible_donor=TRUE, save_donor = FALSE) object <- convolution(object, save_donor = FALSE) plot(object,i=1,attribute=c("Qobs","Qsim"))