- Home
- Documentation
- API reference
- Readers
- hyperproc.readers.neon
hyperproc.readers.neon¶
Source-derived reference
Generated from the current hyperproc 0.1.2 checkout.
Implementation: hyperproc/readers/neon.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.
NEON AOP reader - DP1.30006.001 flightline reflectance (NIS), HDF5.
NEON's Airborne Observation Platform flies the NEON Imaging Spectrometer (an AVIRIS-NG-class instrument) over its ecological sites and delivers orthorectified, atmospherically corrected (ATCOR) reflectance as one HDF5 file per flightline, on a north-up 1 m UTM grid:
NEON_D01_BART_DP1_20190825_145110_reflectance.h5
^ ^ ^ ^ ^
domain site product date flightline start (HHMMSS)
Everything lives under one site group - <SITE>/Reflectance/ - with the
cube in Reflectance_Data as (line, sample, wavelength) int16 scaled by
10 000, and a rich Metadata/ tree: 426 band centres and FWHM, the map
projection, per-pixel view angles, scalar solar angles for the line, and the
ATCOR inputs and outputs (slope, aspect, smoothed DEM, illumination, path
length, sky view, AOT, water vapour, haze/cloud/water and DDV class maps).
Five things to know, all checked against the BART 2019-08-25 lines here:
-
The cube is already
(y, x, wavelength). No transpose, no GLT: NEON delivers a gridded product. TheInterleave = BSQattribute describes the conceptual layout, not the array order in the file. -
Some attribute labels are wrong, so values were checked, not trusted.
Smooth_Surface_Elevationis labelled "Average Solar Zenith Angle" in degrees; it holds elevation in metres (680-735 m at Bartlett).Illumination_Factoris labelled degrees; it iscos(i) x 100as uint8 -IF/100matches the incidence formula from slope, aspect and the solar angles at r = +0.9994, mean |diff| 0.0025, while cos(IF deg) is anti-correlated.Water_Vapor_ColumnhasScale_Factor = 1.0but its description says "[cm] x 1000", and 816 cm of water vapour is impossible where 0.816 cm is August in New Hampshire. The reader applies the scale the values demand and records each decision in the variable'snote. -
Cast_Shadowdoes not hold the flag its description promises. It documents1 = shadow, 0 = no shadow; the line here holds only 1 and 241, with 241 on the off-swath fill. It is exposed unmodified ascast_shadow_rawrather than given a meaning the data do not support. Use thehcw_classandddv_classmaps for shadow instead - both carry an explicit topographic-shadow class. -
Solar angles are one number per flightline, not per pixel: ATCOR uses the line average. They are broadcast to
(y, x)lazily so downstream code sees the same variables as for AVIRIS, and kept as scalar attrs too. -
Bad bands are the provider's.
Band_Window_1/2_Nanometerson the Reflectance group give NEON's own water-vapour windows (1340-1445 and 1790-1955 nm here), andgood_wavelengthis built from them.
The cube is opened lazily through dask, chunked to the file's own gzip layout
(336, 39, 14) in multiples, so a spatial window across all bands is a
handful of contiguous reads rather than a pass over 5 GB.
FILL = -9999.0
module-attribute
¶
SCALE = 10000.0
module-attribute
¶
_GRANULE = re.compile('(?P<granule>NEON_(?P<domain>D\\d{2})_(?P<site>[A-Z0-9]{4})_(?P<product>DP[13])_(?P<date>\\d{8})_(?P<time>\\d{6}))')
module-attribute
¶
ANCILLARY = {'Slope': ('slope', 1.0, 'degrees', 'terrain slope from horizontal'), 'Aspect': ('aspect', 1.0, 'degrees', 'terrain aspect, cw from north'), 'Smooth_Surface_Elevation': ('elev', 1.0, 'm', 'smoothed surface elevation'), 'Path_Length': ('path_length', 1.0, 'm', 'sensor-to-ground path length'), 'Illumination_Factor': ('cos_i', 100.0, '1', 'cosine of the solar incidence angle on the slope'), 'Sky_View_Factor': ('sky_view', 100.0, '1', 'sky view factor'), 'Aerosol_Optical_Depth': ('aot', 1000.0, '1', 'aerosol optical thickness at 550 nm'), 'Water_Vapor_Column': ('wv', 1000.0, 'cm', 'column water vapour'), 'Visibility_Index_Map': ('visibility', 1.0, 'km', 'sea-level visibility')}
module-attribute
¶
BYTE_NODATA = 241
module-attribute
¶
CLASSES = {'Haze_Cloud_Water_Map': 'hcw_class', 'Dark_Dense_Vegetation_Classification': 'ddv_class'}
module-attribute
¶
NOTES = {'elev': "file labels this 'Average Solar Zenith Angle' in degrees; values are metres", 'cos_i': "file labels this 'degrees'; it is cos(i) x 100 (r=+0.9994 vs the incidence formula)", 'wv': 'file Scale_Factor is 1.0 but the description says [cm] x 1000; 0.8 cm, not 816', 'aot': 'Band_Names says 550 nm, Description says 500 nm; ATCOR reports 550'}
module-attribute
¶
_H5Array
¶
Array-like view of one HDF5 dataset that reopens the file for every
read. The dask graph then holds only a path and a dataset name: it can be
pickled (distributed / process schedulers), and no file handle is left
open after hyperproc.open returns.
Source code in hyperproc/readers/neon.py
open_neon(path: str | Path, wl_range: tuple[float, float] | None = None, good_bands_only: bool = False, geometry: bool = True, extras: bool = True, classes: bool = True, fix_geometry: bool | str = 'auto', chunks: str | tuple | None = 'auto') -> xr.Dataset
¶
Open a NEON DP1.30006.001 flightline.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
TYPE:
|
wl_range
|
TYPE:
|
good_bands_only
|
NaN the bands inside NEON's own water-vapour windows
(
TYPE:
|
geometry
|
attach
TYPE:
|
extras
|
attach
TYPE:
|
classes
|
attach
TYPE:
|
fix_geometry
|
TYPE:
|
chunks
|
dask chunking.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dataset
|
|
Dataset
|
|
Dataset
|
|
Source code in hyperproc/readers/neon.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
_as_str(v) -> str
¶
_band_subset(wl: np.ndarray, wl_range) -> np.ndarray | None
¶
Source code in hyperproc/readers/neon.py
_good_bands(wl: np.ndarray, attrs) -> tuple[np.ndarray, list]
¶
NEON's own bad-band windows, from Band_Window_N_Nanometers.
Source code in hyperproc/readers/neon.py
_grid(meta, dset) -> tuple[int, tuple]
¶
EPSG and GDAL-order transform from Map_Info, cross-checked to the extent.
Map_Info is proj, refx, refy, easting, northing, px, py, zone, hemi,
datum, units, rotation; the easting/northing are the upper-left edge,
which the Spatial_Extent attribute confirms (extent width / px = samples).
Source code in hyperproc/readers/neon.py
_chunks_for(dset, spec)
¶
Dask chunks: whole rows of the file's gzip chunk height, all bands.
Full-width rows make every chunk a complete GeoTIFF strip (the writer otherwise rewrites each strip once per x-chunk) and read each gzip chunk exactly once.
Source code in hyperproc/readers/neon.py
_lazy_cube(dset, chunks)
¶
_lazy_layer(dset, chunks)
¶
Source code in hyperproc/readers/neon.py
_scaled(dset, scale, chunks)
¶
Float layer with the file's ignore value as NaN, divided by scale.