Knowledge Base

How do I convert SNODAS binary files to GeoTIFF or NetCDF?

This article will describe the use of Geospatial Data Abstraction Library (GDAL) tools for converting SNODAS binary files to NetCDF or GeoTIFF.

Before working through the rest of this tutorial, we would like to make you aware of a small spatial data shift that occurs on Oct 01, 2013 in the SNODAS period of record. On this date, the data provider, National Operational Hydrologic Remote Sensing Center (NOHRSC) slightly changed the center coordinates of the grid to align with an integer value of latitude and longitude. The resulting shift is minute, and on the order of 1/4 of a 1km grid cell. If you decide your study is insensitive to this change, please use the static geospatial bounds presented within the example. If you wish to account for the shift in your study, you can find the spatial bounds for the data both before and after the Oct 01, 2013 change in Appendix 2 of this How To document.

You will first need to have GDAL installed on your system before proceeding on to the following steps. NSIDC User Services is not able to provide support for installing GDAL, but we have found using a package manager such as MacPorts ( simplifies the installation process on a Mac. There are additional package managers available for Linux users. A good way to test whether or not you have installed GDAL correctly is to issue the 'gdalinfo --version' command. This should return the version of your installation. 

1. Unzip and untar all data if you have not already:

'gunzip *.gz' should do the trick if you work in a linux environment. Then, 'tar -zxvf *.tar'.

2. Using a text editor, create an ENVI header file with the following information for masked data¹ (files beginning with 'us'):

samples = 6935
lines   = 3351
bands   = 1
header offset = 0
file type = ENVI Standard
data type = 2
interleave = bsq
byte order = 1

3. Save the header file using the exact same file name as the data file you are converting, but with a .hdr extension.

For example, the "us_ssmv01025SlL01T0024TTNATS2004010105DP001.dat" filename is used to create "us_ssmv01025SlL01T0024TTNATS2004010105DP001.hdr".

4. Ensure your working directory contains both the .hdr file and the .dat file, then issue the following commands:

for masked data:

gdal_translate -of GTiff -a_srs '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' -a_nodata -9999 -a_ullr  -124.73333333 52.87500000 -66.94166667 24.95000000 <input.dat> <output.tif>

gdal_translate -of NetCDF -a_srs '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' -a_nodata -9999 -a_ullr -124.73333333 52.87500000 -66.94166667 24.95000000 <input.dat> <>

A common error that can be thrown after issuing the 'gdal_translate ...' command is "Error 4: <input.dat> not recognized as a supported file format. Depending on your system, GDAL might be confused between the .hdr you created and the .Hdr which came with the data. If this occurs, try storing the .Hdr files outside of the working directory and trying again.

¹For unmasked data, you will need to open the .Hdr files delivered with the data and adjust the ENVI header and bounding coordinates in the GDAL string accordingly.

Appendix 1. Conversion example for unmasked SNODAS data.

gdal_translate -of GTiff -a_srs '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' -a_nodata -9999 -a_ullr -130.516666666661 58.2333333333310 -62.2499999999975 24.0999999999990 34.dat 34.tif

and header file should be: 

header offset=0
file type=ENVI Standard
data type=2
byte order=1

Appendix 2. Spatial bounds to feed into GDAL -ullr flag for pre and post Oct 01 2013.

Pre Oct 01 2013: -124.73375000 52.87458333 -66.94208333 24.87458333

Post Oct 01 2013: -124.73333333 52.87500000 -66.94166667 24.95000000

86,5 Bot