1

Is there a scientifically-valid to use raster calculator to subtract two binary images (0, 1) to get the difference between Pre- and Post flood events?

In pseudo-code:

Difference "change detection" = Post-event flood event (1,0) - Pre-event flood event (1,0)

I tried it and got difference map, but I want to make sure it is valid method.

There are 4 possible cases:

  1. recorded flood events in the post- and pre-images and the result would be (1-1=0), 2
  2. flood event in the post-image and no flood in the pre-image, and the result would be (1-0=1),
  3. non-flood in the post-image and flood in the pre-image, and the result would be (0-1=-1),
  4. non-flood in both post-and pre-images, so the result would be (0-0=0).

The main concern around the interpretation of the third case.

9
  • What do you mean by OK? Are you asking if it will throw errors? Or are you asking if the results will be valid? If the former: try it yourself and find out. If the latter, create a small test case (say 5 pixels by 5 pixels) and verify the results by hand.
    – Paul H
    Sep 18, 2019 at 22:10
  • You are right, I mean is it valid or not. Actually I tried it and got difference map but I want to make sure if it is valid method. I mean there shold be 4 possible cases:
    – user150625
    Sep 18, 2019 at 22:14
  • What is your concern with the third case?
    – Paul H
    Sep 18, 2019 at 22:43
  • How it could be interpreted, particularly there is no water bodies or lakes in the area
    – user150625
    Sep 18, 2019 at 23:18
  • Use combine, to cover all 4 cases. Perhaps assign 0 to dry land, if not already.
    – FelixIP
    Sep 18, 2019 at 23:51

1 Answer 1

1

This is what combined raster table looks like: enter image description here

So Value of 1 corresponds to dry land before and after; 2 - was dry become flooded etc.

Alternatively one can use fact that sum of any two numbers in range (0,1,2,4,8..) gives unique combination. Those who used paper tapes for coding will understand this real quick:) So you can do:

arcpy.gp.RasterCalculator_sa('("AFTER"+1)*2', "C:/SCRATCH/SCRATCH.gdb/Reclass")
arcpy.gp.RasterCalculator_sa('"BEFORE" + "Reclass"', "C:/SCRATCH/SCRATCH.gdb/fromReclass")

Reclass raster will store values of 2 - dry and 4 - wet. Output of sum:

enter image description here

Where value of 2 (0+2) is dry/dry, 5 (1+4) is wet/wet.

Your Answer

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

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