Extract data of a irregular shaped region from global data set
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
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
0 件のコメント
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で NetCDF についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!