MPR issueshttps://git.ufz.de/chs/MPR/-/issues2021-11-12T13:52:37+01:00https://git.ufz.de/chs/MPR/-/issues/59get rid of Warnings concerning hard-coded transfer functions2021-11-12T13:52:37+01:00Robert Schweppeget rid of Warnings concerning hard-coded transfer functionsRemove the warning:
```
'The transfer function name "', trim(name) , '" is not registered.'
```
Also, we need to improve the message about the delete string:
```
log_warn(*) "delete string is not empty, returning input string: " /...Remove the warning:
```
'The transfer function name "', trim(name) , '" is not registered.'
```
Also, we need to improve the message about the delete string:
```
log_warn(*) "delete string is not empty, returning input string: " // trim(funcString)
log_warn(*) " detete string = " // trim(deleteString)
```
It is a common warning/error and should be more helpful to the user.Next major releaseRobert SchweppeRobert Schweppehttps://git.ufz.de/chs/MPR/-/issues/33Improve speed2021-11-12T13:52:43+01:00Robert SchweppeImprove speedCurrently the speed of MPR fell far behind that of its previous version that was part of the mHM code (ca. 50x for test basin). There are some possible reasons for that:
* the soil parameters (now 50% of all calculations) of the previo...Currently the speed of MPR fell far behind that of its previous version that was part of the mHM code (ca. 50x for test basin). There are some possible reasons for that:
* the soil parameters (now 50% of all calculations) of the previous mHM were determined based on a lookup-table with soil classes and their properties and determined for existing classes only (read in of integer ascii grid)
* the (spatial) upscaling did not rely on weights, low-res cell boundaries needed to align with high-res boundaries
* 2D-upscaling was done in one go, other dimensions did not have missing values and were always at first positions in order of dimensions
which contrasts the new approach:
* we now do that fully distributed without prior classification (this also means, we read float arrays)
* we allow for non-aligned cell boundaries in high and low-resolution
* we allow for any order of dimensions and also allow missing values within all dimensions (e.g. a missing value in a soil horizon)
So the idea is to check the current code for bottlenecks and identify alternative algorithms. After that we might think about shortcuts that can be used in cases when data fulfill the requirements of mHM data (e.g. dimension order (x,y, remaining dim) and no missing values within a x,y-slice). I was wondering, how @schaefed might help us here?!
The scheme is currently as follows for the example of the case where TargetVar = SourceVar1 + SourceVar2
1. read in the SourceVar1 and SourceVar2
2. store the nDim-mask in a flat array, store the data a flat, packed array, store the dimensions
3. calculate temporary TargetVar (new data, use mask and dimension of SourceVars)
4. check for dimension order of TargetVar, if different than that of SourceVar, transpose temporary TargetVar
5. upscale each dimension individually (loop over the target dimensions)
* check if source dimension and target dimension differ (case1: no difference - continue, case2: source dim not existing - broadcast dimensions, case3: difference - upscale the dimension (see b)))
* compare dimensions, for each target dim id: calculate vector of source dim ids, vector of weights for source dim ids, number of subcells (if same pair of dimensions were used before, skip and use previous information)
* re-insert missing data in 1D flat data array (so has same shape with 1D flat mask), initialize empty missing_value_weight array in same shape
* loop over the n data chunks (n is the product of dimension sizes after the current dimension)
* reshape to 2D and transpose each chunk (new shape is (size of dimension, product of sizes after the before current dimension))
* loop now over 2nd dim, resulting vector is then a slice with the length of our current dimension
* if this vector contains nans, recalculate basic dimension weights, ids and subcells (see 5b) and missing_value_weight
h) loop over target cells and apply upscaling function, yield new dataNext major releaseRobert SchweppeRobert Schweppe