Created
November 25, 2023 18:12
-
-
Save aronnem/583ee5892b410f1c3b625ba4f294c2e7 to your computer and use it in GitHub Desktop.
Error when accessing certain types of NASA data with HTTPSFileSystem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime as dt | |
import earthaccess, h5py | |
earthaccess.login() | |
# first DOI succeeds: netCDF4 file, CLIMCAPS Level-2 retrievals | |
# second DOI fails: hdf5 file, OCO-2 Level-1B radiance | |
# h5py.File() fails in AbstractBufferedFile.seek, TypeError: unsupported operand type(s) for +: 'NoneType' and 'int' | |
dois = ["10.5067/LESQUBLWS18H", | |
"10.5067/H93644NLXWX9"] | |
timerange = ("2022-02-01", "2022-02-02") | |
for doi in dois: | |
granule_list = earthaccess.search_data(doi=doi, temporal=timerange) | |
fs_object = earthaccess.open(granule_list[:1])[0] | |
print(fs_object.fs.info(fs_object.path)) | |
h5File = h5py.File(fs_object, mode="r") | |
print(f"h5File has {len(h5File)} items") | |
h5File.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment