Quickstart
This short example shows the typical PyRawPh workflow:
load a local ΦSat-2 L1 product,
inspect the event,
access one band,
build an RGB image,
compute NDVI,
create tiles,
export a result to GeoTIFF.
Load a product
from pyrawph.l1.l1_event import L1_event
ev = L1_event.from_path(
product_folder="path/to/product_folder",
scene_id=0,
product_kind="BC",
)
Inspect the event
ev.show_event_info()
Access one band
Bands can be selected by:
- integer index, for example 3,
- wavelength in nanometers, for example 842.0,
- string selectors such as "B3" or "842nm",
- aliases such as "RED" or "NIR".
nir = ev.get_band("NIR")
red = ev.get_band("RED")
Build an RGB image
rgb = ev.rgb()
Compute NDVI
ndvi = ev.index("NDVI")
Create tiles
tiles = ev.to_tiles(tile_size=512, overlap=0)
print(ev.get_tiles_names())
Inspect one tile
t0 = ev.get_tile(0)
t0.show_bands()
Export a result
ev.export_to_tif(
out_path="outputs/ndvi.tif",
arr=ndvi,
meta=ev.get_meta(),
)
Notes
The local reader expects a ΦSat-2 product folder containing a bands/
directory and may also use sidecar files such as:
geolocation/GL_scene_<id>.jsonprocessing_config.jsonsession_*_metadata.json
When available, these files enrich the event metadata with geospatial information and band wavelengths.