Solution to MATLAB and Simulink Challenge project 229 Coastline Prediction using Existing Climate Change Models
April 1, 2026 · View on GitHub
Project details
Global temperature rise leads to accelerated glacier melting, causing sea levels to rise. This impacts populations near the coastline, making it important to delineate at-risk areas for planning and decision-making. In this project, an application was developed to visualize changes in coastlines based on projections of sea level rise.
For the development of the Coastline Prediction application, inspiration was drawn from the work done by Wenyu Hu and Stacia Kolodziejski of Boston University [1]. However, both the source code and the user interface were created from scratch.
Several features and capabilities were added to the Coastline Prediction software created for this project, including:
- Inclusion of U.S. Geological Survey (USGS) digital elevation models with a resolution of 1/3 arc-second for the U.S. territory [2].
- The ability to visualize any location on the planet thanks to the incorporation of elevation data from the NASA Shuttle Radar Topography Mission Global 1 arc-second V003 [3], provided that the area of interest is within the coverage of the database.
- The addition of sea level projections until the year 2050 obtained from the Copernicus Climate Change Service [4].
- Coastal variation given a sea level rise.
- Manual adjustment of the area of interest at the user's discretion, with some restrictions to prevent excessively large amounts of data that could overwhelm the computer and disrupt the software's operation.
How to run section
This application was developed in MATLAB 2023b, so it is recommended to use that version or a more recent one. It is also necessary to have the Mapping Toolbox installed.
Due to the large amount of data handled during the application's execution, it is essential for the computer to have at least 16 GB of RAM, preferably 32 GB or more. Sufficient storage space is also required for the download of terrain elevation files. When using the online version of MATLAB, it must be verified that the license allows the loading of large files.
The necessary files to run the application are in the repository and should be stored in the same manner with the same names. The application file “CoastlinePrediction.mlapp”, along with the other files and subfolders, must be in the same folder.
User interface
At the beginning of the application, users will encounter the interface as shown in the next image:
Figure 1. Home screen description.
- In the Dataset panel, there are the three available options for projecting sea level.
- In the Region dropdown menu, users will find the option to use 1/3 arc-second elevation raster for the United States or 1 arc-second for the entire world. Below, options for Location, Scenario, or Year will also be found, and these will be enabled based on the chosen region and selected dataset.
- The SLR Projection button extracts the projected sea level data based on the selected area and dataset. It also displays the final map. When choosing a delimited area for which elevation data has not been downloaded, the ‘Download elevation data’ button is activated, which automatically downloads the necessary elevation raster.
- Reference map for selecting the area of interest. This map changes according to the chosen location and the entered boundaries. It resets with the ‘Reset map’ button.
- Button that activates the option to manually enter the latitude and longitude limits of the area of interest.
- Panel where users can enter the limiting latitudes in degrees. If the maximum value is less than the minimum, it automatically adjusts to one degree above the minimum. If the minimum value is greater than the maximum, it adjusts to one degree below the maximum.
- Panel where users can enter the limiting longitudes in degrees. If the maximum value is less than the minimum, it automatically adjusts to one degree above the minimum. If the minimum value is greater than the maximum, it adjusts to one degree below the maximum.
- The ‘Update map’ button refreshes the reference map and boundaries based on the values manually entered in the editable fields for latitudes and longitudes. The ‘Reset map’ button restores the map and boundaries to the initial global view. The ‘Select this area’ button confirms the selected area and extracts the limiting latitudes and longitudes. It is necessary to press this button to enable the SLR projection. To avoid large amounts of data that could overwhelm the computer, the selection area has been limited to 2 degrees on each side in the case of choosing the U.S. region, and it has been limited to 6 degrees on each side in the case of choosing the Global region. The RAM memory required for larger areas can easily exceed 64 GB.
- The Limits text box indicates the latitudes and longitudes in degrees that are currently stored as boundaries. If users modified the area of interest through interaction with the map, they must confirm it with the 'Select this area' button to update the boundaries.
In case the 1 arc-second digital elevation models (DEM) for the selected area are not already downloaded, an interface will appear that allows you to enter your Earthdata username and password (Figure 2). The password editable field has a black background and a changed font to hide the entered text, although it remains visible if users highlight the text with the pointer. After confirming the credentials with the 'Ok' button, you must press the ‘Download elevation data’ button. Once elevation data is downloaded, a warning message appears in red letters and the user credentials are removed for security. After the elevation files have been downloaded and the SLR projection button is pressed, the user must wait for the code to execute and the map to be displayed. The time it takes for the map to appear depends on the computer specifications and the size of the selected area. It is important to be patient and not press the buttons repeatedly, as the computer may become unresponsive. The map will be shown in a separate window from the user interface.
Description of local files and folders
- dataset-sis-water-level-change-timeseries-cmip6: This is the folder that stores the Copernicus dataset's NetCDF files.
- georasters: Folder that stores the 1/3 arc-second resolution terrain elevation .tif files.
- georasters1: Folder that stores the 1 arc-second resolution terrain elevation .zip files.
- CoastlinePrediction.mlapp: Application file that contains the code and user interface.
- countries.csv: File containing the list of countries with their coordinates.
- SLR_TF U.S. Sea Level Projections.csv: File containing sea level data from NOAA.
- noData.mat: File that keeps a record of coordinates without elevation data for the 1 arc-second resolution. This file is created by the application.
Demo
Sea Level Projection data
The 2022 Sea Level Rise Technical Report and accompanying datasets from the U.S. Sea Level Rise and Coastal Flood Hazard Scenarios and Tools Interagency Task Force provide sea level rise scenarios to 2150 by decade that include estimates of vertical land motion. These data are available at 1-degree grids along the U.S. coastline and downscaled specifically at NOAA tide-gauge locations. More details about this project can be found on its website [5].
If the U.S. region is selected, a search is conducted within the selected area and outside the selected area up to 1 degree beyond it, as shown in the Figure 3. Subsequently, a grid of interpolated data is created within the selected area, with the same resolution as the terrain elevation matrices. When the Global region is chosen, there is a single sea level for the entire world, so it is not necessary to create the interpolated matrix.
Figure 3. Sea level search area for NOAA Report 2022 dataset and U.S. region.
If the Copernicus dataset is chosen, the same interpolation procedure is performed both for the U.S. territory and for the entire world, as this reanalysis includes a global grid with a variable resolution. The resolution varies depending on the location as follows: 0.1° for coastal grid points. Ocean grid points: 0.25°, 0.5°, and 1° within 100 km, 500 km, and >500 km of the coastline, respectively. The variable considered is the mean sea level in meters, which does not include changes caused by tides or storms. Also, the option to choose a scenario does not apply to this dataset.
There is also the option to assign a sea level between 0 and 3 meters in the Given Sea Level option. Here, it is not necessary to create the interpolation grid, as there are no geolocated points, and the sea level is the same for the entire selected area.
Elevation Data Processing
The 1/3 arc-second resolution USGS .tif images are named by the top-left coordinate. A scheme of the downloaded files is shown in the Figure 4. In case a raster does not exist, the cell is considered empty, a NaN is assigned to the grid. If an outer row or column is entirely empty, it is removed to reduce memory usage. The elevation files from the Shuttle Radar Topography Mission with a resolution of 1 arc-second are named by the bottom-left corner, and the same procedure is applied to them.
Figure 4. Scheme of the selected area contrasted with elevation grid.
The 1/3 arc-second resolution images overlap by 12 rows and 12 columns, so it is necessary to remove this overlap. To do this, the cells that contain the elevation data are first processed vertically and then horizontally as described below (Figure 5).
Figure 5. Deletion of rows when the preceding cell is empty.
The purpose of this operation is to keep the matrices with the same dimensions so that they can be concatenated into a single matrix.
Figure 6. Deletion of rows when the preceding cell is full.
The same steps are applied horizontally, as shown in the Figure 7.
Figure 7. Deletion of columns to remove overlap.
Variation of the coastline
For all cases, the procedure consists of subtracting sea level rise from the terrain elevation, obtaining a new elevation referenced to the new zero level. This procedure is applied to the unified elevation matrix.
Future terrain elevation = Current terrain elevation - sea level rise
Because the selected area may have empty zones either due to the absence of elevation files or because the raster does not cover that area, a blue background is added to represent the ocean (Figure 8).
Reference
[1] W. Hu and S. Kolodziejski, "Coastline Prediction using Existing Climate Change Models," 2023. [Online]. Available: https://github.com/skolodz/SeaLevelPredictor?tab=readme-ov-file.
[2] U.S. Geological Survey, "1/3rd arc-second Digital Elevation Models (DEMs) - USGS National Map 3DEP Downloadable Data Collection: U.S. Geological Survey.," 2023. [Online]. Available: https://www.sciencebase.gov/catalog/item/4f70aa9fe4b058caae3f8de5.
[3] NASA JPL, "NASA Shuttle Radar Topography Mission Global 1 arc second," NASA EOSDIS Land Processes DAAC, 2013. [Online]. Available: https://doi.org/10.5067/MEaSUREs/SRTM/SRTMGL1.003.
[4] S. Muis, I. Apecechea, J. A. Álvarez, M. Verlaan, K. Yan, J. Dullaart, J. Aerts, T. Duong, R. Ranasinghe, D. le Bars, R. Haarsma and M. Roberts, "Global sea level change time series from 1950 to 2050 derived from reanalysis and high resolution CMIP6 climate projections," Copernicus Climate Change Service (C3S) Climate Data Store (CDS), 2022. [Online]. Available: DOI: 10.24381/cds.a6d42d60.
[5] W. V. Sweet, B. D. Hamlington, R. E. Kopp, C. P. Weaver, P. L. Barnard, D. Bekaert, W. Brooks, M. Craghan, G. Dusek, T. Frederikse, G. Garner, A. S. Genz, J. P. Krasting, E. Larour, D. Marcy, J. J. Marra, J. Obeysekera, M. Osler, M. Pendleton, D. Roman, L. Schmied, W. Veatch, K. D. White and C. Zuzak, "Global and Regional Sea Level Rise Scenarios for the United States: Updated Mean Projections and Extreme Water Level Probabilities Along U.S. Coastlines," NOAA Technical Report NOS 01. National Oceanic and Atmospheric Administration, National Ocean Service, Silver Spring, MD, 111 pp., 2022. [Online]. Available: https://oceanservice.noaa.gov/hazards/sealevelrise/noaa-nos-techrpt01-global-regional-SLR-scenarios-US.pdf.