Extract data of a irregular shaped region from global data set
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Keegan Carvalho
am 27 Apr. 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 Kommentare
Image Analyst
am 27 Apr. 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 Kommentare
Siehe auch
Kategorien
Mehr zu NetCDF finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!