Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
ocean mask

Subject: ocean mask

From: paul.stoy@montana.edu

Date: 31 Mar, 2010 22:30:15

Message: 1 of 4

Hi. The Mapping Toolbox examples show a nice way to mask out land
(below). How do I mask out the ocean instead?

Thanks.

load geoid
% Create a figure with an Eckert projection.
figure
axesm eckert4;
framem; gridm;
axis off

% Display the geoid as a texture map.
geoshow(geoid, geoidrefvec, 'DisplayType', 'texturemap');

% Create a colorbar and title.
hcb = colorbar('horiz');
set(get(hcb,'Xlabel'),'String','EGM96 Geoid Heights in Meters.')

% Mask out all the land.
geoshow('landareas.shp', 'FaceColor', 'black');

Subject: ocean mask

From: Rob Comer

Date: 2 Apr, 2010 02:20:24

Message: 2 of 4

You can mask out the world's land areas by reversing the direction of the vertices in a pair of global coastline latitude-longitude vectors like the ones in coast.mat (so that instead of having land on the right hand side of each curve and water on the left, it will be the other way around) -- like this:

>> load coast
>> geoshow(flipud(lat),flipud(long),'DisplayType','polygon','FaceColor','black')

Rob Comer
Mapping Toolbox Development
The MathWorks, Inc.

Subject: ocean mask

From: Ste

Date: 29 Feb, 2012 22:46:25

Message: 3 of 4

"Rob Comer" <rob.comer.nospam@mathworks.com> wrote in message <hp3k98$qbq$1@fred.mathworks.com>...
> You can mask out the world's land areas by reversing the direction of the vertices in a pair of global coastline latitude-longitude vectors like the ones in coast.mat (so that instead of having land on the right hand side of each curve and water on the left, it will be the other way around) -- like this:
>
> >> load coast
> >> geoshow(flipud(lat),flipud(long),'DisplayType','polygon','FaceColor','black')
>
> Rob Comer
> Mapping Toolbox Development
> The MathWorks, Inc.

That works perfect for me on the screen, but when I try to save (with saveas) or export (with the function export_fig, from: http://www.mathworks.com/matlabcentral/fileexchange/23629) the figure, the ocean areas are all visible again.. Do you have any tips on how to solve this probelm?

Subject: ocean mask

From: Carlos Batista

Date: 11 Jul, 2014 02:51:10

Message: 4 of 4

"paul.stoy@montana.edu" <paul.stoy@gmail.com> wrote in message <d427c5fd-67fd-4b67-b180-3f7490769954@35g2000yqm.googlegroups.com>...
> Hi. The Mapping Toolbox examples show a nice way to mask out land
> (below). How do I mask out the ocean instead?
>
> Thanks.
>
> load geoid
> % Create a figure with an Eckert projection.
> figure
> axesm eckert4;
> framem; gridm;
> axis off
>
> % Display the geoid as a texture map.
> geoshow(geoid, geoidrefvec, 'DisplayType', 'texturemap');
>
> % Create a colorbar and title.
> hcb = colorbar('horiz');
> set(get(hcb,'Xlabel'),'String','EGM96 Geoid Heights in Meters.')
>
> % Mask out all the land.
> geoshow('landareas.shp', 'FaceColor', 'black');


Does anyone have a solution to mask the data relating to the contour of the continents of a netcdf file?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us