islanddocumentation

islandis a logical function for determing whether a geolocation corresponds to land or water. (That's是土地, not island!)

Back to Climate Data Tools Contents

Contents

Syntax

tf = island(lat,lon)

描述

tf = island(lat,lon)uses a 1/8 degree resolution global land mask to determine whether the geographic location(s) given bylat,loncorrespond to land or water. Output istrue对土地的位置,falseotherwise.

Example

This example usescdtgridto create a 1x2 degree resolution grid, and we'll get some z values from Matlab's built-in examplepeaksfunction:

% Create a sample grid, 1 degree (lat) by 2 degree (lon) resolution:[lat,lon] = cdtgrid([1 2]);% Some sample z data:z = topo_interp(lat,lon);% Plot the full grid:imagescn(lon,lat,z) holdonborders

Mask-out land values by setting them toNaN:

% Determine which grid points correspond to land:land = island(lat,lon);% Set land values to NaN:z(land) = NaN;% Plot the masked dataset:figure imagescn(lon,lat,z) holdonborders

作者正o