Transforming SNODAS to tif files

This data is in an old format and instructions on the snodas site a bit cumbersome to work with. So here is pure python code to transform it to a tif file for use in all GIS software. This is after the files are downloaded and decompressed.

You actually open the metadata file (.txt. here) and the accompanying dat file will be read automatically as long as its in the same directory.

import rasterio


metadata_file = 'zz_ssmv11034tS__T0001TTNATS2016013105HP001.txt'
dst_tif_file = 'zz_ssmv11034tS__T0001TTNATS2016013105HP001.tif'

with rasterio.open(metadata_file) as src:
    src_profile = src.profile
    # Switch driver to tiff with compression
    src_profile.update(driver = 'GTiff',compress='lzw',)

    with rasterio.open(dst_tif_file, 'w', **src_profile) as dst:
        dst.write(src.read())
4 Likes