Page 165 - MATLAB Recipes for Earth Sciences
P. 165

160                                                     7 Spatial Data

               SRTM(find(SRTM == -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(SRTM(:))
               ans =
                  3992

               min(SRTM(:))
               ans =
                  1504

            In our example, the maximum elevation of the area is 3992 m, the minimum
            altitude is 1504 m above sea level. A coordinate system can be defi ned by
            using the information that the lower-left corner is s01e036. The resolution is
            3 arc seconds corresponding to 1/1200 degrees.

               [LON,LAT] = meshgrid(36:1/1200:37,-1:1/1200:0);
            A shaded grayscale map can be generated from the elevation data using
            the function surfl. This function displays a shaded surface with simulated
            lighting.
               figure
               surfl(LON,LAT,SRTM)
                 shading interp
               colormap gray
               view(0,90)
               colorbar


            This script opens a new figure window, generates the shaded-relief map us-
            ing interpolated shading and a gray colormap in an overhead view. SRTM

            data contain considerable amount of noise, we first smooth the data using
            an arbitrary 9x9 pixel moving average filter. The new matrix is stored in the

            matrix SRTM_FILTERED.
               B = 1/81 * ones(9,9);
               SRTM_FILTERED = filter2(B,SRTM);

            The corresponding shaded-relief map is generated by
               figure
               surfl(LON,LAT,SRTM_FILTERED)
               shading interp
               colormap gray
               view(0,90)
                 colorbar
   160   161   162   163   164   165   166   167   168   169   170