Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Lab 11: Bathymetry with ICESat-2 in Python and QGIS

In this lab, we will explore how to use lidar data from NASA’s ICESat-2 satellite to estimate bathymetry from space. We will see how to use both Python and QGIS side-by-side to make nice maps with corresponding plots.

This notebook has three main parts organized as follows:

  1. Find and download ICESat-2 data from the NSIDC web interface

  2. Plot and interpret ICESat-2 data

  3. Visualize ICESat-2 ground tracks in QGIS

Import the modules for this notebook

To begin, let’s import the modules used for this notebook

As always, also define a lab folder:

Motivation

The ocean floor in shallow coastal areas is not typically well-mapped with multibeam echo sounders to generate high resolution bathymetry maps due to the dangers posed to vessels operating in these regions. However, this bathymetric information is often important for understanding coastal ecosystems, such as coral reefs, as well as coastal hazards for ships operating in coastal environments.

One alternative for examining bathymetry in coastal areas is lidar, which can detect sea floor returns in shallow water and favorable conditions. In this lab, we will work with lidar data from the ICESat-2 satellite. We will use Python to access and plot data and we’ll use QGIS for generating a nice map. At the end of this lab, you should be able to create a nice side-by-side figure of an approximated bathymetry profile using lidar data and an equivalent map showing where the lidar track is on the ground.

Generate a base map

To begin this lab, download some Landsat 8 or 9 data for the region around Kiribati - an island nation in the Pacific Ocean. Follow the steps from Lab 2 to gather the data from EarthExplorer and make a nice figure in QGIS.

Kiribati is located at approximately 1.95°N, 157.45°W. With a look forward to the subsequent parts of this lab, gather data around the date September 20, 2025.

Your figure should resemble the following figure when completed:

Screenshot of a “Natural Color” Landsat 9 image of Kiribati generated in QGIS.

Figure 1:Screenshot of a “Natural Color” Landsat 9 image of Kiribati generated in QGIS.

As we can see in the image above, Kiribati has a large lagoon on its main island. In this lab, we will visualize the depth of this lagoon using ICESat-2.

Part 1: Downloading Data using NSIDC

To gather ICESat-2 data for this location, we will use a query in the National Snow and Ice Data Center ICESat-2 ATL03 Product. We will use the NSIDC data access tool to find data for our time and location of interest.

Defining a Query on the NSIDC Webpage

Using the information given above, build a query to search for a file in the time range 9/20/25-9/21/25 and a spatial range bounded by -157.59°W, 1.8°S, -157.28°W, and 2°N.

Your query should look like the following screenshot:

Screenshot of a data request from the NSIDC portal for an ICESat-2 ATL03 granule.

Figure 2:Screenshot of a data request from the NSIDC portal for an ICESat-2 ATL03 granule.

Next, click the Download Script button at the bottom of the page and store the script as nsidc.py in your lab folder. We can access this file in our Jupyter book by ensuring our data_folder is on our searchable Python path:

Defining a Query in Python

The download script obtained above can be run as-is to download the files that match out time and region of interest, as listed on the NSIDC site. This works because the file has actually hard-coded the info we put into our query in the script:

short_name = "ATL03"
version = "007"
time_start = "2025-09-20T07:00:00Z"
time_end = "2025-09-21T06:59:59Z"
bounding_box = "-157.59,1.8,-157.28,2"

However, the script also contains tools for us to run the query and download the files ourselves. Here, we’ll implement this query in Python to make our script flexible for future queries:

Query NSIDC for a list of URLs matching the criteria

Querying for data:
	https://cmr.earthdata.nasa.gov/search/granules.json?&sort_key[]=start_date&sort_key[]=producer_granule_id&page_size=2000&short_name=ATL03&version=007&version=07&version=7&temporal[]=2025-09-20T00:00:00Z,2025-09-21T23:59:59Z&polygon=-157.59,1.8,-157.28,1.8,-157.28,2.0,-157.59,2.0,-157.59,1.8&provider=NSIDC_CPRD

Found 1 matches.

Filter the url list to only contain h5 files

When you query the files, you may pick up additional files, such as xml files. The code block below will filter out extraneous files.

Let’s print them out to see our results:

['https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL03/007/2025/09/20/ATL03_20250920125813_00912907_007_01.h5']

As you can see, this matches the file list obtained on the NSIDC web interface.

Subset to the number of files indicated above

If desired, you can also use the download cap to limit the number of files that are downloaded when exploring different collections of files:

Run the downloading script

The cmr_download method will download the files found in the NSIDC database.

Downloading 1 files...
1/1: ATL03_20250920125813_00912907_007_01.h5
  [============================================================] 100%  13.6MB/s   

Note that these files will download into the same directory where you are running your notebook. You can move these files to your data_folder with the following script:

Part 2: Plotting ICESat-2 Data

Now that we’ve gathered our ICESat-2 data, we will next plot the data from our file. First, we’ll read in a subset of the data and then we’ll examine what this looks like on a plot.

Read in the elevation data

Using the h5py module, we can access data from h5 files in the same way as for netCDF files. And you can also open them in the same way using Panoply! Open the file in Panoply first and examine the structure. Then, leverage this info to read the file in the following section:

As with most data, there are values flagged as nonsense in the ICESat-2 data files. Before plotting them, be sure to remove these points or mask them:

Subset the data

The ICESat-2 data tracks tend to span a much larger area that we are interested in. To help with the interpretation, we can subset the data to our region of interest:

Plot the data

Plot the point cloud from the ICESat-2 file:

<Figure size 1000x400 with 2 Axes>

🤔 Consider these questions:

  1. Where is the sea level in the elevation plot?

  2. What other features do you see?

  3. We might expect elevation to be 0 at sea level, but that’s not the case. What is going on here?

Removing the Geoid

In the plot above, we saw that the elevation was not 0 at sea level. Part of this explanation is that the photon heights include the geoid. Information on the geoid height is included in the file along a reference track. Let’s read that in here:

This reference track does not include samples for each of the returned photons but instead along the reference track. Using strategies from the previous lab, we can interpolate the geoid values to the returned photon values:

Let’s plot the geoid heights and see how this changes our interpretation of the elevation:

<Figure size 1000x400 with 2 Axes>

🤔 Consider these questions:

  1. How does the removal of the geoid affect our interpretation of the elevation values?

  2. With these changes, we might expect elevation to be 0 at sea level, but that’s still not the case. What is going on here?

  3. What else should be considered here when generating a bathymetry map from this calculation?

Part 3: Writing Data to Shapefiles

In the plots above, we get a sense of where the ground track is by looking at the longitude and latitude values. However, we often want to visualize data on plots as well as maps in GIS. There are several packages in Python to convert geospatial datasets to shapefiles for viewing and editing in GIS. Here, we’ll use the shapefile package to generate a shapefile of the ground track locations for use in QGIS.

Slice the data

When reading in the files, the data are going to be very dense - there’s almost 30,000 points. To make the datasets easier to work with and plot, it’s helpful to subset the data using a defined skip interval:

Write the shapefile

Once the data has been extracted from the file and isolated, it can be written out to a file:

Now, pop over to QGIS and import the data. Then, format the shapefile to show your ground track on your satellite image. When complete, output the image to a file called Kiribati_ATL03.png in your data folder. When complete, run the following code to generate a nice figure of your profile and the results:

<Figure size 1000x400 with 2 Axes>

🤔 Try it for yourself!

Using this same approach, examine another region in the ocean with shallow bathymetry. Keep in mind that the water needs to be relatively clear and shallow for this approach to work. A good test when considering your area of interest: if you can’t see the ocean floor with your eyes, ICESat-2 probably can’t see it either.