• 大小: 277KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-14
  • 语言: Matlab
  • 标签: 未分类  

资源简介

matlab开发-landmask。获取与数据相对应的逻辑地块。

资源截图

代码片段和文件信息

function land = landmask(latlonvarargin)
% landmask returns a logical array describing the landness of
% any given lat/lon arrays.  Requires Matlab‘s Mapping Toolbox. 

% This function uses Matlab‘s built-in coast.mat file with inpolygons
% to determing whether input lat/lons are inside or outside perimeters of
% land areas. 

%% Syntax

%  land = landmask(latlon)
%  land = landmask(...‘landmass‘)
%  land = landmask(...quality)

%% Description 

% land = landmask(latlon) returns logical land array corresponding to
% the dimensions of input lat and lon.  1 is land 0 is not land. 
%
% land = landmask(...‘landmass‘) specifies any of the following regions of
% mask: 

% * ‘Antarctica‘
% * ‘Africa and Eurasia‘
% * ‘North and South America‘
% * ‘Greenland‘
% * ‘Australia‘
% * ‘Baffin Island‘
% * ‘Ellesmere Island‘
% * ‘New Guinea‘
% * ‘Great Britain‘
% * ‘Borneo‘
% * ‘Honshu‘
% * ‘Victoria Island‘
% * ‘Celebes‘
% * ‘New Zealand North Island‘
% * ‘Sumatra‘
% * ‘Madagascar‘
% * ‘Iceland‘
% * ‘New Zealand South Island‘
% * ‘Newfoundland‘
% * ‘Luzon‘
% * ‘Devon Island‘
% * ‘Ireland‘
% * ‘Cuba‘
% * ‘Java‘
% * ‘Mindanao‘

% 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 on my laptop a calculating 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 on my laptop. 
% 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. 

%
%% Example 1: Is Topeka KS on land? 
% % Topeka Kansas is located at (39.06N 95.69W).  Is Topeka situatated on
% % land? 

% TopekaLand = landmask(39.0695.69)

%%
% % As it turns out yes Topeka is well grounded. But is it in Australia? 

% TopekaAustralia = landmask(39.0695.69‘australia‘)

%% 
% % Zero means nope. 

%% Example 2: Gridded data
% % Start with some sample gridded data: 

% [lonlat] = meshgrid(linspace(-179 179 180)...
%     linspace(-89.589.5 180));
% z = peaks(180);

% worldmap(‘world‘)
% h=pcolorm(latlonz); 

%% 
% % To mask-out the land area of North and South America set all z values 
% % corresponding to the land area of these two continents to NaN. Start by 
% % deleting the pcolorm surface we plotted above. This calculation may
% % take about 3 to 5 seconds on a modern laptop computer: 

% delete(h)
% Americas = landmask(latlon‘North and South America‘); 
% z(Americas) = NaN; 
% h=pcolorm(latlonz); 

%% 
% % To instead mask out all the world‘s oceans set non-land areas to NaN. First
% % we‘ll delete the last pcolorm surface and refresh our z data. Then
% % we‘ll calculate the ocean mask by taking the logical not of the land
% % mask.
% % 
% % Using default quality of 95 land mask calculation for our 180x180 grid
% % takes abo

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件       13429  2014-12-05 13:42  landmask\html\landmask_documentation.html
     文件        3867  2014-12-05 13:42  landmask\html\landmask_documentation.png
     文件       16321  2014-12-05 13:42  landmask\html\landmask_documentation_01.png
     文件       16708  2014-12-05 13:42  landmask\html\landmask_documentation_02.png
     文件       13777  2014-12-05 13:42  landmask\html\landmask_documentation_03.png
     文件        6909  2014-12-05 13:42  landmask\landmask.m
     文件          82  2014-12-05 13:42  __MACOSX\landmask\._landmask.m
     文件        3976  2014-12-05 13:42  landmask\landmask_documentation.m
     文件          82  2014-12-05 13:42  __MACOSX\landmask\._landmask_documentation.m
     文件      226757  2014-12-05 13:42  landmask\landmass.png
     文件        1311  2014-12-05 13:42  license.txt

评论

共有 条评论