python-rasterstats icon indicating copy to clipboard operation
python-rasterstats copied to clipboard

working with skewness and kurtosis

Open adbedada opened this issue 7 years ago • 0 comments

I added median and quantile, skew and kurtosis as user-defined statistics and computed zonal stats. Everything was fine except when the values for Kurtosis and Skew come out as pixels rather than summary statistics.

This is what the normal summary looks like:

ndvi_mean | ndvi_median | ndvi_quantile | ndvi_std | ndvi_sum 
 -------- | ----------- | ------------- | -------- | -------
0.1173739 | 0.07708483  | 0.07708483    | 0.1036502 | 162.9150543

But, for the same unique id(polygon), this how kurtosis came out:

ndvi_kurtosis
--
[   7.2871666   6.4574842   4.545536      1.9052649   0.5683825   0.3487389       0.73439574  0.01379848 -0.40229535  0.62544775    1.2847929   0.94005585      -0.0924437  -0.3578236     0.04941273  0.41128254  0.6559658     0.53240824       0.52538943  0.6125426     0.7319937   0.90117955  0.7933278    -0.17031956      -1.2125666  -1.4599657    -1.3975773  -1.4106083  -1.5019561    -1.2848983      -0.47377467 -0.04034615  0.12913847    0.8946681   2.3754587   2.735443       2.282404    1.7326574   0.8231995     0.27050138 -0.3120227    -0.24505758       0.7190125   2.1337805     3.5637045   2.8174086   0.10059285    2.4114866       2.1177316  -0.6664858    -0.23420167 -0.10322618 -0.17803192    0.33013797       0.2244544   0.5349238     2.5493274 ]

and the skew:


ndvi_skew
--
[2.8627324  2.6958673    2.2113113  1.5110123  1.0959401    0.9269479      1.0562122  0.85230273 0.77119476 1.1554915  1.2901933    1.213998      1.0799994  0.5642529    0.8642709  1.0981338  1.1922108    1.2518076      1.3611073  1.4395812    1.4840711  1.5201237  1.3969011    1.0235996      0.6260989  0.5466465    0.60058576 0.6061227  0.52846354   0.5695992      0.9228256  1.1826196    1.1925156  1.3223015  1.6849962    1.7787021      1.6754463  1.4728421    1.2691303  1.1623998  0.94363064 1.0182533      1.3077686  1.590586     1.854989   1.6915274  0.890955     1.2706145      1.5660229  0.8015226    0.66329956 0.7856815    0.6609193  0.84774077      0.46438545 0.90603274 1.6700934 ]


It would be useful, at least in my case, if the value for skew and kurtosis is a summary as it the case for the base stats as well as for quantile and median. How can I do this?

The test dataset and the csv output can be found here: https://drive.google.com/file/d/1EbxyFhBb2O_umQBdscpu00FHBElQTzTv/view?usp=sharing

note: median and quantile require numpy>=1.15

adbedada avatar Feb 17 '19 20:02 adbedada