Skip to contents

Low-level helper that reads an arbitrary HDF5 dataset by its full path and returns it as an appropriately-typed R vector. Useful for pulling individual fields not covered by the curated registry, or for inspecting a dataset before requesting it via sl_read(). Earthdata credentials are required (see sl_search() for setup).

Usage

sl_hdf5_read(url, dataset)

Arguments

url

Character. HTTPS URL of the HDF5 file.

dataset

Character. Full HDF5 path to the dataset (e.g., "/BEAM0101/lat_lowestmode").

Value

An R vector — numeric, integer, or raw, depending on the underlying HDF5 datatype.

Examples

if (FALSE) { # interactive()
url <- paste0(
  "https://data.lpdaac.earthdatacloud.nasa.gov/lp-prod-protected/",
  "GEDI02_A.002/GEDI02_A_2020009130403_O06095_03_T02944_02_003_01_V002/",
  "GEDI02_A_2020009130403_O06095_03_T02944_02_003_01_V002.h5"
)
lat <- sl_hdf5_read(url, "BEAM0000/lat_lowestmode")
str(lat)
}