current version 1.2 - 24th Jan 2020
version | date | comment |
---|---|---|
1.0 | 19/Dec/2016 | routines moved from GridOperations module |
1.1 | 04/Sep/2018 | GetCV to compute coefficient of variation of a grid |
1.2 | 24/Jan/2020 | Added subroutine UniqueValues to retrieve a list of distinct values from a grid_integer |
license: GNU GPL http://www.gnu.org/licenses/
This file is part of
MOSAICO -- MOdular library for raSter bAsed hydrologIcal appliCatiOn.
Copyright (C) 2011 Giovanni Ravazzani
library to compute grids statistics
count number of cells different from nodata
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid |
count number of cells different from nodata
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid |
compute mean Bias between two grids real
optional argument:
mask
: compute Bias only on assigned mask
rbias
: compute relative Bias
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid1 | |||
type(grid_real), | intent(in) | :: | grid2 | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger | ||
logical, | intent(in), | optional | :: | rbias |
compute coefficient of variation of grid_real eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute maximum of grid_real eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute maximum of grid_integer eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute mean of grid_real eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute mean of grid_integer eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute minimum of grid_real eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute minimum of grid_integer eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute Nash and Sutcliffe efficiency index, equivalent to
coefficient of determination.
optional argument:
mask
: compute RMSE only on assigned mask
nrmse
: compute normalized Nash efficiency
References:
Nash, J. E. and J. V. Sutcliffe (1970), River flow forecasting through
conceptual models part I — A discussion of principles, Journal of Hydrology,
10 (3), 282–290.
Moriasi, D. N.; Arnold, J. G.; Van Liew, M. W.; Bingner,R. L.; Harmel, R. D.;
Veith, T. L. (2007), "Model Evaluation Guidelines for Systematic Quantification
of Accuracy in Watershed Simulations", Transactions of the ASABE, 50 (3), 885–900.
http://swat.tamu.edu/media/1312/moriasimodeleval.pdf
Nossent, J., Bauwens, W., Application of a normalized Nash-Sutcliffe efficiency
to improve the accuracy of the Sobol’ sensitivity analysis of a hydrological model
Geophysical Research Abstracts Vol. 14, EGU2012-237, 2012 EGU General Assembly 2012
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid1 | |||
type(grid_real), | intent(in) | :: | grid2 | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger | ||
logical, | intent(in), | optional | :: | normalized |
compute R2, square of the Pearson correlation coefficient
optional argument:
mask
: compute RMSE only on assigned mask
References:
Karl Pearson (20 June 1895) "Notes on regression and inheritance in
the case of two parents," Proceedings of the Royal Society of
London, 58 : 240–242
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid1 | |||
type(grid_real), | intent(in) | :: | grid2 | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute Root Mean Square Error between two grids real
optional argument:
mask
: compute RMSE only on assigned mask
nrmse
: compute Normalizes Root Mean Square Error
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid1 | |||
type(grid_real), | intent(in) | :: | grid2 | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger | ||
logical, | intent(in), | optional | :: | nrmse |
compute unbiased standard deviation of grid_real optionally constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute unbiased standard deviation of grid_integer optionally constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute sum of grid_real eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute sum of grid_integer eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
performs a linear transformation on the original data values.
Suppose that minX
and maxX
are the minimum and maximum of feature X.
We would like to map interval [minX, maxX]
into a new interval
[new_minX, new_maxX]
. Consequently, every value v
from the original
interval will be mapped into value new_v
following formula:
new_v = (v - minX) / (maxX - minX) * (new_maxX - new_minX) + new_minX
If new_minX
and new_maxX
are not given values are mapped
to [0,1]
interval
References:
Hann, J., Kamber, M. (2000). Data Mining: Concepts and Techniques.
Morgan Kaufman Publishers.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | gridIn | |||
type(grid_real), | intent(inout) | :: | gridOut | |||
real(kind=float), | intent(in), | optional | :: | min | ||
real(kind=float), | intent(in), | optional | :: | max |
Description return a vector of distinct values from a grid_integer
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid | |||
integer(kind=short), | intent(out), | ALLOCATABLE | :: | values(:) |
compute coefficient of variation of grid_real eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute Nash and Sutcliffe efficiency index, equivalent to
coefficient of determination.
optional argument:
mask
: compute RMSE only on assigned mask
nrmse
: compute normalized Nash efficiency
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid1 | |||
type(grid_real), | intent(in) | :: | grid2 | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger | ||
logical, | intent(in), | optional | :: | normalized |
count number of cells different from nodata
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid |
count number of cells different from nodata
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid |
compute mean Bias between two grids real
optional argument:
mask
: compute Bias only on assigned mask
rbias
: compute relative Bias
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid1 | |||
type(grid_real), | intent(in) | :: | grid2 | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger | ||
logical, | intent(in), | optional | :: | rbias |
compute maximum of grid_real eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute maximum of grid_integer eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute mean of grid_real eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute mean of grid_integer eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute minimum of grid_real eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute minimum of grid_integer eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute R2, square of the Pearson correlation coefficient
optional argument:
mask
: compute RMSE only on assigned mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid1 | |||
type(grid_real), | intent(in) | :: | grid2 | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute Root Mean Square Error between two grids real
optional argument:
mask
: compute RMSE only on assigned mask
nrmse
: compute Normalizes Root Mean Square Error
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid1 | |||
type(grid_real), | intent(in) | :: | grid2 | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger | ||
logical, | intent(in), | optional | :: | nrmse |
compute unbiased standard deviation of grid_real optionally constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute unbiased standard deviation of grid_integer optionally constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute sum of grid_real eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
compute sum of grid_integer eventually constrained to a mask
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid | |||
type(grid_real), | intent(in), | optional | :: | maskReal | ||
type(grid_integer), | intent(in), | optional | :: | maskInteger |
Description return a vector of distinct values from a grid_integer
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid | |||
integer(kind=short), | intent(out), | ALLOCATABLE | :: | values(:) |
also called zero-mean normalization. The values of attribute X
are
normalized using the mean and standard deviation of X
. A new value
new_v
is obtained using the following expression:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | gridIn | |||
type(grid_real), | intent(inout) | :: | gridOut |
performs a linear transformation on the original data values.
Suppose that minX
and maxX
are the minimum and maximum of feature X.
We would like to map interval [minX, maxX]
into a new interval
[new_minX, new_maxX]
. Consequently, every value v
from the original
interval will be mapped into value new_v
following formula:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | gridIn | |||
type(grid_real), | intent(inout) | :: | gridOut | |||
real(kind=float), | intent(in), | optional | :: | min | ||
real(kind=float), | intent(in), | optional | :: | max |