I'm working with MOD-16-evapotranspiration and I have a problem. I made a composition 180 bands, but in this images I have predefined high values(such as 32767, 32765..). So, I would like to hide this values for all 180 bands. I'm working with QGIS software.
-
Welcome to GIS SE. Please, take the tour and edit your answer. You need to select which software are you using/asking. What have you tried so far? In QGIS you can use SCP; in ArcGIS, raster calculator; in ENVI, mask creation, and so on...– aldo_tapiaCommented Aug 23, 2017 at 14:49
-
Tks aldo_tapia..I edited my question!!– Bruno RodriguesCommented Aug 23, 2017 at 15:00
-
Can you upload a sample data? a small crop could be great– aldo_tapiaCommented Aug 23, 2017 at 15:20
-
What do you mean by "delete values"? You can't delete pixels from a raster. The best you can do is hide them...– Logan ByersCommented Aug 23, 2017 at 15:22
-
aldo_tapia. So, I have only image (180 bands). This archive is .tif (109MB). Do you want me to send it?here I can send ?– Bruno RodriguesCommented Aug 23, 2017 at 16:23
1 Answer
This is achievable using gdal_calc.py
, which should be accessible if you have Qgis installed.
The basic format of the gdal_calc.py
call would be:
gdal_calc.py -A path_to_raster --allBands=A \
--calc="A * (A < threshold) + nodata * (A >= threshold)" \
--outfile=path_to_new_raster --NoDataValue=nodata
where:
threshold
is a value above which the data will be hidden
nodata
is the value that will be written to the masked pixels
The calc
option may need to be more complex than this if you already have NoData
values in the raster, but you should be able to understand the logic. The boolean results within the calc
argument are essentially 1 and 0 which makes the multiplication work.
See also this question which shows some more advance logic.
-
In this case I can't for example consider the nodata values = 0 or 1 (or other specific value) , because when I extract to average of bands, I will have problems (I extract the values in the software ENVI)... The ideal would be use NoDataValue=-999 but I don't know if can. I would need mask the values to that they do not enter in the average. I already maked in the matlab a transformation to zero, but found this problem... Commented Aug 23, 2017 at 19:01
-
In GIS software, NODATA values are usually excluded from any raster calculation internally. You just have to tell the software which values to treat as NODATA.
gdal_translate -a_nodata
is one method to do so. You can use the raster calculator to merge several NODATA into one single value.– AndreJCommented Aug 24, 2017 at 13:00