Page 160 - MATLAB Recipes for Earth Sciences
P. 160

7.3 The 2-Minute Gridded Global Elevation Data ETOPO2           155

             256   266   267   283   257   273   248   228   215   220 ...
             272   273   258   258   254   264   232   218   229   210 ...
             259   263   268   275   242   246   237   219   211   209 ...
             (cont'd)

           The header documents the size of the data matrix (e.g., 901 columns and
           1201 rows in our example), the coordinates of the lower-left corner (e.g.,
           x=30 and y=-20), the cell size (e.g., 0.033333 = 1/30 degree latitude and
           longitude) and the -32768 flag for data voids. We comment the header by

           typing % at the beginning of the fi rst six lines
             %NCOLS   901
             %NROWS  1201
             %XLLCORNER   30.00000
             %YLLCORNER -20.00000
             %CELLSIZE 0.03333333
             %NODATA_VALUE  -32768
             270   294   278   273   262   248   251   236   228   223 ...
             280   278   278   264   254   253   240   234   225   205 ...
             256   266   267   283   257   273   248   228   215   220 ...
             272   273   258   258   254   264   232   218   229   210 ...
             259   263   268   275   242   246   237   219   211   209 ...
             (cont’d)
           and load the data into the workspace.

             ETOPO2 = load('grid01.asc');

           We flip the matrix up and down. Then, the -32768 flag for data voids has to


           be replaced by the MATLAB representation for  Not-a-Number   NaN.
             ETOPO2 = flipud(ETOPO2);
             ETOPO2(find(ETOPO2 == -32768)) = NaN;

           Finally, we check whether the data are now correctly stored in the work-
           space by printing the minimum and maximum elevations of the area.
             max(ETOPO2(:))
             min(ETOPO2(:))
           In this example, the maximum elevation of the area is 5199 m and the mini-
           mum elevation is -5612 m. The reference level is the sea level at 0 m. We

           now define a coordinate system using the information that the lower-left
           corner is s20e30, i.e., 20° southern latitude and 30° eastern longitude. The
           resolution is 2 arc minutes corresponding to 1/30 degrees.

             [LON,LAT] = meshgrid(30:1/30:60,-20:1/30:20);
           Now we generate a colored surface from the elevation data using the
   155   156   157   158   159   160   161   162   163   164   165