How to set outside a country values to NaN, in a 3d array (lat x lon x time) ?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi
I have a 3 dimension array which is precipitation = longitude*latitude*time. I extract this file from a netcdf file. altogh I was adjust latitude and longitude limit when I was reading netcdf latitude and longtude, but now I have an rectangular which some sides of it are offside of my stude region.
the study region is a one country.
I want to know how to ignore all latitude and longitude and corresponding time dimension values in order to have a clear figure (eliminate all other data outside the boundary of the country)
thank you for all your helps
0 comentarios
Respuestas (1)
Lateef Adewale Kareem
el 2 de Nov. de 2019
The best solution is to use google map to get latitudes and logitudes of vertices of a polygon representing the external boundary of the country you are interested in. Make sure you collected the data in clockwise manner. Then test points against 2 contiguous pairs of point on the vertices, if you get a negative sign in any case, the point is outside and set it to nan.
By test I mean compute area using the determinant method.
Ver también
Categorías
Más información sobre NetCDF en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!