Extract data of a irregular shaped region from global data set
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I would like to extract the field values corresponding to an irregular shaped region (E.g. a city, a country or a continent) from a global data set.
If I have the geographical boundary (longitudes and latitudes) of such region, is there a way to extract data within that region (including the boundary) from the available global data?
I tried using 'find' command but it is taking hours together just to search one day of the global data.
There must be a smart way of doing it.
Please help.
Thankyou.
0 comentarios
Respuestas (2)
Keegan Carvalho
el 27 de Abr. de 2020
You will have to try indexing. Assuming you have a 3-d gridded data file (netcdf, etc.):
t % t is a variable (like temperature, precipitation, etc.)
lat
lon % lat and lon are latitude and longitude respectvely
longindex = find(lon==70.5);
latindex = find(lat==15.5);
newt = t(longindex,latindex,:); % newt is t values for a region of coordinates 70.5, 15.5
If your looking to find t values for an entire region, try using loops:
for i=1:length(latrange)
latindex(i)= find(lat==latrange(i));
end
for i=1:length(lonrange)
longindex(i)= find(lon==lonrange(i));
end
Hope this helps
0 comentarios
Image Analyst
el 27 de Abr. de 2020
Yes but what are you going to do? The easiest is if you convert the coordinates to a digital image, and then make a make a mask from the coordinates of the one region with poly2mask(). With that you can do things on "the field values" inside the mask such as get their mean or distribution or whatever.
0 comentarios
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!