find location of maximum over a cube (preprocessing) #2163
rebeccaherman1
started this conversation in
Ideas
Replies: 1 comment
-
Hi @rebeccaherman1 you'd have to first get your desired maxima, then figure out what their locations in lat-lon space are by getting the indices (i, j) where these points sit in the 2D lat-lon data space, like this minimal example using Dask and lazy data: import numpy as np
import dask.array as da
lat = [11, 22]
lon = [33, 44]
# get the maximum
data = da.from_array([[33, 600], [22, 1000]])
x = da.where(data == da.max(data))
print(lat[x[0].compute()[0]], lon[x[1].compute()[0]])
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I see that it is simple to get the maximum of cube data over an area, or over a zonal or meridional region. But the resulting cube has only scalar spatial coordinates showing the middle of the region. How would I get a time series of the locations of the maximum values?
Beta Was this translation helpful? Give feedback.
All reactions