DataCollector
def DataCollector(
fname_raster:str, # Path to the raster used as ground truth
band:int=1, # Band to read
):Emulate field measurements by reading a raster at sample locations.
Emulate field measurements by reading a raster at sample locations.
Read the raster value of the cell under each point of gdf.
Measure the raster at every point of gdf.
DataCollector stands in for a real field campaign. It treats a raster as the ground truth and reads the value under each sample location. Use it to test a sampling strategy before collecting real data. The example starts with a 10 by 10 grid over the raster:
Draw between 1 and 9 points in each grid cell:
collect splits each MultiPoint into single points and reads the raster under each one. The result has one row per measurement. loc_id repeats for areas with several points:
| geometry | value | |
|---|---|---|
| loc_id | ||
| 0 | POINT (-1.21382 43.26536) | 0.103400 |
| 0 | POINT (-1.2194 43.26891) | 0.137387 |
| 0 | POINT (-1.22288 43.26783) | 0.098744 |
| 0 | POINT (-1.21428 43.26705) | 0.110955 |
| 0 | POINT (-1.22325 43.26045) | 0.000000 |