How can I compute latitudinal-averaged values of a layer in ArcMap?

114
1
05-30-2018 08:27 AM
Labels (4)
Highlighted
New Contributor
I would like to produce the sort of plot with latitude-wise averages for a raster in ArcMap as in Petr Lukes et al 2016.
How can I do this?
Thanks a bunch,
Filipe
Reply
0 Kudos
1 Reply
Highlighted
MVP Esteemed Contributor

You can convert the raster to a numpy array using numpy and arcpy.

http://pro.arcgis.com/en/pro-app/arcpy/functions/rastertonumpyarray-function.htm

You can then use matplotlib to plot both if you need to.  You might have to rearrange the Y depending how the graph

a = np.random.randint(0, 10, size=(10, 5))  # a sample raster
x= np.mean(a, axis=1)  # the mean by row
y = np.arange(9, -1, -1)
xy = np.array(list(zip(x, y)))


a
array([[5, 1, 4, 7, 4],
       [9, 9, 9, 0, 2],
       [7, 6, 8, 3, 4],
       [6, 5, 3, 3, 8],
       [0, 2, 0, 0, 3],
       [7, 8, 1, 2, 2],
       [2, 4, 0, 6, 2],
       [8, 3, 2, 8, 9],
       [3, 8, 9, 2, 8],
       [2, 4, 9, 5, 6]])
x
array([4.2, 5.8, 5.6, 5. , 1. , 4. , 2.8, 6. , 6. , 5.2])

y
array([9, 8, 7, 6, 5, 4, 3, 2, 1, 0])

xy
Out[20]:
array([[4.2, 9. ],
       [5.8, 8. ],
       [5.6, 7. ],
       [5. , 6. ],
       [1. , 5. ],
       [4. , 4. ],
       [2.8, 3. ],
       [6. , 2. ],
       [6. , 1. ],
       [5.2, 0. ]])

Reply
0 Kudos