How to convert LANCE NRT AMSR2 Seaice data to GeoTIFF Format using Python
This code converts selected parameters in AMSR2 NRT Seaice products 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 |
TYPE | ACCESS | ||
---|---|---|---|
Python Script | Open Source |
This code converts selected parameters in AMSR2 NRT Seaice products in HDF-EOS5 format to GeoTIFF. Documentation is provided in the Python code to outline what each section of code does.
The output projection information that will be used to georeference the Northern and Southern hemisphere AMSR2 NRT Snow data are defined. These projections are NSIDC Sea Ice Polar Stereographic North and NSIDC Sea Ice Polar stereographic South.
Navigate to the folder on your computer where you have saved the AMSR2 NRT Seaice 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 40). 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 Seaice file after the last forward slash as shown.
The code defines which data parameter layer(s) in the HDF-EOS5 file will be used to create the GeoTIFF files. This code applies to three Sea Ice products whose spatial resolutions are 6, 12 and 25 km, respectively (i.e., ‘SeaIce6km’, ‘SeaIce12km’ and ‘SeaIce25km’). For ‘SeaIce6km’ product, the ‘89H_DAY’ parameter is extracted and create the GeoTIFF file. For ‘SeaIce12km’ and ‘SeaIce25km’, the ‘ICECON_DAY’ parameter is extracted.
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 58). Again, the backslashes need to be changed to forward slashes.
A “for” loop is used to extract the Northern/Southern hemisphere parameters (i.e., ‘SI_25km_NH_ICECON_DAY ‘, ‘SI_25km_SH_ICECON_DAY ‘; variable labeled ‘vname’ in Line 81) and defines the projection accordingly. Read latitude and longitude values from the input file (Line 89 to Line 92).
Perform a geographic transformation to georeference the data according to the NSIDC North/South EASE-Grid parameters:
Create and save a GEOTIFF file to a folder on your computer. Line 115 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.
Simply run the code and check your output folder, two GeoTIFF files should now be located within the folder.
Example of GeoTIFF files created by geotiff_seaice.py:
Variable | Description | Dimension | Units | Scale Factor |
---|---|---|---|---|
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 |