Knowledge Base

Subsetting and Reformatting with the NSIDC PyRS Docker Container

The NSIDC Python Reformatting and Subsetting (PyRS) tool is a user prompt command line tool for data reformatting and subsetting. PyRS is designed to work with select datasets in binary format:

It provides the option to reformat the output to GeoTIFF or NetCDF-3. Spatial subsetting is also available as a bounding box method for each data set listed above. PyRS is developed as a Docker container, which eliminates the need to manually update individual dependencies. To successfully use this tool, you will need admin privileges to download Docker to your machine, and you will need to be comfortable working in command line. The Docker application and PyRS tool will require about 3.3 Gb of disk space in total.

Steps for setting up and running PyRS

Note: This assumes that you have already downloaded the data.

Step 0 (SNODAS Users Only): Prepare data for PyRS

If you are working with SNODAS data, you will need to first unpack the daily data. Each daily *.tar file must be untarred to reveal a daily directory containing both *.dat.gz files and *.Hdr.gz files. Remove / relocate the .Hdr.gz files, and uncompress the .dat files. place all *.dat files that you would like to have subset/reformatted by PyRS into a single directory. 

Step 1: Download and run the Docker Community Edition application

Navigate to the Docker Community Edition web page and select the application matching your operating system, follow instructions to complete installation, and run the program. Please wait until you notice that Docker is 'up and running'. In a Linux environment, the Docker symbol will be present in the top navigation bar.

Step 2: Pull NSIDC PyRS Container from Repository and set up working paths

The following (linux-based) command example will grab PyRS from the NSIDC Docker repository and set up both input and output paths. An 'image' of PyRS will be installed on your local machine (~2Gb). This image is executable, and when the image runs it is called a container.

docker run -it --rm -v /Path/to/your/data/:/DATASETS -v /Path/to/output/data/:/output  nsidc/pyrs_container:v1.1.0

/Path/to/your/data/ = your unique system path
:/DATASETS and :/output = directories created in the container and it is advised to not change these
-it = interactive terminal
--rm = remove container after exiting
-v = mounts volume to container directory

Step 3: Run PyRS

You now have a running Docker container that acts like an interactive terminal, connected to your data directory. The next command to issue is simply: pyrs

This will run the PyRS code, prompting you to enter the dataset ID, and data service preferences. When asked for input directory, type: /DATASETS

When asked for output directory, type /output 

To exit the container, type: exit

Reusing the PyRS image

If PyRS needs to be run again in the future, you can work with the same image downloaded through Docker. Make sure that Docker is up and running, then follow steps 2 and 3 above for setting up your pathways and executing the PyRS code.

Last Updated October 2019