- Home
- Documentation
- API reference
- Core
- hyperproc.geometry
hyperproc.geometry¶
Source-derived reference
Generated from the current hyperproc 0.1.2 checkout.
Implementation: hyperproc/geometry.py. Signatures, defaults, docstrings, and expandable source are extracted statically; the module is not imported or executed. Names beginning with _ are implementation details, not a stable public API.
Use the function signature as the authority for individual parameter defaults and return annotations. Original docstrings sometimes group parameter names or wrap return descriptions across lines; these descriptions are preserved rather than inferred or rewritten.
Per-pixel geometry checks shared by the airborne readers.
Topographic and BRDF correction both lean on slope, aspect and
cos_i, and at least one product family (AVIRIS-3) ships them in a
convention nothing downstream expects. Rather than hard-code which instrument
is affected, these helpers measure it against the granule's own DEM. They
live here, not in a sensor module, so that AVIRIS and NEON - and whatever comes
next - test the same way and neither imports the other.
check_geometry(ds: xr.Dataset, window: int = 256) -> dict
¶
Test whether slope is measured from horizontal, as everything expects.
AVIRIS-3 stores it from vertical and computes cos_i from that value,
which leaves both unusable for topographic correction. Rather than hard-code
which instrument is affected, this measures it:
- Median slope. Over a whole flightline real terrain sits well under 45 deg. AVIRIS-3 reads 76-78 with a 99th percentile of 89.5, piled against 90; Classic, NG and AVIRIS-5 read 1.5, 13.1 and 10.1.
- DEM correlation, when an elevation layer is present - the decisive
test. Differentiating the DEM gives true slope, and whichever of
storedor90 - storedcorrelates with it is the convention in use. On AVIRIS-3 that is +0.906 for the complement against -0.906 for the stored value.
Reads one window x window block from the middle of the swath, so it
costs a couple of seconds rather than a pass over the cube.
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dict with |
dict
|
slopes, and the two correlations when a DEM was available. |
Source code in hyperproc/geometry.py
fix_slope_convention(ds: xr.Dataset) -> xr.Dataset
¶
Flip slope to be measured from horizontal, and rebuild cos_i.
Applied when :func:check_geometry says a product stores slope from
vertical - AVIRIS-3, on everything seen so far. The shipped cos_i is
reproduced exactly (r = 1.000) by feeding that complement into the standard
incidence formula, so it inherits the error: one AVIRIS-3 line here has a
median cos_i of -0.216, meaning most of the scene faces away from the
sun, when 14 deg terrain under a 45.6 deg sun confines it to 0.51-0.85.
SCS+C and C-correction both divide by that.
Modifies ds in place and returns it.