Skip to main content

In this data recipe, learn how to convert NASA's Land, Atmosphere Near real-time Capability for Earth observation (LANCE) Near Real-Time (NRT) AMSR2 Ocean data to GeoTIFF Format using Python. This code converts total precipitable water (‘TotalPrecipitableWater’) in the AMSR2 NRT Ocean product in HDF-EOS5 format to GeoTIFF.

Supporting Software Information

The Python script used in this data recipe is open source.

How to Use

This code converts total precipitable water (‘TotalPrecipitableWater’) in the AMSR2 NRT Ocean product in HDF-EOS5 format to GeoTIFF.

Step 1

Navigate to the folder on your computer where you have saved the AMSR2 NRT Ocean HDF-EOS5 data file. 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 ‘h5file’ highlighted in blue below (Line 51). 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 Ocean file after the last forward slash as shown.

Screenshot of data file and file path

Step 2

Documentation is provided in the Python code to outline what each section of code does. For this data recipe we are extracting the “TotalPrecipitableWater” parameter from the HDF-EOS5 file to create the GeoTIFF file.

Screenshot of code lines with the name of variable to be converted.

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 67). Again, the backslashes need to be changed to forward slashes.

Screenshot of code lines 65, 66, and 67 with the file path on line 67 highlighted.

Step 4

Read ‘TotalPrecipitableWater’, latitude, and longitude values from the input file.

Screenshot of code block for ‘TotalPrecipitableWater’, latitude, and longitude values from the input file.

Step 5

Call the remapping function ‘remapSwath()’ from ConvSwath.py to remap SWATH data to epsg4326 projection.

Screenshot of code block for remap

Step 6

Create and save a GEOTIFF file to a folder on your computer. Line 103 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 1, 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.

Screenshot of example code block for saving GeoTIFF.

Step 7

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

Screenshot showing file location.

Dataset Information

Dataset NameNRT AMSR2 Unified L2B Global Swath Ocean Products
PlatformGlobal Change Observation Mission - Water 1 (GCOM-W1) 
InstrumentAdvanced Microwave Radiometer 2 (AMSR2)
Science ParameterTotal Precipitable Water
FormatHDF-EOS5
Data InformationCMR Search

Key Parameters

VariableDescriptionDimensionUnitsScale Factor
TotalPrecipitableWaterIntegrated water vapor in the atmospheric column2Dmmnone

Details

Last Updated

Published on

Data Centers

Global Hydrometeorology Resource Center DAAC (GHRC DAAC)