Hello,
is it possible to combine 2 rasters with the raster calculator defining the value of the rasters? It should look more or less like this but at the moment i'm getting an error for the expression.
Thanks for answers
So what Dan is explaining, you could use:
Con("AlnusSpp" + "BetulaSpp" > 20, "AlnusSpp")<SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
... in case you want to create a new raster with the original values of "AlnusSpp" where the sum of "AlnusSpp" and "BetulaSpp" is higher than 20 (rest of the pixels in this case will be assigned NoData)
And you can use:
Con("AlnusSpp" + "BetulaSpp" > 20,"BetulaSpp")<SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
... to create the same type of raster but now with the original values of "BetulaSpp" when the sum of the two raster is higher than 20 (rest of cells will be NoData)
Or you can use something like this:
Con("AlnusSpp" + "BetulaSpp" > 20,"AlnusSpp" + "BetulaSpp")<SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
... when you want to create a raster with the sum of the values of the two raster when the sum is higher than 20 (rest of cells will be NoData)
Can you try a Con statement like thois:
Con("AlnusSpp" + "BetulaSpp" > 20, 1, 0)
Thanks for the quick answer. This one works but I try to retain the exact values from the data and not the define them
as 1 or 0, because the exact values are important for further procedures.
Once you have your indicator array (the 1's) you use that array/raster to extract all the locations where a 1 is found.
In essence 1 indicates the locations where the sum of the two rasters is > 20. Use the 1's to extract the values. from the 2 input rasters.
The last one is exactly the one I needed, thank you very much!
One last question: Overall I got 9 species and want to create a raster where at least 2 or more of the species with >20 are displayed, is there maybe one expression for it?
Or is it possible to combine expressions maybe like this:
Con("AlnusSpp" + "CarpinusSpp" > 20,"AlnusSpp" + "CarpinusSpp")<CODE>Con("AlnusSpp" + "BetulaSpp" > 20,"AlnusSpp" + "BetulaSpp") OR
Con("AlnusSpp" + "CarpinusSpp" > 20,"AlnusSpp" + "CarpinusSpp")
You could try
SetNull(("AlnusSpp" + "BetulaSpp" )<= 20, ("AlnusSpp" + "BetulaSpp"))
Thanks for the script, I will try it.
In general I was trying to create a map that shows a 'Mixed Forest' containing the particular species. So there have to be at least 2 species ( or more - with >20) in one grid. Isn't there another solution or tool for this one?
There are multiple conditions Felix, to handle them all it requires you break things down into steps. separating mixed forest is one, With one species, that can be handled by a single Con statement. It is the multiple conditions that necessitate the many steps.
Hence Xander's last lines in his script looping through the species and doing the Con
In addition to what Dan Patterson mentioned, in case a "Mixed Forest" requires the existence of more than 1 species and a certain value (>20, is this % coverage?) a situation o 0% of one species and 30% of another will yield a value > 20, but does not mean that there are actually two or more species.
Apart from validating "AlnusSpp" + "BetulaSpp" and "AlnusSpp" + "CarpinusSpp", the script will not validate "BetulaSpp" + "CarpinusSpp" nor "AlnusSpp" + "BetulaSpp" + "CarpinusSpp", when this may also yield a value > 20 and could represent mixed forest.
It could be better to create for instance a binary raster per species that represents its existence and sum those rasters. Those pixels that have a value of 2 or higher will have more than 1 species. Use a sum of all original rasters to validate the condition > 20.
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.