I'm working with a satellite (SMAP) that has a temporal resolution of 3 days. So every day the sensor covers a portion of Brazil. I have the Geotiff files, but I need to calculate the mean values for the three images, but the mean will be calculated only for the pixels that overlap. In the end, I need a single image for the period of three days.

How can I do this?

In this link there is a file that contains the three images.

Here an example of one of these images:

Image 1

  • is there a specific nodata vlaue ? – radouxju Apr 26 '19 at 13:39
  • Hi, @radouxju. All the values (black boundaries) outside are no data values. Default is -9999, but I converted these values as no data. – Diêgo Araújo Apr 26 '19 at 13:43

you could use one of the raster calculator available in QGIS (QGIS raster calculator, gdal_calc, otbBandMath...), even if it could be long to write with more images. Don't work with the nodata values but directly with the original raster -9999 . The following syntax is for the "raster > raster calculator" and is based on the fact that boolean tests are translated into 0 (false) or 1 (true)

((im1@1>-9999)*im1@1 + (im2@1>-9999)*im2@1  + (im3@1>-9999)*im3@1 ) / ((im1@1>-9999)+ (im2@1>-9999)  + (im3@1>-9999) )
| improve this answer | |

My two cents just about how to deal with different extents:

(Option 1) QGIS Align Rasters

  • QGIS > Raster > Align Rasters
  • Select one of your rasters as the reference
  • All rasters, including reference raster, will be modified somewhat.
  • You will likely lose one of row/column of the original set.

(Option 2) Reproject rasters

  • QGIS > Raster > Projection > Warp
  • It will change their CRS, and you will need to select appropriate CRS.
  • All rasters will change but best option for your further analysis.

(Option 3) OTB (Orfeo Toolbox)

  • OTB (or Monteverdi) > Superimpose
  • It will align the data to fit with reference raster accurately. Reference raster stays unchanged.
  • We do not have to change CRS.

I would recommend OTB, but it may depend on how you proceed with your further analysis.

Anyway, once your rasters are aligned, you can start calculation following the answer by radouxju.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.