Mask values outside a particular area using lat, lon, and data array
I have lon, lat, and data arrays, plotting of which gives the result in the attached picture. My main problem is I need to extract the grid points that has zero values from this data. However, I need to do so only within the area I marked in the figure, not in the entire data. This is a tricky problem. Using a clip function in ArcGIS would be easier but I don’t want to go with that complicated route. Do you have any ideas on how to do it in python? There are zero values everywhere outside of the marked area, I somehow need to replace them with NaN so that I can do further analysis.