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. As an example, 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 -r viirs_sdr -w geotiff -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. The GeoTIFF contains 2 bands, including an Alpha band.

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:

-r

Instrument input files to read from.

-w

Output format to write to.

-h

Print helpful information.

--list-products

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

--list-products-all

List available polar2grid products options and custom/Satpy products and exit.

-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.

--num-workers NUM_WORKERS

Specify number of worker threads to use (Default: 4).

--progress

Show processing progress bar (Not recommended for logged output).

-v

Print detailed log information.

Examples:

polar2grid.sh -r viirs_sdr -w geotiff -p i01 dynamic_dnb -g polar_alaska_300 --grid-coverage=.25 -v -f <path to files>

polar2grid.sh -r modis_l1b -w geotiff --list-products -f <path to files>/<list of 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 -r <reader> -w <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

geotiff

AWIPS NetCDF

viirs_sdr

awips_tiled

HDF5

viirs_sdr

hdf5

Binary

viirs_sdr

binary

24-bit true and false color GeoTIFF

viirs_sdr

geotiff

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_l1b

geotiff

AWIPS NetCDF

modis_l1b

awips_tiled

HDF5

modis_l1b

hdf5

Binary

modis_l1b

binary

24-bit true and false color GeoTIFF

modis_l1b

geotiff

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

hrpt_noaa18_*.l1b

8 bit single band GeoTIFF

avhrr_l1b

geotiff

AWIPS NetCDF

avhrr_l1b

awips_tiled

HDF5

avhrr_l1b

hdf5

Binary

avhrr_l1b

binary

GCOM-W1 ASMR2 L1B

GW1AM2*L1DLBTBR*.h5

8 bit single band GeoTIFF

amsr2_l1b

geotiff

AWIPS NetCDF

amsr2_l1b

awips_tiled

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

geotiff

HDF5

mersi2_l1b

hdf5

Binary

mersi2_l1b

binary

CLAVR-x Cloud Retrievals

clavrx*.hdf

8 bit single band GeoTIFF

clavrx

geotiff

AWIPS NetCDF

clavrx

awips_tiled

HDF5

clavrx

hdf5

Binary

clavrx

binary

ACSPO Sea Surface Temperatures

*-STAR-L2P_GHRSST-SSTskin-*.nc

8 bit single band GeoTIFF

acspo

geotiff

AWIPS NetCDF

acspo

awips_tiled

HDF5

acspo

hdf5

Binary

acspo

binary

3.4. Creating Your Own Custom Grids

The Polar2Grid software bundle comes with a script for Custom Grid Utility that allows users to easily create Polar2Grid custom grid definitions over a user determined longitude and latitude region. Once these definitions have been created, they can be provided to Polar2Grid. 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.