Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stretching with nb of standard deviation: always min = max = 0 #14808

Closed
qgib opened this issue Feb 16, 2012 · 5 comments
Closed

stretching with nb of standard deviation: always min = max = 0 #14808

qgib opened this issue Feb 16, 2012 · 5 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Rasters Related to general raster layer handling (not specific data formats)
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Feb 16, 2012

Author Name: alobo - (alobo -)
Original Redmine Issue: 5035
Affected QGIS version: master
Redmine category:rasters


I have an image for which selecting "Use standard deviation"
always results into min and max equal to 0
Is this perhaps because it is float 32 or because of some negative values?
According to R, the actual summaries for each band are:
1 2 3 4 5 6
Min. -3.00 -3.00 -3.0 -3.00 -3.00 -3.00
1st Qu. 67.00 3.00 3.0 4.00 10.00 16.00
Median 84.00 4.00 4.0 4.00 17.00 24.00
Mean 79.78 10.29 14.5 19.05 26.71 26.86
3rd Qu. 97.00 5.00 17.0 18.00 34.00 35.00
Max. 219.00 215.00 234.0 255.00 221.00 178.00

image here:
https://sites.google.com/site/openfiles2/home/Ilerfly125v2geoarcgis2.tif

using ubuntu 10.04
qgis 1.7.3

@qgib
Copy link
Contributor Author

qgib commented Feb 16, 2012

Author Name: Leyan Ouyang (Leyan Ouyang)


The direct link to the file is not accessible, the file can be accessed from there though : https://sites.google.com/site/openfiles2/home

Actually, the problem lies within your file itself. Qgis will read GDAL metadata when they are available, and here your metadata indicate a mean and a standard deviation both equal to zero. This means Qgis will calculate min and max values based on this bogus information and obtain 0.

@qgib
Copy link
Contributor Author

qgib commented Apr 16, 2012

Author Name: Paolo Cavallini (@pcav)


  • fixed_version_id was changed from Version 1.7.4 to Version 1.8.0

@qgib
Copy link
Contributor Author

qgib commented Aug 10, 2012

Author Name: alobo - (alobo -)


Confirmed the problem of the erroneous stats in the GTif files with several
examples.
These files are created in R through raster::writeRaster(),
which might be using rgdal. In such a case, the problem of these
GTif files with wrong stats could be caused by gdal and be more
widespread. I'm inquiring the author of raster in R and the R sig-geo list.
Anyway, QGIS should have the option of re-calculating the stats.
I would keep this ticket open until I find out more details in the R list,
but this ticket should be closed soon. Another one for the optional stat calculation
should be opened.
Agus

@qgib
Copy link
Contributor Author

qgib commented Aug 10, 2012

Author Name: Giovanni Manghi (@gioman)


Agus,

rasters are under heavy development in qgis-master. I guess soon we must check every raster related ticket and see if the issue still valid.

alobo - wrote:

Confirmed the problem of the erroneous stats in the GTif files with several
examples.
These files are created in R through raster::writeRaster(),
which might be using rgdal. In such a case, the problem of these
GTif files with wrong stats could be caused by gdal and be more
widespread. I'm inquiring the author of raster in R and the R sig-geo list.
Anyway, QGIS should have the option of re-calculating the stats.
I would keep this ticket open until I find out more details in the R list,
but this ticket should be closed soon. Another one for the optional stat calculation
should be opened.
Agus

@qgib
Copy link
Contributor Author

qgib commented Aug 27, 2012

Author Name: alobo - (alobo -)


Confirmed in the R list that the problem is caused by R
writing GTiff files that have erroneous stats info (writeRaster()
used to set the mean and sd values always to 0).
This has been changed for moderately sized layers, which are written with
correct stats now, but very
large layers still get wrong mean and sd (written now
as NaN). By some reason the developer is reluctant to leave
this info empty, which is what gdalinfo -stats would like:
from http://www.gdal.org/gdalinfo.html :

DESCRIPTION

The gdalinfo program lists various information about a GDAL supported
raster dataset.

-mm
Force computation of the actual min/max values for each band in the dataset.
-stats
Read and display image statistics. Force computation if no statistics
are stored in an image.

Anyway, this ticket has to be closed.
I open a new one asking for the feature of having a button to recalculate stats: qgis cannot rely
on external info being always correct.


  • status_id was changed from Open to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Rasters Related to general raster layer handling (not specific data formats) labels May 24, 2019
@qgib qgib added this to the Version 1.8.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Rasters Related to general raster layer handling (not specific data formats)
Projects
None yet
Development

No branches or pull requests

1 participant