this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

tessera-geotessera: add fetch_mosaic_sync

Add end-to-end test for fetch_mosaic_sync using mock fetch function
with numpy fixture files. Verifies the full pipeline: bbox -> tile
enumeration -> fetch -> dequantize -> mosaic -> correct output values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+32
tessera-geotessera/test/fixtures/mock_emb.npy

This is a binary file and will not be displayed.

tessera-geotessera/test/fixtures/mock_scales.npy

This is a binary file and will not be displayed.

+32
tessera-geotessera/test/test_geotessera.ml
··· 164 164 (* South tile should be at row offset 2*2=4 in flat index: pixel (2,0) -> row 2*2+0=4 *) 165 165 Alcotest.(check (float eps)) "south at bottom" 2.0 (Linalg.mat_get result 4 0)); 166 166 ]); 167 + 168 + ("fetch_mosaic_sync", [ 169 + Alcotest.test_case "single tile end to end" `Quick (fun () -> 170 + (* Load mock fixture bytes *) 171 + let read f = In_channel.with_open_bin f In_channel.input_all in 172 + let emb_bytes = read "fixtures/mock_emb.npy" in 173 + let scales_bytes = read "fixtures/mock_scales.npy" in 174 + (* Mock fetch: return fixture bytes for any URL *) 175 + let fetch url = 176 + if String.ends_with ~suffix:"_scales.npy" url then scales_bytes 177 + else emb_bytes 178 + in 179 + (* Single-tile bbox *) 180 + let bbox : Geotessera.bbox = { 181 + min_lon = 0.12; min_lat = 52.12; 182 + max_lon = 0.18; max_lat = 52.18; 183 + } in 184 + let (result, rh, rw) = Geotessera.fetch_mosaic_sync 185 + ~fetch ~base_url:"http://mock" ~version:"v1" ~year:2021 bbox in 186 + (* tile is 2x2 with 2 features *) 187 + Alcotest.(check int) "h" 2 rh; 188 + Alcotest.(check int) "w" 2 rw; 189 + Alcotest.(check int) "rows" 4 result.Linalg.rows; 190 + Alcotest.(check int) "cols" 2 result.Linalg.cols; 191 + (* pixel(0,0): [10*0.1, 20*0.1] = [1.0, 2.0] *) 192 + let eps = 1e-5 in 193 + Alcotest.(check (float eps)) "p00_f0" 1.0 (Linalg.mat_get result 0 0); 194 + Alcotest.(check (float eps)) "p00_f1" 2.0 (Linalg.mat_get result 0 1); 195 + (* pixel(0,1): [30*0.2, 40*0.2] = [6.0, 8.0] *) 196 + Alcotest.(check (float eps)) "p01_f0" 6.0 (Linalg.mat_get result 1 0); 197 + Alcotest.(check (float eps)) "p01_f1" 8.0 (Linalg.mat_get result 1 1)); 198 + ]); 167 199 ]