<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-script/m-p/315997#M24586</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear Experts,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am new to this forum and want your help to solve my problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using ArcGIS 10 and my problem states as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a set of 46 monthly rainfall rasters&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. i want to extract the maximum and minimum pixel value from the the stack of 46 raster as MAX and MIN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Then using the equation shown in attached figure [ATTACH=CONFIG]25149[/ATTACH] I have to calculate the cumulative probability of each x&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. where x is each individual raster (total 46) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. I have already calculated the values of "a" also in the form of a raster and would like the program to pick these values from that respective raster. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5. The summation equation should run from n=1 to n=Max repeatedly &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would highly appreciate of a python expert who writes a few lines script for me to solve this&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 08 Jun 2013 07:26:39 GMT</pubDate>
    <dc:creator>WaqasAhmad</dc:creator>
    <dc:date>2013-06-08T07:26:39Z</dc:date>
    <item>
      <title>Python script</title>
      <link>https://community.esri.com/t5/python-questions/python-script/m-p/315997#M24586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear Experts,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am new to this forum and want your help to solve my problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using ArcGIS 10 and my problem states as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a set of 46 monthly rainfall rasters&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. i want to extract the maximum and minimum pixel value from the the stack of 46 raster as MAX and MIN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Then using the equation shown in attached figure [ATTACH=CONFIG]25149[/ATTACH] I have to calculate the cumulative probability of each x&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. where x is each individual raster (total 46) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. I have already calculated the values of "a" also in the form of a raster and would like the program to pick these values from that respective raster. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5. The summation equation should run from n=1 to n=Max repeatedly &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would highly appreciate of a python expert who writes a few lines script for me to solve this&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Jun 2013 07:26:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script/m-p/315997#M24586</guid>
      <dc:creator>WaqasAhmad</dc:creator>
      <dc:date>2013-06-08T07:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python script</title>
      <link>https://community.esri.com/t5/python-questions/python-script/m-p/315998#M24587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One way would be to get raster properties, but, of course, you need to make sure that the raster datasets all have staticstics calculated first.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure if there is a faster way, as getrasterproperties is not the "fastest" method around.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy


arcpy.env.workspace = "\\\\mcflight01\\MCFlightData\\HGIS\\Data\\imagery.gdb"

rasters = arcpy.ListRasters("*", "All")



for raster in rasters:

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Get Raster Properties
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; min = arcpy.GetRasterProperties_management(raster, "MINIMUM", "")

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Get Raster Properties (2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max = arcpy.GetRasterProperties_management(raster, "MAXIMUM", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "max for ",str(raster)," = ", max
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "min for ",str(raster)," = ", min&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The above code will list all raster data sets in the workspace, then iterate through them and print out the max/min for each dataset that has statistics.&amp;nbsp; Might want to run a separate script to calculate the statistics, as it is pretty time intesive, and would not need to be run each time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You would put the math that you need here where the print statements are, and&amp;nbsp; it should perform your equation on each raster dataset in the workspace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:01:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script/m-p/315998#M24587</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T15:01:44Z</dc:date>
    </item>
  </channel>
</rss>

