How to attach geo-coding information from another file?

Hi friends,

I’ve started to work with new harmonized Sentinel-2/Landsat-8 project
For each Landsat-8 sensing dates there are 2 files there. One of them - huge .hdf file with all the information, but without geo-coding, and the second one is a tiny .hdf.hdr file which has geo-coding.
Because of lacking geo information in the first file I can’t do anything with it. I even can’t resample it or add a polygon. When I go to Analyses\geo-coding it shows me that no such information there. But in the tiny file there are many rows of information there, so I struggle to append such information from one file to another.
Please, give me a clue, how can I attach geo0coding information from one file to another?

Thank you!

The NASA OCSSW Processing System has support for Landsat-8. It is basically a command-line system for linux and macOS, but there is support in the SeaDAS 7 GUI. SeaDAS 7 is based on BEAM, and has beampy. Here is a beampy script to add navigation from one file to a file that lacks navigation. I haven’t tried it with snappy, but it has been used on Windows.

# read a sourceProduct, copy navigation from a template sourceProduct, 
# and save to NetCDF4-CF
import sys
import numpy
from beampy import String
from beampy import Product
from beampy import ProductData
from beampy import ProductIO
from beampy import ProductUtils
if len(sys.argv) != 4:
print("usage: %s <source_file> <nav_file> <outfile>" % sys.argv[0]);
sourceProduct = ProductIO.readProduct(sys.argv[1])
width = sourceProduct.getSceneRasterWidth()
height = sourceProduct.getSceneRasterHeight()
name = sourceProduct.getName()
description = sourceProduct.getDescription()
band_names = sourceProduct.getBandNames()
print("sourceProduct: %s, %d x %d pixels, %s" % (name, width, height, description))
print("Bands:   %s" % (list(band_names)))\
navProduct = ProductIO.readProduct(sys.argv[2])
ProductUtils.copyGeoCoding(navProduct, sourceProduct)
ProductIO.writeProduct(sourceProduct,  sys.argv[3], 'NetCDF4-CF')  
1 Like

This is a stupid format. Normally NASA can do it better.

To get the geo-information to the data you don’t even need beampy or snappy.
It can be done with one command line call, at least in snap.
Both product can be merged. This is an example:

gpt Merge -PgeographicError=NaN -SmasterProduct=“G:\EOData\HDF\HLS\HLS.L30.T29SPC.2017008.v1.3.hdf.hdr” -SdataProduct=“G:\EOData\HDF\HLS\HLS.L30.T29SPC.2017008.v1.3.hdf” -t “G:\EOData\HDF\HLS\” -f NetCDF4-CF

It is important that the *.hdr file is used as master and the parameter geographicError is set to NaN.
As target format you can also choose some other format.

Landsat is run by the US Geological Survey (USGS). NASA gets to play with better toys, so we can expect more from them.

Thanks. That works where I was using beampy (using gpt in SNAP), but gives

WARNING: org.esa.snap.core.gpf.common.MergeOp: Wrongly configured operator. Tiles should not be requested.

The resulting file loads in Panoply, has lon and lat 1D vectors, but also “band_1” 2D unsigned byte array filled with zero bytes.

I haven’t got this message. I have used the current development version. Now checked with version 5 and I got the message too. So better wait for the next release. It’s not far away anymore.

Thank you for answers!
Finally, I’ve been managed to solve the problem using Spatial subset in ENVI. After that SNAP opens the files created and everything goes smoothly.