Fast(er) High Resolution Blue Marble plot for Mapping Toolbox
11 views (last 30 days)
Show older comments
I need to plot weather data (LAT/LON specified) above Denmark using a satellite picture. I chose Blue Marble as it has worked perfectly for something like a stereographic with Greenland in focus, and it can be properly set up for longitude and latitude data. However a mercator projection for Denmark needs a higher resolution image, thus the image resolution will change (WIDTH= and HEIGHT= in DenmarkBlueMarbleURL). This however increases the runtime rather exponentially.
The following code is the problematic part from a larger project,
%%Plot data of Denmark (IN PROGRESS)
% Mapping Toolbox, somewhat working.
disp(' - Denmark')
% Get blue marble from NASA's neowms site.
% 1920*1080 seems to be the most appropiate resolution when it comes to
% both processing speed and resolution. Not enough for Denmark, however.
DenmarkBlueMarbleURL = 'http://neowms.sci.gsfc.nasa.gov/wms/wms?SERVICE=WMS&LAYERS=BlueMarbleNG&EXCEPTIONS=application/vnd.ogc.se_xml&FORMAT=image/jpeg&TRANSPARENT=FALSE&HEIGHT=6000&BGCOLOR=0xFFFFFF&REQUEST=GetMap&WIDTH=7200&BBOX=-180.0,-90.0,180.0,90.0&STYLES=&SRS=EPSG:4326&VERSION=1.1.1';
% A is the image, and R is the raster reference, "grid translation" I guess.
[A, R] = wmsread(DenmarkBlueMarbleURL);
FigDenmark = figure('Position', [100, 100, 1440, 900]);
% mercator projection
axesm('mercator', 'MapLatLimit', [52 70], 'MapLonLimit', [00 30])
% Will remove axis-constrained background
axis off;
% Plot blue marble.
geoshow(A, R);
% FaceAlpha will determine transparency
pcolorm(YM, XM, AuroraData, 'FaceAlpha', .5); shading flat;
% Use our own colourmap
colormap(AuroraColourmap);
caxis([0 100]) % AuroraData scale goes from 0 to 100.
ColourBarAurora = colorbar; ylabel(ColourBarAurora, 'Probability in percentage of visible aurora');
title(['Aurora forecast for ' datestr(CurrentTime, 'yyyy/mm/dd HHMM')]);
gridm;
drawnow
saveas(FigDenmark, 'CurrentDataPlot', 'tif');
It takes me about five minutes to run this section of the code. I believe the problem is geoshow(A,R), since everything goes fine until then, so this is the interesting part, ignore the AuroraData-dependent code. Also, if you change the latitude and longitude (i.e. to only fetch a map of Denmark) in the DenmarkBlueMarbleURL (BBOX=) it seems to take longer as well, so I always just fetch the whole map.
In short: Is there a faster way to use a blue marble plot to plot data on top?
1 Comment
Chad Greene
on 8 Jun 2016
Do you need to plot in map coordinates? What about simply,
imagesc(A)
Another option is to clip A to the lat,lon region of interest before calling geoshow. A 6000x7200 image will take a long time with geoshow, but it'll be much faster if you can only plot the values that are within your lat/lon range of interest.
Answers (0)
See Also
Categories
Find more on Mapping Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!