I/O¶
Export and import functions for GeoTIFF and NetCDF formats.
GeoTIFF Export¶
Note
GeoTIFF functions require rasterio. Install with pip install eq-insar[geotiff].
save_geotiff ¶
save_geotiff(data: ndarray, filepath: Union[str, Path], bounds_km: Optional[Tuple[float, float, float, float]] = None, crs: str = 'EPSG:32633', pixel_size_km: float = 0.5, nodata: float = np.nan, description: str = '', metadata: Optional[Dict] = None) -> None
Save a 2D array to GeoTIFF format.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
2D array to save (ny, nx)
TYPE:
|
filepath
|
Output file path
TYPE:
|
bounds_km
|
(xmin, ymin, xmax, ymax) in km. If None, centers data at origin.
TYPE:
|
crs
|
Coordinate reference system (default: UTM 33N)
TYPE:
|
pixel_size_km
|
Pixel size in km
TYPE:
|
nodata
|
NoData value
TYPE:
|
description
|
Band description
TYPE:
|
metadata
|
Additional metadata to include
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ImportError
|
If rasterio is not installed |
Source code in src/eq_insar/io/geotiff.py
save_displacement_geotiff ¶
save_displacement_geotiff(result: Dict, output_dir: Union[str, Path], prefix: str = 'eq_insar', include_components: bool = True) -> Dict[str, Path]
Save displacement fields from EQ-INSAR result to GeoTIFF files.
| PARAMETER | DESCRIPTION |
|---|---|
result
|
Output from generate_synthetic_insar or generate_timeseries
TYPE:
|
output_dir
|
Output directory
TYPE:
|
prefix
|
Filename prefix
TYPE:
|
include_components
|
If True, save Ue, Un, Uz components in addition to LOS
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
files
|
Dictionary mapping field names to output file paths
TYPE:
|
Source code in src/eq_insar/io/geotiff.py
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 | |
save_phase_geotiff ¶
save_phase_geotiff(result: Dict, output_dir: Union[str, Path], prefix: str = 'eq_insar', include_all: bool = True) -> Dict[str, Path]
Save phase fields from EQ-INSAR result to GeoTIFF files.
| PARAMETER | DESCRIPTION |
|---|---|
result
|
Output from generate_synthetic_insar
TYPE:
|
output_dir
|
Output directory
TYPE:
|
prefix
|
Filename prefix
TYPE:
|
include_all
|
If True, save unwrapped, wrapped, and noisy phases
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
files
|
Dictionary mapping field names to output file paths
TYPE:
|
Source code in src/eq_insar/io/geotiff.py
NetCDF Export/Load¶
Note
NetCDF functions require netCDF4. Install with pip install eq-insar[netcdf].
save_netcdf ¶
save_netcdf(result: Dict, filepath: Union[str, Path], include_metadata: bool = True, compression_level: int = 4) -> None
Save EQ-INSAR result to NetCDF format.
Creates a CF-compliant NetCDF file with all displacement and phase fields, plus metadata.
| PARAMETER | DESCRIPTION |
|---|---|
result
|
Output from generate_synthetic_insar
TYPE:
|
filepath
|
Output file path
TYPE:
|
include_metadata
|
Include source parameters as global attributes
TYPE:
|
compression_level
|
Compression level (0-9, higher = smaller files)
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ImportError
|
If netCDF4 is not installed |
Source code in src/eq_insar/io/netcdf.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 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 | |
save_timeseries_netcdf ¶
save_timeseries_netcdf(result: Dict, filepath: Union[str, Path], include_labels: bool = True, compression_level: int = 4) -> None
Save EQ-INSAR time series to NetCDF format.
Creates a NetCDF file with the time dimension for time series data, suitable for ML training datasets.
| PARAMETER | DESCRIPTION |
|---|---|
result
|
Output from generate_timeseries
TYPE:
|
filepath
|
Output file path
TYPE:
|
include_labels
|
Include segmentation labels
TYPE:
|
compression_level
|
Compression level (0-9)
TYPE:
|
Source code in src/eq_insar/io/netcdf.py
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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
load_netcdf ¶
Load EQ-INSAR data from NetCDF file.
| PARAMETER | DESCRIPTION |
|---|---|
filepath
|
Path to NetCDF file
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
result
|
Dictionary with data arrays and metadata
TYPE:
|