How to convert LANCE NRT AMSR2 Land data to GeoTIFF Format using Python

This code converts the soil moisture (‘SoilMoistureNPD’) parameter in the AMSR2 NRT Land product in HDF-EOS5 format to GeoTIFF. Documentation is provided in the Python code to outline what each section of code does.

Data Recipe Type
Data Format Conversion
Supporting Software Information
TYPE ACCESS
Python Script Python Script Open Source Open Source

This code converts the soil moisture (‘SoilMoistureNPD’) parameter in the AMSR2 NRT Land product in HDF-EOS5 format to GeoTIFF. Documentation is provided in the Python code to outline what each section of code does.

Step 1

The output projection information that will be used to georeference the AMSR2 NRT Land data are defined below. The projection is NSIDC EASE-Grid Global.

Step 2

Navigate to the folder on your computer where you have saved the AMSR2 NRT Land HDF-EOS5 data file(s). From the address bar, copy the file path (i.e., ‘C:\Users\lwang\Documents\AMSR\data\’). Paste the file path within the quotation marks for the variable ‘files’ highlighted in blue below (Line 66). For Python, the backslashes need to be changed to forward slashes. At the end of the file path, add the filename of the AMSR2 NRT Land file after the last forward slash as shown.

The above shows how to make a GeoTIFF for a parameter from a single file. To make GeoTIFF from multiple input files, simply add all input files to the ‘files’ variable in Line 66:

An alternative way to specify multiple files to be processed is to comment off ‘files = …’ in Line 66, and uncomment Line 69 as shown below:

Step 3

Users can set ‘useGIBScolors’ to True/False to elect the use of GIBS color scheme or not. In the case of using GIBS color scheme, unzip the colormaps.zip in the code folder (i.e., unzipped from Geotiff_recipes.zip) to get a folder labeled ‘colormaps’. It contains a set of GIBS colormap files to use. Save this folder on your computer. From the address bar, copy the file path (i.e., ‘C:\Users\lwang\Documents\AMSR\colormaps\’). Paste the file path within the quotation marks for the variable ‘gibsMapDir’ highlighted in blue below (Line 77). Again, the backslashes need to be changed to forward slashes.

Step 4

For this data recipe we are extracting the “SoilMoistureNPD” parameter from the HDF-EOS5 file to create the GeoTIFF file (Line 73). In the case of multiple input files, a “for” loop is used to loop through each data file, extract ‘SoilMoistureNPD’, and concatenate (Line 83 to Line 89). Only take data with good samples (Line 96). Read latitude and longitude values from the input file (Line 100, 101).

..............

..............

 

Step 5

Perform a geographic transformation to georeference the data according to the NSIDC EASE-Grid Global parameters:

Step 6

Create and save a GEOTIFF file to a folder on your computer. Line 149 defines the GeoTIFF filename. Create or locate a folder on your computer where you would like this GeoTIFF file to be saved. As done in STEP 2, copy the file path and paste it within the code in the area highlighted in blue below. Make sure a forward slash is included at the end of the file path.

Step 7

Simply run the code and check your output folder, a GeoTIFF file should now be located within the folder.

 

Example of GeoTIFF files created by geotiff_land.py:

Dataset Name NRT AMSR2 Unified L2B Half-Orbit 25 km EASE-Grid Surface Soil Moisture Beta V2
Platform Global Change Observation Mission - Water 1 (GCOM-W1) 
Instrument Advanced Microwave Radiometer 2 (AMSR2)
Science Parameter Soil Moisture
Format HDF-EOS5
Data Information Data information

 

Variable Description Dimension Units Scale Factor
SoilMoistureNPD Soil moisture as determined by the NPD algorithm 1D cm3/cm3 none

 

Have you used our data? Register for updates