3. Polar2Grid Basics

All of the tools provided by Polar2Grid can be found in the bin directory of the extracted tarball. The majority of the scripts in the software bundle are bash wrappers around python software.

3.1. Basic Usage

The most common use of Polar2Grid is to convert satellite data files in to gridded image files. The following command can be used to create GeoTIFF single band images of all S-NPP VIIRS imager SDR calibrated data with accompanying geolocation files found in <path to files>/<list of files>.

$POLAR2GRID_HOME/bin/polar2grid.sh viirs_sdr gtiff -f <path to files>/<list of files>

This script takes advantage of the modular design of Polar2Grid; a user only needs to decide on a Reader and a Writer and provide them to polar2grid.sh. In Polar2Grid the <path to files> will be searched for the necessary files to make as many products as possible. Similarly if processing errors occur Polar2Grid will attempt to continue processing to make as many products as it can.

For example, executing the command above will create 8-bit GeoTIFF files of all M-Band, I-Band, and Day/Night Band SDR files it finds in the directory as long as it contains the matching geolocation files. If multiple granules are provided to polar2grid.sh they will be aggregated together. By default the above command resamples the data to a Google Earth compatible Platte Carrée projected grid at ~600m resolution, but this can be changed with command line arguments.

3.2. Common Script Options

Additional command line arguments for the polar2grid.sh script and their defaults are described in the related Reader or Writer sections. Options that affect remapping are described in the Remapping section. Additionally all Polar2Grid bash scripts accept a -h argument to list all the available command line arguments. Although the available command line arguments may change depending on the reader and writer specified, there are a set of common arguments that are always available:

-h

Print helpful information.

--list-products

List all possible product options to use with -p from the given input data.

-p

List of products you want to create.

-f

Input files and paths.

--grid-coverage

Fraction of grid that must be covered by valid data. Default is 0.1.

-g <grid_name>

Specify the output grid to use. Default is the Platte Carrée projection, also known as the wgs84 coordinate system. See Grids and Custom Grids for information on possible values.

-v

Print detailed log information.

Examples:

polar2grid.sh modis gtiff --list-products -f <path to files>/<list of files>

polar2grid.sh viirs gtiff -p i01 adaptive_dnb -g polar_alaska_300 --grid-coverage=.25 -v -f <path to files>

For information on other scripts and features provided by Polar2Grid see the Utility Scripts section or the various examples throughout the document.

3.3. Reader/Writer Combinations

The tables below provide a summary of the possible combinations of readers and writers and expectations for the inputs and outputs of polar2grid.sh. To access these features provide the “reader” and “writer” names to the polar2grid.sh script followed by other script options:

$POLAR2GRID_HOME/bin/polar2grid.sh <reader> <writer> --list-products <options> -f /path/to/files
Table 3.1 Reader/Writer Summary Table (Subset of Readers)

Input Source

Input Filename Pattern

Output Type

Reader Name

Writer Name

Suomi-NPP VIIRS Sensor Data Records

SVI01_npp_*.h5 GITCO_npp_*.h5

8-bit single band GeoTIFF

viirs_sdr

gtiff

AWIPS NetCDF

viirs_sdr

scmi

HDF5

viirs_sdr

hdf5

Binary

viirs_sdr

binary

24-bit true and false color GeoTIFF

crefl

gtiff

Aqua and Terra MODIS Level 1b (IMAPP or NASA archive files)

MOD021KM*.hdf MOD03*.hdf

or

t1.*1000m.hdf t1.*.geo.hdf

8 bit single band GeoTIFF

modis

gtiff

AWIPS NetCDF

modis

scmi

HDF5

modis

hdf5

Binary

modis

binary

24-bit true and false color GeoTIFF

crefl

gtiff

NOAA-18, NOAA-19,Metop-A,-B,-C AVHRR AAPP Level 1b

hrpt_noaa18_*.l1b

8 bit single band GeoTIFF

avhrr

gtiff

AWIPS NetCDF

avhrr

scmi

HDF5

avhrr

hdf5

Binary

avhrr

binary

GCOM-W1 ASMR2 L1B

GW1AM2*L1DLBTBR*.h5

8 bit single band GeoTIFF

amsr2_l1b

gtiff

AWIPS NetCDF

amsr2_l1b

scmi

HDF5

amsr2_l1b

hdf5

Binary

amsr2_l1b

binary

FY3-D MERSI2 L1B

tf*.FY3D-X_MERSI_*_L1B.HDF

8 bit single band GeoTIFF, 24-bit true and false color GeoTIFF

mersi2_l1b

gtiff

HDF5

mersi2_l1b

hdf5

Binary

mersi2_l1b

binary

CLAVR-x Cloud Retrievals

clavrx*.hdf

8 bit single band GeoTIFF

clavrx

gtiff

AWIPS NetCDF

clavrx

scmi

HDF5

clavrx

hdf5

Binary

clavrx

binary

ACSPO Sea Surface Temperatures

*-STAR-L2P_GHRSST-SSTskin-*.nc

8 bit single band GeoTIFF

acspo

gtiff

AWIPS NetCDF

acspo

scmi

HDF5

acspo

hdf5

Binary

acspo

binary

3.4. Creating Your Own Custom Grids

The Polar2Grid software bundle comes with a wrapper script for the Custom Grid Utility for easily creating Polar2Grid grid definitions over a user determined longitude and latitude region. Once these definitions have been created, they can be provided to polar2grid.sh. To run the utility script from the software bundle wrapper run:

$POLAR2GRID_HOME/bin/p2g_grid_helper.sh ...

See the script’s documentation for more information on how to use this script and the arguments it accepts.