Import NASA DEM in GRASS GIS
Easy and quick using the r.in.nasadem addon
NASADEM
After nearly 20 years, a major update of the Shuttle Radar Topography Mission (SRTM) data was released in February this year. The product is called NASADEM, and consists of a combination of reprocessed SRTM data and auxiliary data from a variety of sources, including ASTER GDEM and Advanced Land Observing Satellite (ALOS) (Crippen et al. 2016). The dataset consists of three different layers: hgt, num and swb. The hgt layer is the void-filled DEM. The category values of the num layer indicate the number of DEM tiles used and the source of the data. And the swb layer is the updates SRTM water body data, with two classes; 0 for land and 255 for water. See for more information the NASADEM website or this comparison guide.
Importing in GRASS
GRASS GIS is one of the better tools to work with large high resolution raster data. And it has always been relatively easy to import raster data like the SRTM DEM into GRASS GIS (Neteler 2005). This applies to the NASADEM data as well. But with the r.in.nasadem add-on, developed by Markus Metz, it is just downright easy. The add-on imports all NASADEM tiles covering the current region, or region extents given with the region option into GRASS, and automatically patches the tiles together.
For the readers less familiar with GRASS GIS, the computational region is a cornerstone concept in GRASS GIS. The region defines the extent and resolution at which raster operations are carried out. Read the Wiki page for more information.
To import the NASADEM data for your area, you first need to install the r.in.nasadem addon. You can use the g.extension for this. Furthermore, to get access to the data, you’ll need to register at the Earthdata website. After registration, go to your user profile on the earthdata site and make sure the LP DAAC Data Pool and Earthdata Search applications are approved.
Now we can start with importing the data. The data comes in WGS 84 (EPSG 4326). Therefore, you need to import the data in a location with that reference coordinate system. If you don’t know what a location means in this context, read here about how a grass gis database is structured.
In your mapset, make sure to set the extent to match the region for which you want to download the data. Furthermore, set the resolution to 1 arc-second, which is the resolution of the NASADEM data. In this example, I’ll set the region to match a region in the central Oder valley in Poland.
You can run this directly from the command line, you can use the GUI, or using Python code. For the latter, you’ll need to import the PyGRASS module.
Go the Settings menu and select computational region > set region. Or you type g.region
on the command line. Either way, you’ll get the g.region screen . Under the Bounds tab, fill in the upper, lower, left and right edges. In addition, select the Align region to resolution box to ensure the resolution will be exactly 1 arc-seconds.
Under the Resolution tab > 2D grid resolution fill in the target resolution (1 arc seconds).
And of course, don’t forget to push the Run button.
After installing the r.in.nasadem addon, you can find it under the Modules tab, in the Addons section. Alternatively, run r.in.nasadem
on the command line or in the Console. Below, I’ll import the data for the region I defined above. To state the obvious, replace ‘your_username’ and ‘your_password’ with your own username and password of your account on EarthData.
I already filled in the name of the output raster, NASAdem. Under the tab Optional you can probably leave the default NASADEM version as it is. Likewise, keep the NASADEM layer to hgt, unless you want to import one of the other two available layers. The user name and password are for the Earth data website mentioned above. You can leave the base URL as it is, unless you already have downloaded the data, in which case you have to point the addon to the right folder.
As mentioned above, the r.in.nasadem imports all tiles required to cover this region, and patched them together. The resulting map likely covers a larger area than your study region. If you only want to keep the data for your study area, you can use r.mapcalc, like in the example below.
So what did I do just there? Remember that the region defines the extent and resolution at which raster operations are carried out. So the output of any raster calculation is limited to the region extent. Furthermore, note that I use the -overwrite flag as GRASS GIS by default does not overwrite existing layers. There are other ways to do this, but this method is easy and results in raster layers with exactly the required extent and resolution. Did I already mention how much I like this concept of the computational region?
OK, and a mandatory image below created using the wxGUI 3D View Mode in GRASS. If you hover over the image, the colors representing the elevation are replaced by colors representing the different Corina Land Cover (CLC) categories (Copernicus 2019).
One thing about the SRTM is that in areas with a moderate to thick vegetation canopy, the elevation as provided by the SRTM is close to that of the canopy top rather than ground level (JPL 2020-06-27; Weydahl et al. 2007; Orlandi et al. 2019). You can see this fairly clearly if you compare the elevation map with the CLC map (the green colors on the CLC map represent various forest types).