<?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 an average for many many time steps in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/calculate-an-average-for-many-many-time-steps/m-p/244994#M3431</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You may have figured this out or moved on already, so I'll keep this reply short.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG style=": ; font-style: italic; text-decoration: underline;"&gt;Option 1&lt;/STRONG&gt;&lt;SPAN&gt;: Use Python to read the netCDF file as a numpy array object. If your dataset isn't too large, you can average all 1,308 time steps with a single keystroke. Search Google for 'scipy.io.netcdf' and 'numpy.mean'. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG style=": ; font-style: italic; text-decoration: underline;"&gt;Option2&lt;/STRONG&gt;&lt;SPAN&gt;: If your dataset is too large to read as a single three-dimensional array, you'll have to loop through each time step and use a simple formula: T&lt;SUB&gt;avg&lt;/SUB&gt; = ((n*a&lt;SUB&gt;avg&lt;/SUB&gt;) + a) / n + 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;n = the # of timesteps you've already averaged&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;a&lt;SUB&gt;avg&lt;/SUB&gt; = your current average&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;a = data for the current time step&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Obviously for the first time step, a&lt;SUB&gt;avg&lt;/SUB&gt; == a. But, for example, at the the fourth time step the formula would be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;((3*a&lt;SUB&gt;avg&lt;/SUB&gt;) + a) / 4&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Either way, you're going to need to use Python. I like to use a good scientific IDE like &lt;/SPAN&gt;&lt;A href="http://code.google.com/p/spyderlib/"&gt;SPyDeR&lt;/A&gt;&lt;SPAN&gt; for this type of work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Jan 2012 18:18:38 GMT</pubDate>
    <dc:creator>PhilMorefield</dc:creator>
    <dc:date>2012-01-11T18:18:38Z</dc:date>
    <item>
      <title>Calculate an average for many many time steps</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/calculate-an-average-for-many-many-time-steps/m-p/244993#M3430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a netCDF file of temperature. It has 1308 time steps (12 months for 109 years). &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I was wondering how would I go about calculating the average for the 1308 time steps?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to do this in Model Builder. If I had only a couple time steps, I would just add them up and then divide them using simple math tools in the toolbox. However, because I have 1308 of them, what should I do to make the summing automatic (so I don't have to manually specify the time step in the "make netCDF raster layer" tool for 1308 times!)? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get a feeling that I might need to do this in python? or I can achieve this in Model builder as well? I'm fairly new to ArcGIS and my programming skills are not so stellar, so I don't know how to do that. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp; although if python is the only way to do, I wouldn't mind learning it, although I would really appreciate any pointers or suggestions (books, web resources...etc.) on how I can quickly learn it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using ArcGIS 9.2 (although my school has ArcGIS 10, so suggestions on either or both would do!) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks so much for your help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sakura&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Oct 2011 21:45:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/calculate-an-average-for-many-many-time-steps/m-p/244993#M3430</guid>
      <dc:creator>SakuraOno</dc:creator>
      <dc:date>2011-10-16T21:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate an average for many many time steps</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/calculate-an-average-for-many-many-time-steps/m-p/244994#M3431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You may have figured this out or moved on already, so I'll keep this reply short.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG style=": ; font-style: italic; text-decoration: underline;"&gt;Option 1&lt;/STRONG&gt;&lt;SPAN&gt;: Use Python to read the netCDF file as a numpy array object. If your dataset isn't too large, you can average all 1,308 time steps with a single keystroke. Search Google for 'scipy.io.netcdf' and 'numpy.mean'. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG style=": ; font-style: italic; text-decoration: underline;"&gt;Option2&lt;/STRONG&gt;&lt;SPAN&gt;: If your dataset is too large to read as a single three-dimensional array, you'll have to loop through each time step and use a simple formula: T&lt;SUB&gt;avg&lt;/SUB&gt; = ((n*a&lt;SUB&gt;avg&lt;/SUB&gt;) + a) / n + 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;n = the # of timesteps you've already averaged&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;a&lt;SUB&gt;avg&lt;/SUB&gt; = your current average&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;a = data for the current time step&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Obviously for the first time step, a&lt;SUB&gt;avg&lt;/SUB&gt; == a. But, for example, at the the fourth time step the formula would be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;((3*a&lt;SUB&gt;avg&lt;/SUB&gt;) + a) / 4&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Either way, you're going to need to use Python. I like to use a good scientific IDE like &lt;/SPAN&gt;&lt;A href="http://code.google.com/p/spyderlib/"&gt;SPyDeR&lt;/A&gt;&lt;SPAN&gt; for this type of work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2012 18:18:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/calculate-an-average-for-many-many-time-steps/m-p/244994#M3431</guid>
      <dc:creator>PhilMorefield</dc:creator>
      <dc:date>2012-01-11T18:18:38Z</dc:date>
    </item>
  </channel>
</rss>

