Skip to content

evetion/SpaceLiDAR.jl

Repository files navigation

Stable Dev CI codecov DOI Aqua QA

SpaceLiDAR

SpaceLiDAR.jl searches, downloads, and reads spaceborne lidar data from the ICESat, ICESat-2, and GEDI NASA missions. Granules are exposed as lazy Tables.jl-compatible HDF5 tables, so you can inspect product data quickly and materialize only when you need to.

ICESat ICESat-2 GEDI
GLAH06 — Land Ice ATL03 — Photons L2A — Ground & Canopy
GLAH14 — Land Surface ATL06 — Land Ice
ATL08 — Vegetation
ATL12 — Ocean

Install

import Pkg
Pkg.add("SpaceLiDAR")

Search and download

using Extents
using SpaceLiDAR

vietnam = Extent(X = (102.0, 107.0), Y = (8.0, 12.0))

# Search NASA CMR.
granules = search(:ICESat2, :ATL08; extent = vietnam, version = 7)

# Configure NASA Earthdata credentials once, then download selected granules.
netrc!("username", "password")
download!(granules[1], "data")

# Local files and folders can be opened directly.
g = granule(joinpath("data", granules[1].id))
gs = SpaceLiDAR.granules("data")

Read as a lazy table

using DataFrames
using SpaceLiDAR

g = granule("ATL08_20201121151145_08920913_006_01.h5")
t = table(g)

# Materialize when you need a DataFrame or another Tables.jl sink.
df = DataFrame(t)

table(g) returns an H5Table for single-track products and a PartitionedH5Table for multi-track products. Both satisfy the Tables.jl column-access interface and keep the HDF5 file open while lazy; call close(t) when you are done with a long-lived lazy table.

Select tracks or variables at read time:

t = table(g; tracks = ["gt1l", "gt1r"])

vars = SpaceLiDAR.default_variables(g)
push!(vars, Variable(:slope, "land_segments/terrain/h_te_slope", Float32))
t = table(g; variables = vars)

If you do not know the HDF5 layout, use the interactive explorer:

t = explore(g)

Chain filters and transforms

Operations declare the columns they need from the HDF5 file. When piped from a lazy table, they stay lazy until the final materializing sink, so SpaceLiDAR can auto-pull all required HDF5 columns before reading:

using DataFrames
using Extents
using SpaceLiDAR

g = granule("GLAH14_634_1102_001_0071_0_01_0001.H5")
greenland = Extent(X = (-75.0, -10.0), Y = (58.0, 84.0))

df = table(g) |>
    InExtent(greenland) |>
    ICESatQuality() |>
    SaturationCorrect() |>
    TopexToWGS84() |>
    ToEGM2008() |>
    DataFrame

More documentation

See the online documentation for guides on downloads, track selection, custom variables, and product-specific schemas. If you use SpaceLiDAR.jl in your research, please consider citing it.

About

A Julia package for working with ICESat-2 & GEDI data.

Topics

Resources

License

Contributing

Stars

25 stars

Watchers

3 watching

Forks

Packages

 
 
 

Contributors

Languages