rslearn.dataset.window_data_storage.per_layer¶
per_layer ¶
WindowDataStorage that packs all item groups into one raster file per layer.
Stores combined rasters at layers/{layer_name}/{bandset_dir}/... with a
window_storage_meta.json sidecar recording each group's number of
timesteps. Item groups are concatenated along the T axis, so reading back any
individual group requires the sidecar to know which T-slice corresponds to
which group.
Vector data is still stored per-item-group.
PerLayerStorage ¶
Bases: WindowDataStorage
Storage that packs all item groups for a layer into one raster file.
Raster on-disk layout: layers/{layer_name}/{bandset_dir}/ with a
window_storage_meta.json sidecar recording each group's number of
timesteps. Item groups are concatenated along the T axis. This is more
efficient when reading all groups at once but does not support concurrent
or incremental writes.
Vector data is not packed by this storage; vector reads and writes fall
through to :class:PerItemGroupStorage.
Source code in rslearn/dataset/window_data_storage/per_layer.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | |
open_layer_writer ¶
open_layer_writer(layer_name: str) -> LayerWriter
Return a writer that buffers all groups before flushing.
read_raster ¶
read_raster(layer_name: str, bands: list[str], raster_format: RasterFormat, projection: Projection | None = None, bounds: PixelBounds | None = None, group_idx: int = 0, resampling: Resampling = bilinear) -> RasterArray
Decode the combined raster and slice out the requested item group.
Source code in rslearn/dataset/window_data_storage/per_layer.py
read_rasters ¶
read_rasters(layer_name: str, bands: list[str], group_idxs: list[int], raster_format: RasterFormat, projection: Projection | None = None, bounds: PixelBounds | None = None, resampling: Resampling = bilinear) -> list[RasterArray]
Decode the combined raster once and slice out the requested groups.
Source code in rslearn/dataset/window_data_storage/per_layer.py
read_vector ¶
read_vector(layer_name: str, vector_format: VectorFormat, projection: Projection | None = None, bounds: PixelBounds | None = None, group_idx: int = 0) -> list[Feature]
Decode vector features per-item-group (we don't currently handle per-layer vector).
Source code in rslearn/dataset/window_data_storage/per_layer.py
PerLayerStorageFactory ¶
Bases: WindowDataStorageFactory
Factory that creates :class:PerLayerStorage instances.
Source code in rslearn/dataset/window_data_storage/per_layer.py
create ¶
create(window: Window) -> PerLayerStorage