3

I have 10 singleband rasters of the snow cover extent (1 raster/day from 1st of December to 10th of December). I have to create a composite image that merges all of them. I tried the r.composite tool from GRASS and the Build Virtual Raster tool, but I don't really understand the results. The raster values are from 20 to 200:

20 - sea, 21 - lake, 22 - river, 30 - cloud, 100-200 - % of the SCE (example: 154 = 54% snow cover).

One of the input rasters:

One of the input rasters.

4
  • It is difficult to understand the coding used. "20 - sea, 21 - lake, 22 - river, 30 - cloud," seems clear, but 100-200% for snow cover extent is confusing. What if the snow is on land, or on a lake, etc?
    – wingnut
    Commented Apr 22, 2021 at 8:48
  • This is the standard coding used. I didn't come up with it. The water bodies are separate because snow can't form on their surface. For the 100-200 interval just remove the first number (100 = 0%, 101 = 1%, etc.). Obviously, 100 is for clear land. The physical values are calculated like this: PV (physical value) = Scaling (in this case the scaling is 1) * DN (digital number or the pixel value) + OFFSET (in my case the OFFSET = -100). This is how you calculate the real value of the snow covering extent (example: If the pixel value is 105, the physical value would be 1 * 105 - 100 = 5%). Commented Apr 22, 2021 at 9:03
  • OK, so all rasters have the same thing. If you Build a virtual raster, it should be straightforward. What sort of problems are you having? Maybe you can post an image of the dialog in your question.
    – wingnut
    Commented Apr 22, 2021 at 9:53
  • I'm trying to create something like this and I don't really know how land.copernicus.eu/global/sites/cgls.vito.be/files/images/… Commented Apr 22, 2021 at 10:14

1 Answer 1

3

It must be the mean SCE for each pixel over the 10-day period.

Raster values may or may not indicate snow (they could be land/water etc.)

An approach could be:

  1. Remove all non-snow values (water, land, etc). This can be done by Raster Calculator with an expression:

    (raster1@1 > 100) * raster1@1
    

    That should change any value below 101 to 0. 100 means "no land, no water, no snow", which seems impossible.

  2. Take the mean of all 10 layers. This can all be done in one expression in the Raster Calculator:

    ((raster1@1 > 100) * raster1@1 
        + (raster2@1 > 100) * raster2@1 
        + ... 
        + (raster10@1 > 100) * raster10@1) / 10.0
    

That should create a layer with a single band that contains the mean SCE for the 10-day period (and nothing else). When displaying, set the nodata value as zero, so it will be transparent unless there is snow.

2
  • 1
    It worked! Thank you for your time! Commented Apr 22, 2021 at 11:04
  • Welcome. Raster math is not as flexible as choosing but can be useful.
    – wingnut
    Commented Apr 22, 2021 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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