How can I use the inpolygon function for 3 dimensions?

25 次查看(过去 30 天)
I have plotted the chlorophyll monthly climatology of a specific region of a world map. I want to place a polygon on a specific region and plot time series for just that region. The chlorophyll data is in 3 dimensions of longitude, latitude, and dates (109x97x280). I'm confused on how to use the inpolygon function for 3 dimensions. I want to be able to make the polygon, determine which points are within that polygon, then average those points for each date to ultimately plot a time series. Any suggestions are helpful, thank you!
  2 个评论
DGM
DGM 2021-6-28
编辑:DGM 2021-6-28
It sounds to me like your constraint region isn't a polygon, but a polygonal prism. To clarify, what is the time range? Is it a single specific time? Is it a range of times? Is it all time? It sounds like it's one of the latter two.
Candice Cooper
Candice Cooper 2021-6-28
Yes, that's correct I believe. It's a range of times (spanning 23 years).

请先登录,再进行评论。

采纳的回答

KSSV
KSSV 2021-6-28
You need not to use a 3D inpolygon. You are supposed to use inpolygon only once. Get your closed polygon coordinates(xv,yv); let X, Y be your grid coordinates.
idx = inpolygon(X,Y,xv,yv) ;
You got the indices, the same indices can be used for all the time steps.
  5 个评论
Walter Roberson
Walter Roberson 2021-6-28
编辑:Walter Roberson 2021-6-28
Your xv and yv are 2d but do not have the same number of columns.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Weather and Atmospheric Science 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by