GIS ArcMap Raster Calculator with a python code

How could a planet have erratic days?

Why Shazam when there is already Superman?

Do the primes contain an infinite almost arithmetic progression?

Why can Carol Danvers change her suit colours in the first place?

Is aluminum electrical wire used on aircraft?

How can mimic phobia be cured?

When were female captains banned from Starfleet?

Why does AES have exactly 10 rounds for a 128-bit key, 12 for 192 bits and 14 for a 256-bit key size?

Add big quotation marks inside my colorbox

Probability that THHT occurs in a sequence of 10 coin tosses

Hero deduces identity of a killer

Can disgust be a key component of horror?

Why is the "ls" command showing permissions of files in a FAT32 partition?

Multiplicative persistence

Fear of getting stuck on one programming language / technology that is not used in my country

Why is so much work done on numerical verification of the Riemann Hypothesis?

This is why we puzzle

What are the balance implications behind making invisible things auto-hide?

Invalid date error by date command

Lowest total scrabble score

Mixing PEX brands

How do you make your own symbol when Detexify fails?

Does the UK parliament need to pass secondary legislation to accept the Article 50 extension

Why is this estimator biased?



GIS ArcMap Raster Calculator with a python code














0















I'm trying use raster calculator that can export a raster to do different average values for for multiple layers. For example, I want to do averages for only the values and layers that are greater than 0. I'm trying to input a python code but it keeps failing. Here is a video where I try and explain my project if you guys need more context. https://www.youtube.com/watch?v=bt6ecPGjjDA&t=24s



Here is the python code that won't work. Maybe this is too simple for what I'm trying to accomplish.



Please any feedback will greatly help me! Super desperate for solutions at this point.






import arcpy
... from arcpy.sa import *
... f1 = arcpy.Raster("S:/npenme2/FaunalyzeFeature_KB3_Right_Radius_14497/value")
... f2 = arcpy.Raster("S:/npenme2/FaunalyzeFeature_KB1_Right_Radius_14471_RC11/value")
... f3 = arcpy.Raster("S:/npenme2/FaunalyzeFeature_KB4_Right_Radius_14510/value")
... if value > 1:
... outraster = (f1 + f2 + f3)/3
... else:
... outraster = (f1 + f2 +f3)/3 - 1
...
...
... outraster.save("S:/npenme2/Faunalyze/rasterCalc")
...
Parsing error IndentationError: expected an indented block (line 7)












share







New contributor




Neharika Penmetcha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • I've also tried SQL on the actual raster calculator tool with this query. But it too does not work: Con("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11">0,(("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11")/3), ("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11")/3-1))

    – Neharika Penmetcha
    47 secs ago


















0















I'm trying use raster calculator that can export a raster to do different average values for for multiple layers. For example, I want to do averages for only the values and layers that are greater than 0. I'm trying to input a python code but it keeps failing. Here is a video where I try and explain my project if you guys need more context. https://www.youtube.com/watch?v=bt6ecPGjjDA&t=24s



Here is the python code that won't work. Maybe this is too simple for what I'm trying to accomplish.



Please any feedback will greatly help me! Super desperate for solutions at this point.






import arcpy
... from arcpy.sa import *
... f1 = arcpy.Raster("S:/npenme2/FaunalyzeFeature_KB3_Right_Radius_14497/value")
... f2 = arcpy.Raster("S:/npenme2/FaunalyzeFeature_KB1_Right_Radius_14471_RC11/value")
... f3 = arcpy.Raster("S:/npenme2/FaunalyzeFeature_KB4_Right_Radius_14510/value")
... if value > 1:
... outraster = (f1 + f2 + f3)/3
... else:
... outraster = (f1 + f2 +f3)/3 - 1
...
...
... outraster.save("S:/npenme2/Faunalyze/rasterCalc")
...
Parsing error IndentationError: expected an indented block (line 7)












share







New contributor




Neharika Penmetcha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • I've also tried SQL on the actual raster calculator tool with this query. But it too does not work: Con("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11">0,(("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11")/3), ("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11")/3-1))

    – Neharika Penmetcha
    47 secs ago
















0












0








0








I'm trying use raster calculator that can export a raster to do different average values for for multiple layers. For example, I want to do averages for only the values and layers that are greater than 0. I'm trying to input a python code but it keeps failing. Here is a video where I try and explain my project if you guys need more context. https://www.youtube.com/watch?v=bt6ecPGjjDA&t=24s



Here is the python code that won't work. Maybe this is too simple for what I'm trying to accomplish.



Please any feedback will greatly help me! Super desperate for solutions at this point.






import arcpy
... from arcpy.sa import *
... f1 = arcpy.Raster("S:/npenme2/FaunalyzeFeature_KB3_Right_Radius_14497/value")
... f2 = arcpy.Raster("S:/npenme2/FaunalyzeFeature_KB1_Right_Radius_14471_RC11/value")
... f3 = arcpy.Raster("S:/npenme2/FaunalyzeFeature_KB4_Right_Radius_14510/value")
... if value > 1:
... outraster = (f1 + f2 + f3)/3
... else:
... outraster = (f1 + f2 +f3)/3 - 1
...
...
... outraster.save("S:/npenme2/Faunalyze/rasterCalc")
...
Parsing error IndentationError: expected an indented block (line 7)












share







New contributor




Neharika Penmetcha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I'm trying use raster calculator that can export a raster to do different average values for for multiple layers. For example, I want to do averages for only the values and layers that are greater than 0. I'm trying to input a python code but it keeps failing. Here is a video where I try and explain my project if you guys need more context. https://www.youtube.com/watch?v=bt6ecPGjjDA&t=24s



Here is the python code that won't work. Maybe this is too simple for what I'm trying to accomplish.



Please any feedback will greatly help me! Super desperate for solutions at this point.






import arcpy
... from arcpy.sa import *
... f1 = arcpy.Raster("S:/npenme2/FaunalyzeFeature_KB3_Right_Radius_14497/value")
... f2 = arcpy.Raster("S:/npenme2/FaunalyzeFeature_KB1_Right_Radius_14471_RC11/value")
... f3 = arcpy.Raster("S:/npenme2/FaunalyzeFeature_KB4_Right_Radius_14510/value")
... if value > 1:
... outraster = (f1 + f2 + f3)/3
... else:
... outraster = (f1 + f2 +f3)/3 - 1
...
...
... outraster.save("S:/npenme2/Faunalyze/rasterCalc")
...
Parsing error IndentationError: expected an indented block (line 7)










arcgis-desktop arcpy raster-calculator





share







New contributor




Neharika Penmetcha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share







New contributor




Neharika Penmetcha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share



share






New contributor




Neharika Penmetcha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 mins ago









Neharika PenmetchaNeharika Penmetcha

1




1




New contributor




Neharika Penmetcha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Neharika Penmetcha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Neharika Penmetcha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • I've also tried SQL on the actual raster calculator tool with this query. But it too does not work: Con("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11">0,(("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11")/3), ("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11")/3-1))

    – Neharika Penmetcha
    47 secs ago





















  • I've also tried SQL on the actual raster calculator tool with this query. But it too does not work: Con("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11">0,(("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11")/3), ("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11")/3-1))

    – Neharika Penmetcha
    47 secs ago



















I've also tried SQL on the actual raster calculator tool with this query. But it too does not work: Con("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11">0,(("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11")/3), ("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11")/3-1))

– Neharika Penmetcha
47 secs ago







I've also tried SQL on the actual raster calculator tool with this query. But it too does not work: Con("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11">0,(("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11")/3), ("Feature_KB3_Right_Radius_14497" + "Feature_KB4_Right_Radius_14510" + "Feature_KB1_Right_Radius_14471_RC11")/3-1))

– Neharika Penmetcha
47 secs ago












0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Neharika Penmetcha is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f316420%2fgis-arcmap-raster-calculator-with-a-python-code%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








Neharika Penmetcha is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Neharika Penmetcha is a new contributor. Be nice, and check out our Code of Conduct.













Neharika Penmetcha is a new contributor. Be nice, and check out our Code of Conduct.












Neharika Penmetcha is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f316420%2fgis-arcmap-raster-calculator-with-a-python-code%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Щит и меч (фильм) Содержание Названия серий | Сюжет |...

is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

Meter-Bus Содержание Параметры шины | Стандартизация |...