Accurate plotting a raster within the coastlines
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a global raster data X as matrix (long*lat) 288x192 and additional vectors of longitudes (1:288) and latitudes (1:192). I need to make a nice map of X within land area. Someone recommended me to use a skript landmask.m. So, I run the following subscript (under Matlab 2023a)
land(1:288,1:192) = 0;
for i=1:288
for j=1:192
land(i,j)=landmask(lat(j),lon(i));
end
end
It works, but shows many times the following warning:
Warning: The results from INPOLYGON may not be reliable. The size of the polygon is approaching the lower limit of what can be handled with reasonable accuracy.
Then I plot my data X under condition land~=0 (only land) using contourf. It works, but the result is very rough from the point of view of land presenting:
How can I combine my rather rough raster data (with ~1 degree step) with accurate coastline presentation?
Thanks
0 Commenti
Risposte (1)
Supraja
il 5 Mag 2023
‘landmask’ function returns a logical array describing the landness of any given lat/lon arrays.
land = landmask(..., quality) specifies quality from 0 to 100. This option is provided because for large data sets, the land mask function can take quite some time. For example, a calculation of 180x360 land mask for all continents takes about 65 seconds at 100% quality. Default quality is 95, which takes about 6 seconds for the same dataset. The quality setting is only used when calculating the land mask using all of the world's continents. For single land masses, 100% quality is assumed.
You can try following the examples and functions given in the link here:https://www.mathworks.com/matlabcentral/fileexchange/48661-landmask?s_tid=srchtitle_landmask%2520_1
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!