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

The AMSR element of NASA’s Land, Atmosphere Near real-time Capability for Earth Observing Systems (LANCE) at the AMSR SIPS generates Level-2B swath and incremental Level-3 daily products from the AMSR2 instrument on JAXA’s GCOM-W1 satellite launched May 18, 2012. The AMSR2 instrument was designed to detect water in all its state phases in the environment and monitor the water processes that exert a strong influence on climate and weather. Near Real-Time (NRT) AMSR2 products are generally available 90 minutes after observation. Data are stored in HDF-EOS5 and netCDF-4 formats and are available via HTTPS from the EOSDIS LANCE system.

This data recipe employs Python to georeference and create GeoTIFF files of several selected data fields within the HDF-EOS5 files of LANCE NRT AMSR2 data. This data recipe requires a pre-installed version of Python 3.x and the necessary Python packages.

Data Recipe Type
Data Format Conversion
Supporting Software Information
TYPE ACCESS
Python Script Python Script Open Source Open Source
Dataset Information
This data recipe was developed for the NRT AMSR2 datasets including: 
 
NRT AMSR2 Unified L2B Global Swath Ocean Products
 
NRT AMSR2 Unified Global Swath Surface Precipitation GSFC Profiling Algorithm
 
NRT AMSR2 Unified L2B Half-Orbit 25 km EASE-Grid Surface Soil Moisture Beta V2
 
NRT AMSR2 Unified L3 Global Daily 25 km EASE-Grid Snow Water Equivalent 
 
NRT AMSR2 Unified L3 Daily 6.25 km Polar Gridded 89 GHz Brightness Temperatures
 
NRT AMSR2 Unified L3 Daily 12.5 km Brightness Temperature & Sea Ice Concentration
 
NRT AMSR2 Unified L3 Daily 25 km Brightness Temperature & Sea Ice Concentration Polar Grids
 
Please note that because these are near real-time (NRT) datasets, data files are only available for the past 14 days.
 
To follow along with the steps below, a pre-installed version of Python 3.x (here we use version 3.8) is required. Additionally, please install the following Python packages to run the data recipe: 

Also, the following GHRC codes are included in Geotiff_recipes.zip.

  • GHRC’s GIBScolors_utils (Map and access GIBS color scheme for AMSR2 products)
  • GHRC’s ConvSwath (Remap Ocean and Rain SWATH data to epsg4326 projection)
 
Use conda to set up an environment for running the data recipe code:
  1. exit from any conda environment:
    (1)  conda deactivate
  2. create a new conda environment with pre-installed Python 3.8, and activate the new environment:
    ​(2)  conda create --name env38 python=3.8
    ​(3)  conda activate env38
  3. install the following Python packages required by the data recipe code:
    ​(4)  conda install -c anaconda numpy
    ​(5)  conda install -c anaconda netcdf4
    ​(6)  conda install -c conda-forge gdal
    ​(7)  conda install -c conda-forge pyproj
    ​(8)  conda install -c anaconda scipy
                or install via pip:
                ​python -m pip install scipy
    ​(9)  conda install -c anaconda h5py

 

Step 1

Download the data needed for this data recipe. A free NASA Earthdata user account is required. If you do not have an account, you will first need to create one. Once your NASA Earthdata account has been created, you can download a HDF-EOS5 NRT LANCE AMSR2 data file to use with this data recipe. Simply follow this link to enter your account information, select and download a file.  Save the file to a desired location on your computer. Please note that the ocean, rain, and land data are in the ‘/level2’ directory; and the snow and seaice data in the ‘/level3’ directory.

 

 

Step 2

Open the Python environment installed on your computer and make sure the required Python packages outlined in the “How to Use” section are installed.

Step 3

Navigate to the GHRC GitLab page and download Geotiff_recipes.zip. Save it to your computer, then unzip it to get the following:
colormaps.zip
geotiff_ocean.py
geotiff_rain.py
geotiff_land.py
geotiff_snow.py
geotiff_seaice.py
GIBScolors_utils.py
ConvSwath.py

Step 4

Unzip colormaps.zip to get a folder labeled ‘colormaps’. It contains a set of colormap files to use. Save this folder to your computer.

Step 5

Make sure 'GIBScolors_utils.py' and ‘ConvSwath.py’ are under the same directory with the data recipe codes.

Step 6

Select the Python script you want to use and open it within your Python environment:

  1. How to convert LANCE NRT AMSR2 Ocean data to GeoTIFF Format using Python
    Code: geotiff_ocean.py
    This code converts total precipitable water (‘TotalPrecipitableWater’) in the AMSR2 NRT Ocean product in HDF-EOS5 format to GeoTIFF.
  2. How to convert LANCE NRT AMSR2 Rain data to GeoTIFF Format using Python
    Code: geotiff_rain.py
    This code converts total column water vapor (‘TotalColWaterVapor’) in the AMSR2 NRT Rain product in HDF-EOS5 format to GeoTIFF.
  3. How to convert LANCE NRT AMSR2 Land data to GeoTIFF Format using Python
    Code: geotiff_land.py
    This code converts the soil moisture (‘SoilMoistureNPD’) parameter in the AMSR2 NRT Land product in HDF-EOS5 format to GeoTIFF.
  4. How to convert LANCE NRT AMSR2 Snow data to GeoTIFF Format using Python
    Code: geotiff_snow.py
    This code converts the snow water equivalent (‘SWE’) parameter in the AMSR2 NRT daily snow product in HDF-EOS5 format to GeoTIFF.
  5. How to convert LANCE NRT AMSR2 Seaice data to GeoTIFF Format using Python
    Code: geotiff_seaice.py
    This code converts selected parameters in AMSR2 NRT SeaIce products in HDF-EOS5 format to GeoTIFF.
Step 7

Cloud optimized GeoTIFF (COG) is a GeoTIFF with an internal organization that structures tiling and overviews of an image when rendered in a HTTP browser upon range request for zooming in/out, in a scope that can extend to the entire globe. This enables efficient streaming of data portions of interest in visualization on the fly.

A COG file may provide several levels of lower resolution zoom-out overviews. A GeoTIFF can be converted to COG using GDAL from the command line:

$ gdal_translate in.tiff out.tiff -co COMPRESS=LZW -co TILED=YES
where in.tiff is the original GeoTIFF and out.tiff the COG converted from in.tiff.

To provide 3 levels of overviews (zoom-out factors) for example,

$ gdaladdo -r average in.tif 2 4 8
$ gdal_translate in.tiff out.tiff -co COMPRESS=LZW -co TILED=YES -co COPY_SRC_OVERVIEWS=YES

For other options, such as multi-band conversion, or compression options, please see the Cloud Optimized GeoTIFF website.

Dataset Name
NRT AMSR2 Unified L2B Global Swath Ocean Products
NRT AMSR2 Unified Global Swath Surface Precipitation GSFC Profiling Algorithm
NRT AMSR2 Unified L2B Half-Orbit 25 km EASE-Grid Surface Soil Moisture Beta V2
NRT AMSR2 Unified L3 Global Daily 25 km EASE-Grid Snow Water Equivalent
NRT AMSR2 Unified L3 Daily 6.25 km Polar Gridded 89 GHz Brightness Temperatures
NRT AMSR2 Unified L3 Daily 12.5 km Brightness Temperature & Sea Ice Concentration
NRT AMSR2 Unified L3 Daily 25 km Brightness Temperature & Sea Ice Concentration Polar Grids
Platform Global Change Observation Mission - Water 1 (GCOM-W1) 
Instrument Advanced Microwave Radiometer 2 (AMSR2)
Science Parameter Total Precipitable Water
Total Column Water Vapor
Soil Moisture
Snow Water Equivalent
Brightness Temperature; Sea Ice Concentration
Format HDF-EOS5
NRT AMSR2 Unified L2B Global Swath Ocean Products Data Information Data information
NRT AMSR2 Unified Global Swath Surface Precipitation GSFC Profiling Algorithm Data Information Data information
NRT AMSR2 Unified L2B Half-Orbit 25 km EASE-Grid Surface Soil Moisture Beta V2Data Information Data information
NRT AMSR2 Unified L3 Global Daily 25 km EASE-Grid Snow Water Equivalent Data Information Data information
NRT AMSR2 Unified L3 Daily 6.25 km Polar Gridded 89 GHz Brightness Temperatures Data Information Data information
NRT AMSR2 Unified L3 Daily 12.5 km Brightness Temperature & Sea Ice Concentration Data Information Data information
NRT AMSR2 Unified L3 Daily 25 km Brightness Temperature & Sea Ice Concentration Polar Grids Data Information Data information

 

Variable Description Dimension Units Scale Factor

TotalPrecipitableWater

Integrated water vapor in the atmospheric column

2D

mm

none

TotalColWaterVapor

Integrated water vapor in the atmospheric column

2D

mm

none

SoilMoistureNPD

Soil moisture as determined by the NPD algorithm

1D

cm3/cm3

none

SWE_NorthernDaily

Daily snow water equivalent (SWE); Northern Hemisphere

2D

mm

1

SWE_SouthernDaily

Daily snow water equivalent (SWE); Southern Hemisphere

2D

mm

1

SI_06km_NH_89H_DAY

89.0 GHz horizontal daily average brightness temperature; Northern Hemisphere

2D

degree of Kelvin

0.1

SI_06km_SH_89H_DAY

89.0 GHz horizontal daily average brightness temperature; Southern Hemisphere

2D

degree of Kelvin

0.1

SI_12km_NH_ICECON_DAY

Sea ice concentration daily average; Northern Hemisphere

2D

percent

none

SI_12km_SH_ICECON_DAY

Sea ice concentration daily average; Southern Hemisphere

2D

percent

none

SI_25km_NH_ICECON_DAY

Sea ice concentration daily average; Northern Hemisphere

2D

percent

none

SI_25km_SH_ICECON_DAY

Sea ice concentration daily average; Southern Hemisphere

2D percent none

 

Have you used our data? Register for updates