title: Find max value for each year in 3D array NetCDF file (way to use Pandas or xarray?)
body: <p>I am trying to makes some maps and such of data from several NetCDF files. Each one contains data for 5 years worth of data. The data is in a 3D array of shape <code>(14608, 145, 192)</code> (time, lat, lon).</p>
  
  <p>I would like the maximum value for each year at each coordinate, so basically when it's all said and done I'll have an output array with shape <code>(5,145,192)</code> (one value per each lat. and lon. value). </p>
  
  <p>It has been suggested I try using pandas, specifically DataFrame and DatetimeIndex, but I couldn't find a way to use it for more anything greater than a 2D array. Xarray was also suggested, but I haven't used xarray before and wouldn't know where to start.</p>
  
  <p><strong>Edit 1: Sample Data</strong></p>
  
  <p>Here is a simplified version of what I've been trying to do with pandas and then I realized DataFrame doesn't work for a 3D array. </p>
  
  <pre><code>import numpy as np
  import pandas as pd
  
  fake = np.random.randint(2, 30, size = (14608,145,192))
  index = pd.date_range(start = '1985-1-1 01:30:00', end = '1989-12-31 22:30:00' , freq='3H')
  
  df = pd.DataFrame(data = fake, index = index)
  </code></pre>
  
  <p><strong>Edit 2: Fixed Listed Array Shape</strong></p>
  
  <p>To clarify, I actually want an array with shape <code>(5, 145, 192)</code> as the output. I wrote it wrong because originally I was splitting the 3D array into 5 separate arrays, finding the max, and then stacking them again into one array witch ended with a shape of <code>(5, 145, 192)</code>. </p>
  
  <p>I want to be able to skip the tedious breaking apart the array by hand, so to speak, that I was doing before and simplify the code. </p>