components assesment #2

add 2.15_components_assesment.md step
This commit is contained in:
Oleksandr Bezdieniezhnykh
2025-11-29 12:04:51 +02:00
parent 2037870f67
commit ef75cc5877
20 changed files with 557 additions and 1205 deletions
@@ -245,15 +245,16 @@ for tiles in progressive_fetch(lat, lon, [1, 4, 9, 16, 25], 19):
---
### `cache_tile(tile_coords: TileCoords, tile_data: np.ndarray) -> bool`
### `cache_tile(flight_id: str, tile_coords: TileCoords, tile_data: np.ndarray) -> bool`
**Description**: Caches a satellite tile to disk.
**Description**: Caches a satellite tile to disk with flight_id association.
**Called By**:
- Internal (after fetching tiles)
**Input**:
```python
flight_id: str # Flight this tile belongs to
tile_coords: TileCoords:
x: int
y: int
@@ -267,10 +268,11 @@ bool: True if cached successfully
```
**Processing Flow**:
1. Generate cache key from tile_coords
2. Serialize tile_data (PNG format)
3. Write to disk cache directory
4. Update cache index
1. Generate cache path: `/satellite_cache/{flight_id}/{zoom}/{tile_x}_{tile_y}.png`
2. Create flight cache directory if not exists
3. Serialize tile_data (PNG format)
4. Write to disk cache directory
5. Update cache index with flight_id association
**Error Conditions**:
- Returns `False`: Disk write error, space full
@@ -282,9 +284,9 @@ bool: True if cached successfully
---
### `get_cached_tile(tile_coords: TileCoords) -> Optional[np.ndarray]`
### `get_cached_tile(flight_id: str, tile_coords: TileCoords) -> Optional[np.ndarray]`
**Description**: Retrieves a cached tile from disk.
**Description**: Retrieves a cached tile from disk, checking flight-specific cache first.
**Called By**:
- Internal (before fetching from API)
@@ -292,6 +294,7 @@ bool: True if cached successfully
**Input**:
```python
flight_id: str # Flight to check cache for
tile_coords: TileCoords
```
@@ -301,10 +304,11 @@ Optional[np.ndarray]: Tile image or None if not cached
```
**Processing Flow**:
1. Generate cache key
2. Check if file exists
3. Load and deserialize
4. Return tile_data
1. Generate cache path: `/satellite_cache/{flight_id}/{zoom}/{tile_x}_{tile_y}.png`
2. Check flight-specific cache first
3. If not found, check global cache (shared tiles)
4. If file exists, load and deserialize
5. Return tile_data or None
**Error Conditions**:
- Returns `None`: Not cached, corrupted file