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 |
TYPE | ACCESS | ||
---|---|---|---|
Python Script | Open Source |
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)
-
exit from any conda environment:
(1) conda deactivate -
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 -
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
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.
Open the Python environment installed on your computer and make sure the required Python packages outlined in the “How to Use” section are installed.
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
Unzip colormaps.zip to get a folder labeled ‘colormaps’. It contains a set of colormap files to use. Save this folder to your computer.
Make sure 'GIBScolors_utils.py' and ‘ConvSwath.py’ are under the same directory with the data recipe codes.
Select the Python script you want to use and open it within your Python environment:
-
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. -
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. -
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. -
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. -
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.
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.
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 |