- Home
- Documentation
- API reference
- Readers
- hyperproc.readers.tanager
hyperproc.readers.tanager¶
Source-derived reference
Generated from the current hyperproc 0.1.2 checkout.
Implementation: hyperproc/readers/tanager.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.
Tanager-1 (Planet / Carbon Mapper) reader for the orthorectified products.
Tanager-1 launched in August 2024: 426 bands, 376-2499 nm at 30 m, on a free-flying smallsat. Planet distributes HDF-EOS5 grids rather than swaths, so the products arrive already map-projected - no GLT, no resampling.
================= ====== ========================= ====================
file level variable units
================= ====== ========================= ====================
*_ortho_sr_* L2A reflectance unitless
*_ortho_radiance_* L1B radiance W/(m^2 sr um)
================= ====== ========================= ====================
Three things to know:
- Cubes are band-first,
(band, y, x). Reading them naively transposes the image. - Nothing lives in a sidecar - wavelengths, FWHM, the good-band flag and
the units are all HDF5 attributes on the cube dataset itself, and the grid
geometry is in the HDF-EOS
StructMetadata.0text block. - The flagged bands are not a fill value. 58 of the 426 bands are flagged,
covering the water-vapour windows from 1342 to 1967 nm. About 76% of those
values are exactly -0.01 and the rest are failed retrievals scattered from
-0.24 to 1.38 - so unlike a NaN they all pass
isfiniteand read as data.good_bands_only=Trueblanks them while keeping the band count at 426, so indices stay aligned with the sensor's own grid. The radiance product ships nogood_wavelengthsattribute at all.
FILL = -9999.0
module-attribute
¶
GRID = 'HDFEOS/GRIDS/HYP'
module-attribute
¶
PRODUCTS = {'sr': ('L2A', 'surface_reflectance', 'reflectance', 'surface reflectance'), 'radiance': ('L1B', 'toa_radiance', 'radiance', 'top-of-atmosphere radiance')}
module-attribute
¶
GEOM = {'sun_zenith': 'sza', 'sun_azimuth': 'saa', 'sensor_zenith': 'vza', 'sensor_azimuth': 'vaa', 'sensor_to_ground_path_length': 'path_length'}
module-attribute
¶
MASKS = {'beta_cloud_mask': 'cloud', 'beta_cirrus_mask': 'cirrus', 'nodata_pixels': 'nodata'}
module-attribute
¶
EXTRAS = {'aerosol_optical_depth': 'aot', 'column_water_vapour': 'wv_cm'}
module-attribute
¶
_GRANULE = re.compile('^(?P<stem>\\d{8}_\\d{6}_\\d+_\\w+)_ortho_(?P<product>sr|radiance)_hdf5\\.h5$', re.IGNORECASE)
module-attribute
¶
open_tanager(path: str | Path, wl_range: tuple[float, float] | None = None, good_bands_only: bool = False, masks: bool = True, geometry: bool = True, extras: bool = True, uncertainty: bool = False) -> xr.Dataset
¶
Open a Tanager-1 orthorectified granule.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
TYPE:
|
wl_range
|
TYPE:
|
good_bands_only
|
set the bands Planet flags unusable to NaN, keeping
all 426 so band indices stay aligned with the sensor's own grid.
Roughly 76% of those values are exactly -0.01 and the rest are
failed retrievals; all of them pass
TYPE:
|
masks
|
attach
TYPE:
|
geometry
|
attach per-pixel
TYPE:
|
extras
|
SR only - attach
TYPE:
|
uncertainty
|
SR only - attach
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dataset
|
Dataset with |
Dataset
|
already projected: |
Source code in hyperproc/readers/tanager.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 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 | |
_lazy_cube(raw: xr.DataArray, bi: np.ndarray) -> xr.DataArray
¶
(band, y, x) on disk -> lazy (y, x, wavelength) float32 with FILL as NaN.
Source code in hyperproc/readers/tanager.py
_geotransform(h, ny: int, nx: int)
¶
GDAL-order transform from the HDF-EOS StructMetadata text block.
PixelRegistration=HE5_HDFE_CORNER with GridOrigin=HE5_HDFE_GD_UL
means UpperLeftPointMtrs is the outer edge of the first pixel, not its
centre - so it is already the GDAL origin and needs no half-pixel shift.