Main Content

etopo

(To be removed) Read gridded global relief data (ETOPO products)

etopo will be removed in a future release. Use readgeoraster instead. For more information, see Compatibility Considerations.

Syntax

[Z, refvec] = etopo
[Z, refvec] = etopo(samplefactor)
[Z, refvec] = etopo(samplefactor, latlim, lonlim)
[Z, refvec] = etopo(folder, ...)
[Z, refvec] = etopo(filename, ...)
[Z, refvec] = etopo({'etopo5.northern.bat', 'etopo5.southern.bat'}, ...)

Description

[Z, refvec] = etopo reads the ETOPO data for the entire world from the ETOPO data in the current folder. For more information about ETOPO data, see the ETOPO Global Relief Model website. The etopo function searches the current folder first for ETOPO1c binary data, then ETOPO2V2c binary data, then ETOPO2 (2001) binary data, then ETOPO5 binary data, and finally ETOPO5 ASCII data. Once the function finds a case-insensitive file name match, it reads the data. See Tips for a list of possible file names. The etopo function returns the data grid, Z, as an array of elevations. Data values, in whole meters, represent the elevation of the center of each cell. refvec, the associated three-element referencing vector, geolocates Z.

[Z, refvec] = etopo(samplefactor) reads the data for the entire world, downsampling the data by samplefactor. The scalar integer samplefactor when equal to 1 gives the data at its full resolution (10800 by 21600 values for ETOPO1 data, 5400 by 10800 values for ETOPO2 data, and 2160 by 4320 values for ETOPO5 data). When samplefactor is an integer n greater than one, the etopo function returns every nth point. If you omit samplefactor or leave it empty, it defaults to 1. (If the etopo function reads an older, ASCII ETOPO5 data set, then samplefactor must divide evenly into the number of rows and columns of the data file.)

[Z, refvec] = etopo(samplefactor, latlim, lonlim) reads the data for the part of the world within the specified latitude and longitude limits. Specify the limits of the desired data as two-element vectors of latitude, latlim, and longitude, lonlim, in degrees. Specify the elements of latlim and lonlim in ascending order. Specify lonlim in the range [0 360] for ETOPO5 data and [-180 180] for ETOPO2 and ETOPO1 data. If latlim is empty, the latitude limits are [-90 90]. If lonlim is empty, the file type determines the longitude limits.

[Z, refvec] = etopo(folder, ...) allows you to use the variable folder to specify the path for the ETOPO data file. Otherwise, the etopo function searches the current folder for the data.

[Z, refvec] = etopo(filename, ...) reads the ETOPO data from the file specified by the case-insensitive string scalar or character vector filename. The name of the ETOPO file is as referenced in the ETOPO data file names table. Include the folder name in filename or place the file in the current folder or in a folder on the MATLAB path.

[Z, refvec] = etopo({'etopo5.northern.bat', 'etopo5.southern.bat'}, ...) reads the ETOPO data from the specified case-insensitive ETOPO5 ASCII data files. Place the files in the current folder or in a folder on the MATLAB path.

Examples

Read and display ETOPO2V2c data from the file 'ETOPO2V2c_i2_LSB.bin' downsampled to half-degree cell size and display the boundary of the land areas.

samplefactor = 15;
[Z, refvec] = etopo('ETOPO2V2c_i2_LSB.bin', samplefactor);
figure
worldmap world
geoshow(Z, refvec, 'DisplayType', 'texturemap');
demcmap(Z, 256);
geoshow('landareas.shp', 'FaceColor', 'none', ...
   'EdgeColor', 'black');

World map displaying global land topography and ocean bathymetry data

Tips

The etopo function supports these ETOPO data files.

FormatFile Names
ETOPO1c (cell)
  • etopo1_ice_c.flt

  • etopo1_bed_c.flt

  • etopo1_ice_c_f4.flt

  • etopo1_bed_c_f4.flt

  • etopo1_ice_c_i2.bin

  • etopo1_bed_c_i2.bin

ETOPO2V2c (cell)
  • ETOPO2V2c_i2_MSB.bin

  • ETOPO2V2c_i2_LSB.bin

  • ETOPO2V2c_f4_MSB.flt

  • ETOPO2V2c_f4_LSB.flt

  • ETOPO2V2c.hdf

ETOPO2 (2001)
  • ETOPO2.dos.bin

  • ETOPO2.raw.bin

ETOPO5 (binary)
  • ETOPO5.DOS

  • ETOPO5.DAT

ETOPO5 (ASCII)
  • etopo5.northern.bat

  • etopo5.southern.bat

References

[1] “2-minute Gridded Global Relief Data (ETOPO2v2),” U.S. Department of Commerce, National Oceanic and Atmospheric Administration, National Geophysical Data Center, 2006.

[2] Amante, C. and B. W. Eakins, “ETOPO1 1 Arc-Minute Global Relief Model: Procedures, Data Sources and Analysis,” NOAA Technical Memorandum NESDIS NGDC-24, March 2009.

[3] “Digital Relief of the Surface of the Earth,” Data Announcement 88-MGG-02, NOAA, National Geophysical Data Center, Boulder, Colorado, 1988.

[4] “ETOPO2v2 Global Gridded 2-minute Database,” National Geophysical Data Center, National Oceanic and Atmospheric Administration, U.S. Dept. of Commerce.

Version History

Introduced before R2006a

expand all

R2021b: Warns

Support for reading most ETOPO data files will be removed in a future release. In addition, raster reading functions that return referencing vectors issue a warning that they will be removed in a future release, including etopo. Instead, use a supported data file and return a raster reference object using readgeoraster.

Reference objects have several advantages over referencing vectors.

  • Unlike referencing vectors, reference objects have properties that document the size of the associated raster, its geographic limits, and the direction of its rows and columns. For examples of reference object properties, see GeographicCellsReference and GeographicPostingsReference.

  • You can manipulate the limits of rasters associated with reference objects using the geocrop function.

  • You can manipulate the size and resolution of rasters associated with reference objects using the georesize function.

  • Most functions that accept referencing vectors as input also accept reference objects.

To update your code, download the 60 arc-second resolution version of the ETOPO 2022 model from the ETOPO Global Relief Model website. You must download the version stored in the GeoTIFF format. Then, update your code using these replacement patterns.

Will Be RemovedRecommended
[Z,refvec] = etopo(filename);
filename = "ETOPO_2022_v1_60s_N90W180_surface.tif";
[Z,R] = readgeoraster(filename);
[Z,refvec] = etopo(filename,samplefactor);
filename = "ETOPO_2022_v1_60s_N90W180_surface.tif";
[Z,R] = readgeoraster(filename);
[Z,R] = georesize(Z,R,1/samplefactor);
[Z,refvec] = etopo(filename,samplefactor,latlim,lonlim);
filename = "ETOPO_2022_v1_60s_N90W180_surface.tif";
[Z,R] = readgeoraster(filename);
[Z,R] = geocrop(Z,R,latlim,lonlim);
[Z,R] = georesize(Z,R,1/samplefactor);

Unlike etopo, the readgeoraster function does not support the ETOPO2 or ETOPO5 models. To obtain the resolution of the ETOPO2 or ETOPO5 models, resize the 60 arc-second resolution version of the ETOPO 2022 model by using the georesize function with a scale of 1/2 or 1/5, respectively.

The readgeoraster function returns data using the native data type embedded in the file. Return a different data type by specifying the 'OutputType' name-value pair. For example, use [Z,R] = readgeoraster(filename,'OutputType','double').

The readgeoraster function does not automatically replace missing data with NaN values. Replace missing data with NaN values using the standardizeMissing function.

filename = "ETOPO_2022_v1_60s_N90W180_surface.tif";
[Z,R] = readgeoraster(filename);
info = georasterinfo(filename);
m = info.MissingDataIndicator;
Z = standardizeMissing(Z,m);