LPDAAC Tutorial Error
Posted: Mon Dec 06, 2021 2:16 pm America/New_York
I am having trouble following the "Working with Daily NASA VIIRS Surface Reflectance Data" tutorial from the LP DAAC here: https://lpdaac.usgs.gov/resources/e-lea ... ance-data/
Issue:
Any step in the tutorial which references a .value produces an "Attribute Error." Specifically, "AttributeError: 'Dataset' object has no attribute 'value.'" I have confirmed that there is no attribute 'value' using dir(f['HDFEOS INFORMATION']['StructMetadata.0']) for step 2a below.
Steps that Error:
2a) Below, read the file metadata and store as a list
fileMetadata = f['HDFEOS INFORMATION']['StructMetadata.0'].value.split() # Read file metadata
fileMetadata = [m.decode('utf-8') for m in fileMetadata] # Clean up file metadata
fileMetadata[0:33] # Print a subset of the entire file metadata record
3a) Apply a Scale Factor
red = r.value * scaleFactor
green = g.value * scaleFactor
blue = b.value * scaleFactor
nir = n.value * scaleFactor
AND MANY MORE STEPS
Request:
Please advise on an additional way to source values from the .h5 file, or another workaround for the tutorial.
Issue:
Any step in the tutorial which references a .value produces an "Attribute Error." Specifically, "AttributeError: 'Dataset' object has no attribute 'value.'" I have confirmed that there is no attribute 'value' using dir(f['HDFEOS INFORMATION']['StructMetadata.0']) for step 2a below.
Steps that Error:
2a) Below, read the file metadata and store as a list
fileMetadata = f['HDFEOS INFORMATION']['StructMetadata.0'].value.split() # Read file metadata
fileMetadata = [m.decode('utf-8') for m in fileMetadata] # Clean up file metadata
fileMetadata[0:33] # Print a subset of the entire file metadata record
3a) Apply a Scale Factor
red = r.value * scaleFactor
green = g.value * scaleFactor
blue = b.value * scaleFactor
nir = n.value * scaleFactor
AND MANY MORE STEPS
Request:
Please advise on an additional way to source values from the .h5 file, or another workaround for the tutorial.