<?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 Re: Calculate daily average of raster files based on their names in python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443248#M34699</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;These are samples of the data.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;SMAP_L4_SM_gph_&lt;STRONG&gt;20150331T043000&lt;/STRONG&gt;_Vv2030_001_Geophysical_Data_sm_surface_&lt;STRONG&gt;bdea9c15&lt;/STRONG&gt;.tif 
SMAP_L4_SM_gph_&lt;STRONG&gt;20161231T223000&lt;/STRONG&gt;_Vv2030_001_Geophysical_Data_sm_surface_&lt;STRONG&gt;352ca87d&lt;/STRONG&gt;.tif
SMAP_L4_SM_gph_&lt;STRONG&gt;20170104T043000_&lt;/STRONG&gt;Vv2030_001_Geophysical_Data_sm_surface_&lt;STRONG&gt;616d799c&lt;/STRONG&gt;.tif&lt;/PRE&gt;&lt;P&gt;In addition to the date (year, month, day) which are different, the letters&amp;nbsp;in the last part of the name (before .tif) are different.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 19:49:29 GMT</pubDate>
    <dc:creator>AmenehTavakol</dc:creator>
    <dc:date>2021-12-11T19:49:29Z</dc:date>
    <item>
      <title>Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443239#M34690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;I have hundreds&amp;nbsp;of SMAP soil moisture data and need to calculate the daily average of them. For every day there are 8 files (every 3 hours) and I need a code to calculate the average based on their names.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I have a code but i am interested to know how can I define a code that average data based on their names?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #808080;"&gt;# Import arcpy module
&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;import &lt;/SPAN&gt;arcpy


&lt;SPAN style="color: #808080;"&gt;# Local variables:
&lt;/SPAN&gt;SMAP_L4_SM_gph_20150331T043000_Vv2030_001_Geophysical_Data_sm_surface_bdea9c15_tif = &lt;SPAN style="color: #008000;"&gt;"SMAP_L4_SM_gph_20150331T043000_Vv2030_001_Geophysical_Data_sm_surface_bdea9c15.tif"
&lt;/SPAN&gt;SMAP_L4_SM_gph_20150331T073000_Vv2030_001_Geophysical_Data_sm_surface_bdea9c0d_tif = &lt;SPAN style="color: #008000;"&gt;"SMAP_L4_SM_gph_20150331T073000_Vv2030_001_Geophysical_Data_sm_surface_bdea9c0d.tif"
&lt;/SPAN&gt;SMAP_L4_SM_gph_20150331T103000_Vv2030_001_Geophysical_Data_sm_surface_bdea9c14_tif = &lt;SPAN style="color: #008000;"&gt;"SMAP_L4_SM_gph_20150331T103000_Vv2030_001_Geophysical_Data_sm_surface_bdea9c14.tif"
&lt;/SPAN&gt;SMAP_L4_SM_gph_20150331T133000_Vv2030_001_Geophysical_Data_sm_surface_bdea9bf5_tif = &lt;SPAN style="color: #008000;"&gt;"SMAP_L4_SM_gph_20150331T133000_Vv2030_001_Geophysical_Data_sm_surface_bdea9bf5.tif"
&lt;/SPAN&gt;SMAP_L4_SM_gph_20150331T163000_Vv2030_001_Geophysical_Data_sm_surface_bdea9bf3_tif = &lt;SPAN style="color: #008000;"&gt;"SMAP_L4_SM_gph_20150331T163000_Vv2030_001_Geophysical_Data_sm_surface_bdea9bf3.tif"
&lt;/SPAN&gt;SMAP_L4_SM_gph_20150331T193000_Vv2030_001_Geophysical_Data_sm_surface_bdea9bf4_tif = &lt;SPAN style="color: #008000;"&gt;"SMAP_L4_SM_gph_20150331T193000_Vv2030_001_Geophysical_Data_sm_surface_bdea9bf4.tif"
&lt;/SPAN&gt;SMAP_L4_SM_gph_20150331T223000_Vv2030_001_Geophysical_Data_sm_surface_bdea9c0f_tif = &lt;SPAN style="color: #008000;"&gt;"SMAP_L4_SM_gph_20150331T223000_Vv2030_001_Geophysical_Data_sm_surface_bdea9c0f.tif"
&lt;/SPAN&gt;SMAP_L4_SM_gph_20150331T013000_Vv2030_001_Geophysical_Data_sm_surface_bdea9eb8_tif = &lt;SPAN style="color: #008000;"&gt;"SMAP_L4_SM_gph_20150331T013000_Vv2030_001_Geophysical_Data_sm_surface_bdea9eb8.tif"
&lt;/SPAN&gt;v_name_ = &lt;SPAN style="color: #008000;"&gt;"D:&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;NASA&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;Data&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;SMAP&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;2014&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;Processed&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;%name%.tif"
&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# Process: Raster Calculator
&lt;/SPAN&gt;arcpy.gp.RasterCalculator_sa(&lt;SPAN style="color: #008000;"&gt;"( &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;%SMAP_L4_SM_gph_20150331T043000_Vv2030_001_Geophysical_Data_sm_surface_bdea9c15.tif%&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt; + &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;%SMAP_L4_SM_gph_20150331T073000_Vv2030_001_Geophysical_Data_sm_surface_bdea9c0d.tif%&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt; + &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;%SMAP_L4_SM_gph_20150331T103000_Vv2030_001_Geophysical_Data_sm_surface_bdea9c14.tif%&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt; +&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;%SMAP_L4_SM_gph_20150331T133000_Vv2030_001_Geophysical_Data_sm_surface_bdea9bf5.tif%&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt; + &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;%SMAP_L4_SM_gph_20150331T163000_Vv2030_001_Geophysical_Data_sm_surface_bdea9bf3.tif%&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt; + &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;%SMAP_L4_SM_gph_20150331T193000_Vv2030_001_Geophysical_Data_sm_surface_bdea9bf4.tif%&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt; + &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;%SMAP_L4_SM_gph_20150331T223000_Vv2030_001_Geophysical_Data_sm_surface_bdea9c0f.tif%&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt; + &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;%SMAP_L4_SM_gph_20150331T013000_Vv2030_001_Geophysical_Data_sm_surface_bdea9eb8.tif%&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;) / 8"&lt;/SPAN&gt;, v_name_)


Your help is really appreciated.&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:49:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443239#M34690</guid>
      <dc:creator>AmenehTavakol</dc:creator>
      <dc:date>2021-12-11T19:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443240#M34691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would it be easier to use the MEAN &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/get-raster-properties.htm"&gt;raster property&lt;/A&gt;&amp;nbsp;for each raster?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2017 22:21:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443240#M34691</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2017-06-13T22:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443241#M34692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually I need a raster file for every day (instead of 8 raster files for every day) which every pixel contains the average of soil moisture of the same pixel in 8&amp;nbsp;different time spells. By now, I can not define how arcpy identify files based on their name which contains the year month and year.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2017 22:37:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443241#M34692</guid>
      <dc:creator>AmenehTavakol</dc:creator>
      <dc:date>2017-06-13T22:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443242#M34693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you use raster properties to average the average of every raster for the day? In other words, loop over each raster for the day to grab its average and put it in a list, then average the list; like &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;&lt;A href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.mean.html"&gt;numpy.mean()&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Or are you also asking how to look at all these raster files and identify which ones are from the same day with the file name?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2017 22:43:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443242#M34693</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2017-06-13T22:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443243#M34694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you want to look into the &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/spatial-analyst-toolbox/cell-statistics.htm"&gt;Cell Statistics&lt;/A&gt; tool. The order doesn't matter, you could use &lt;A href="https://community.esri.com/group/1218"&gt;Model Builder&lt;/A&gt;‌ or Python (arcpy.ListRasters() or arcpy.da.Walk) to create your list of rasters and pass it to the tool.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2017 22:43:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443243#M34694</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-06-13T22:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443244#M34695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Exactly my question is&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;how to look at all these raster files and identify which ones are from the same day with the file name? and write a code that can define data by days and average the according to every day.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2017 22:46:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443244#M34695</guid>
      <dc:creator>AmenehTavakol</dc:creator>
      <dc:date>2017-06-13T22:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443245#M34696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have an example of the code. I am very new in python so your help is really appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2017 22:49:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443245#M34696</guid>
      <dc:creator>AmenehTavakol</dc:creator>
      <dc:date>2017-06-13T22:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443246#M34697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the prefix and suffix of the filenames (the stuff before and after the date) always the same? If not, is the length the same? What are the rules on how those are generated?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2017 22:51:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443246#M34697</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2017-06-13T22:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443247#M34698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are code samples in the help&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/arcpy/functions/listfeatureclasses.htm" title="http://pro.arcgis.com/en/pro-app/arcpy/functions/listfeatureclasses.htm"&gt;ListFeatureClasses—ArcPy Functions | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-data-access/walk.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-data-access/walk.htm"&gt;Walk—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2017 22:54:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443247#M34698</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-06-13T22:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443248#M34699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;These are samples of the data.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;SMAP_L4_SM_gph_&lt;STRONG&gt;20150331T043000&lt;/STRONG&gt;_Vv2030_001_Geophysical_Data_sm_surface_&lt;STRONG&gt;bdea9c15&lt;/STRONG&gt;.tif 
SMAP_L4_SM_gph_&lt;STRONG&gt;20161231T223000&lt;/STRONG&gt;_Vv2030_001_Geophysical_Data_sm_surface_&lt;STRONG&gt;352ca87d&lt;/STRONG&gt;.tif
SMAP_L4_SM_gph_&lt;STRONG&gt;20170104T043000_&lt;/STRONG&gt;Vv2030_001_Geophysical_Data_sm_surface_&lt;STRONG&gt;616d799c&lt;/STRONG&gt;.tif&lt;/PRE&gt;&lt;P&gt;In addition to the date (year, month, day) which are different, the letters&amp;nbsp;in the last part of the name (before .tif) are different.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:49:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443248#M34699</guid>
      <dc:creator>AmenehTavakol</dc:creator>
      <dc:date>2021-12-11T19:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443249#M34700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming the characters before the date in the filename are always the same length and all of your rasters are together in the same folder, see if this prints out the raster file names for each day that exists in the filename dates.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; collections &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; defaultdict

&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;main&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; raster_dir &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"D:\NASA\Data\SMAP\2014\Processed"&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; raster_dir
&amp;nbsp;&amp;nbsp;&amp;nbsp; raster_days &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; defaultdict&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;list&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; r &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListRasters&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raster_days&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;r&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;15&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;23&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; date&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; rasters &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; raster_days&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;items&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;date&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; r &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; rasters&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\t{}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; __name__ &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'__main__'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; main&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This creates a dictionary where the key is a date string (YYYYMMDD) and the value is a list of raster filenames that all have that date. If that works, you should be able to use this dictionary to calculate your statistics however you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Fixed typo on&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;raster_days&lt;/SPAN&gt; variable name in &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;for&lt;/SPAN&gt; loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:49:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443249#M34700</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-12-11T19:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443250#M34701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;defaultDict is pretty fancy for a beginner, but what a useful approach! Thanks for sharing that.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 16:47:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443250#M34701</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-06-14T16:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443251#M34702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;arcpy
&lt;SPAN style="color: #000080; font-weight: bold;"&gt;from &lt;/SPAN&gt;collections &lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;defaultdict

&lt;SPAN style="color: #000080; font-weight: bold;"&gt;def &lt;/SPAN&gt;main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; raster_dir = &lt;SPAN style="color: #008000; font-weight: bold;"&gt;r"D:\NASA\Data\SMAP\OutPut"
&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;arcpy.env.workspace = raster_dir
&amp;nbsp;&amp;nbsp;&amp;nbsp; raster_days = defaultdict(&lt;SPAN style="color: #000080;"&gt;list&lt;/SPAN&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;r &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;arcpy.ListRasters():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raster_days[r[&lt;SPAN style="color: #0000ff;"&gt;15&lt;/SPAN&gt;:&lt;SPAN style="color: #0000ff;"&gt;23&lt;/SPAN&gt;]].append(r)

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;date, rasters &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;raster_days.items():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;print&lt;/SPAN&gt;(date)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;r &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;rasters:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;print&lt;/SPAN&gt;(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;\t&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;{}"&lt;/SPAN&gt;.format(r))

&lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;__name__ == &lt;SPAN style="color: #008000; font-weight: bold;"&gt;'__main__'&lt;/SPAN&gt;:
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()

This Code exactly classified my data into day groups. Thank you so much for your help. I have just changes "&lt;CODE&gt;&lt;CODE&gt;day_rasters&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 15px; margin: 0px;"&gt;.&lt;/SPAN&gt;items&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 15px; margin: 0px;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 15px; margin: 0px;"&gt;)" in your code into "&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/CODE&gt;raster_days.items()"&lt;/PRE&gt;&lt;P&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:49:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443251#M34702</guid>
      <dc:creator>AmenehTavakol</dc:creator>
      <dc:date>2021-12-11T19:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443252#M34703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Right now I have to calculate the average for every cluster which is in this shape,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;20150429&lt;/STRONG&gt;&lt;BR /&gt; &lt;STRONG&gt;SMAP_L4_SM_gph_20150429T013000_Vv2030_001_Geophysical_Data_sm_surface_bf1ec829.tif&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; SMAP_L4_SM_gph_20150429T043000_Vv2030_001_Geophysical_Data_sm_surface_bf1ec80f.tif&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; SMAP_L4_SM_gph_20150429T073000_Vv2030_001_Geophysical_Data_sm_surface_bf1ec7e9.tif&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; SMAP_L4_SM_gph_20150429T103000_Vv2030_001_Geophysical_Data_sm_surface_bf1ecad1.tif&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; SMAP_L4_SM_gph_20150429T133000_Vv2030_001_Geophysical_Data_sm_surface_bf1ec808.tif&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; SMAP_L4_SM_gph_20150429T163000_Vv2030_001_Geophysical_Data_sm_surface_bf1ec82d.tif&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; SMAP_L4_SM_gph_20150429T193000_Vv2030_001_Geophysical_Data_sm_surface_bf1ec7eb.tif&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; SMAP_L4_SM_gph_20150429T223000_Vv2030_001_Geophysical_Data_sm_surface_bf1ec82a.tif&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I could not do that through getproperties and this code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;rasters &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; Ave = np.mean()

So how can i define the average for every cluster?&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:49:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443252#M34703</guid>
      <dc:creator>AmenehTavakol</dc:creator>
      <dc:date>2021-12-11T19:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443253#M34704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check out the &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/spatial-analyst-toolbox/cell-statistics.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Cell Statistics&lt;/A&gt; tool that &lt;A href="https://community.esri.com/migrated-users/3355" target="_blank"&gt;Curtis Price&lt;/A&gt;‌ mentioned. It takes a list of raster filenames and calculates an output raster with whatever summary statistic type you choose. Using my file grouping code above, you can do something like...&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; date&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; rasters &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; raster_days&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;items&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# Execute CellStatistics&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; outCellStatistics &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sa&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CellStatistics&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;rasters&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"MEAN"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# Save the output&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; outCellStatistics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"C:/example/cellstats_output"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that it looks like you do need the spatial analyst extension for Cell Statistics.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# Check out the ArcGIS Spatial Analyst extension license&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CheckOutExtension&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Spatial"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:49:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443253#M34704</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-12-11T19:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443254#M34705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;arcpy
&lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;numpy &lt;SPAN style="color: #000080; font-weight: bold;"&gt;as &lt;/SPAN&gt;np

&lt;SPAN style="color: #808080;"&gt;# Check out the ArcGIS Spatial Analyst extension license
&lt;/SPAN&gt;arcpy.CheckOutExtension(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Spatial"&lt;/SPAN&gt;)

&lt;SPAN style="color: #000080; font-weight: bold;"&gt;from &lt;/SPAN&gt;collections &lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;defaultdict

&lt;SPAN style="color: #000080; font-weight: bold;"&gt;def &lt;/SPAN&gt;main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; raster_dir = &lt;SPAN style="color: #008000; font-weight: bold;"&gt;r"D:\NASA\Data\SMAP\OutPut"
&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;arcpy.env.workspace = raster_dir
&amp;nbsp;&amp;nbsp;&amp;nbsp; raster_days = defaultdict(&lt;SPAN style="color: #000080;"&gt;list&lt;/SPAN&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;r &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;arcpy.ListRasters():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raster_days[r[&lt;SPAN style="color: #0000ff;"&gt;15&lt;/SPAN&gt;:&lt;SPAN style="color: #0000ff;"&gt;23&lt;/SPAN&gt;]].append(r)

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;date, rasters &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;raster_days.items():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;print&lt;/SPAN&gt;(date)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;r &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;rasters:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;print&lt;/SPAN&gt;(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;\t&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;{}"&lt;/SPAN&gt;.format(r))

&lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;__name__ == &lt;SPAN style="color: #008000; font-weight: bold;"&gt;'__main__'&lt;/SPAN&gt;:
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()

&lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;date, rasters &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;raster_days.item():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;# Execute CellStatistics
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;outCellStatistics = arcpy.sa.CellStatistics(rasters, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"MEAN"&lt;/SPAN&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;# Save the output
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;outCellStatistics.save(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"D:/NASA\Data\SMAP\OutPut/Processed"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;I tried this one but I received an error "for date, rasters in raster_days.item():&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NameError: name 'raster_days' is not defined"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:49:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443254#M34705</guid>
      <dc:creator>AmenehTavakol</dc:creator>
      <dc:date>2021-12-11T19:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443255#M34706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Blake there is a typo in your code above I think&amp;nbsp;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; font-size: 14px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit; font-size: 14px;"&gt;for&lt;/SPAN&gt; date&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;,&lt;/SPAN&gt; rasters &lt;SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit; font-size: 14px;"&gt;in&lt;/SPAN&gt; day_rasters&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;.&lt;/SPAN&gt;items&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;:&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;should be&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; font-size: 14px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit; font-size: 14px;"&gt;for&lt;/SPAN&gt; date&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;,&lt;/SPAN&gt; rasters &lt;SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit; font-size: 14px;"&gt;in&lt;/SPAN&gt; raster_days&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;.&lt;/SPAN&gt;items&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;:&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2017 18:10:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443255#M34706</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-06-20T18:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443256#M34707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;They are "&lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;date, rasters &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;raster_days.item():"&lt;/P&gt;&lt;P&gt;But still I receive this error!! that "NameError: name 'raster_days' is not defined".&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2017 18:39:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443256#M34707</guid>
      <dc:creator>AmenehTavakol</dc:creator>
      <dc:date>2017-06-20T18:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443257#M34708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's because you put that code in the wrong place -- outside of the main() function.&lt;/P&gt;&lt;P&gt;The variable raster_days is not defined outside of the function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2017 18:44:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443257#M34708</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-06-20T18:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily average of raster files based on their names in python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443258#M34709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I see it now, thanks. I'll update my code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2017 15:21:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-daily-average-of-raster-files-based-on/m-p/443258#M34709</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2017-06-21T15:21:12Z</dc:date>
    </item>
  </channel>
</rss>

