필터 지우기
필터 지우기

Extract data of a irregular shaped region from global data set

조회 수: 3 (최근 30일)
Venkata
Venkata 2019년 8월 30일
답변: Image Analyst 2020년 4월 27일
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.

답변 (2개)

Keegan Carvalho
Keegan Carvalho 2020년 4월 27일
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

Image Analyst
Image Analyst 2020년 4월 27일
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.

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by