<?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 Build a model to calculate monthly average from daily rainfall rasters in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/build-a-model-to-calculate-monthly-average-from/m-p/336227#M4735</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class="" style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; padding: 0px 15px 0px 0px;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; font-size: 13px;"&gt;&lt;SPAN class="" style="color: #6a737c; border: 0px; font-weight: inherit; font-size: 20px; margin: 8px 0px;"&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have rainfall rasters for each day of the decade 2000 - 2009. Each file is named with the format rYYYYMMDD (eg r20001224 is the rainfall raster for Dec 24th 2000).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to create 'monthly average rainfall' rasters for each month in this decade (10 years x 12 months = 120 rasters).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rather than manually selecting each daily raster in a month,&amp;nbsp;is there a way to get ArcGIS to select rasters with a common prefix as the input to Raster Calculator?&amp;nbsp;i.e. generate a new raster by averaging all rasters named 'r200001__' (from January 2000).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally, I would like to iterate this process in Model Builder using the Raster Calculator. I'm inexperienced with python coding, but I'm happy to learn if it's the only/best way.&lt;/P&gt;&lt;P&gt;Any advice is appreciated!&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 May 2018 05:40:34 GMT</pubDate>
    <dc:creator>JessicaMoran1</dc:creator>
    <dc:date>2018-05-23T05:40:34Z</dc:date>
    <item>
      <title>Build a model to calculate monthly average from daily rainfall rasters</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/build-a-model-to-calculate-monthly-average-from/m-p/336227#M4735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class="" style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; padding: 0px 15px 0px 0px;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; font-size: 13px;"&gt;&lt;SPAN class="" style="color: #6a737c; border: 0px; font-weight: inherit; font-size: 20px; margin: 8px 0px;"&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have rainfall rasters for each day of the decade 2000 - 2009. Each file is named with the format rYYYYMMDD (eg r20001224 is the rainfall raster for Dec 24th 2000).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to create 'monthly average rainfall' rasters for each month in this decade (10 years x 12 months = 120 rasters).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rather than manually selecting each daily raster in a month,&amp;nbsp;is there a way to get ArcGIS to select rasters with a common prefix as the input to Raster Calculator?&amp;nbsp;i.e. generate a new raster by averaging all rasters named 'r200001__' (from January 2000).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally, I would like to iterate this process in Model Builder using the Raster Calculator. I'm inexperienced with python coding, but I'm happy to learn if it's the only/best way.&lt;/P&gt;&lt;P&gt;Any advice is appreciated!&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2018 05:40:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/build-a-model-to-calculate-monthly-average-from/m-p/336227#M4735</guid>
      <dc:creator>JessicaMoran1</dc:creator>
      <dc:date>2018-05-23T05:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Build a model to calculate monthly average from daily rainfall rasters</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/build-a-model-to-calculate-monthly-average-from/m-p/336228#M4736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look at using ListRasters and feeding the result into CellStatistics&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2018 11:36:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/build-a-model-to-calculate-monthly-average-from/m-p/336228#M4736</guid>
      <dc:creator>SteveLynch</dc:creator>
      <dc:date>2018-05-23T11:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Build a model to calculate monthly average from daily rainfall rasters</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/build-a-model-to-calculate-monthly-average-from/m-p/336229#M4737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This has been covered if you want to use scripting which may be easier&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/message/766189-cell-statistics-with-list-rasters"&gt;https://community.esri.com/message/766189-cell-statistics-with-list-rasters&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2018 12:09:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/build-a-model-to-calculate-monthly-average-from/m-p/336229#M4737</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-05-23T12:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: Build a model to calculate monthly average from daily rainfall rasters</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/build-a-model-to-calculate-monthly-average-from/m-p/336230#M4738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Scripting will probably be the easiest way to implement this using&amp;nbsp;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/listrasters.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/listrasters.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;ListRasters—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp; and&amp;nbsp;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/tools/spatial-analyst-toolbox/cell-statistics.htm" title="http://desktop.arcgis.com/en/arcmap/latest/tools/spatial-analyst-toolbox/cell-statistics.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Cell Statistics—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;as&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/3428" target="_blank"&gt;Steve Lynch&lt;/A&gt;&amp;nbsp;already mentioned before.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To give you a head start with some of the code that will be needed, have a look at the snippet below:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;lst_ras &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'r20000125'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'r20000126'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'r20000127'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'r20000128'&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'r20000129'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'r20000130'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'r20000131'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'r20000201'&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'r20000202'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'r20000203'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'r20000204'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'r20000205'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

lst_months &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; list&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;set&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;ras&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;7&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; ras &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; lst_ras&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;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lst_months&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; month &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; lst_months&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ras_names_month &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;ras &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; ras &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; lst_ras &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; ras&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;startswith&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;month&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="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"month: {}&amp;nbsp; rasters: {}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;month&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ras_names_month&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will use ListRasters to get a list of raster names. In my example I created a small list manually (see lines 1 to 3). On line 5 I create a list of the month prefixes and print it on line 6. This will yield:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;['r200002', 'r200001']&lt;SPAN class="line-numbers-rows"&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;For each month prefix (line &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; you can get a list of all the day rasters, which is done on line 9. This list is what you will use with the Cell Statistics as first parameter. The result of line 9 is printed on line 10 as yields:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;month: r200002&amp;nbsp; rasters: ['r20000201', 'r20000202', 'r20000203', 'r20000204', 'r20000205']
month: r200001&amp;nbsp; rasters: ['r20000125', 'r20000126', 'r20000127', 'r20000128', 'r20000129', 'r20000130', 'r20000131']&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 15:56:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/build-a-model-to-calculate-monthly-average-from/m-p/336230#M4738</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T15:56:21Z</dc:date>
    </item>
  </channel>
</rss>

