rslearn.dataset.add_windows¶
add_windows ¶
Functions to add windows to an rslearn dataset.
add_windows_from_geometries ¶
add_windows_from_geometries(dataset: Dataset, group: str, geometries: list[STGeometry], projection: Projection, name: str | None = None, grid_size: int | None = None, window_size: int | None = None, time_range: tuple[datetime, datetime] | None = None, use_utm: bool = False) -> list[Window]
Create windows based on a list of STGeometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset
|
the dataset to add the windows to. |
required |
group
|
str
|
the group to add the windows to. |
required |
geometries
|
list[STGeometry]
|
list of STGeometry. |
required |
projection
|
Projection
|
the projection of the output windows. |
required |
name
|
str | None
|
optional name of the output window (or prefix if grid_size is set). |
None
|
grid_size
|
int | None
|
if None (default), create one window corresponding to the box (re-projected if needed). Otherwise, create windows corresponding to cells of a grid of this grid size, with one window at each cell that intersects the specified box. |
None
|
window_size
|
int | None
|
use box only to define center of the window, but make the window this size. Only one of grid_size and window_size can be specified. |
None
|
time_range
|
tuple[datetime, datetime] | None
|
optional time range for the output windows, in case a geometry does not have a time range. If not specified, then the output window will not have a time range. |
None
|
use_utm
|
bool
|
override output projection with an appropriate UTM projection |
False
|
Returns:
| Type | Description |
|---|---|
list[Window]
|
list of newly created windows |
Source code in rslearn/dataset/add_windows.py
18 19 20 21 22 23 24 25 26 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 135 136 137 138 139 140 141 142 143 144 145 | |
add_windows_from_box ¶
add_windows_from_box(dataset: Dataset, group: str, box: tuple[float, float, float, float], projection: Projection, src_projection: Projection | None = None, name: str | None = None, grid_size: int | None = None, window_size: int | None = None, time_range: tuple[datetime, datetime] | None = None, use_utm: bool = False) -> list[Window]
Create windows based on the specified box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset
|
the dataset to add the windows to. |
required |
group
|
str
|
the group to add the windows to. |
required |
box
|
tuple[float, float, float, float]
|
an axis-aligned rectangle (x1, y1, x2, y2). |
required |
projection
|
Projection
|
the projection of the output windows. |
required |
src_projection
|
Projection | None
|
the projection of the specified box (defaults to projection) |
None
|
name
|
str | None
|
see add_windows_from_geometries |
None
|
grid_size
|
int | None
|
see add_windows_from_geometries |
None
|
window_size
|
int | None
|
see add_windows_from_geometries |
None
|
time_range
|
tuple[datetime, datetime] | None
|
see add_windows_from_geometries |
None
|
use_utm
|
bool
|
see add_windows_from_geometries |
False
|
Returns:
| Type | Description |
|---|---|
list[Window]
|
list of newly created windows |
Source code in rslearn/dataset/add_windows.py
add_windows_from_file ¶
add_windows_from_file(dataset: Dataset, group: str, fname: str, projection: Projection, name: str | None = None, grid_size: int | None = None, window_size: int | None = None, time_range: tuple[datetime, datetime] | None = None, use_utm: bool = False) -> list[Window]
Create windows based on the specified vector file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset
|
the dataset to add the windows to. |
required |
group
|
str
|
the group to add the windows to. |
required |
fname
|
str
|
vector filename. |
required |
projection
|
Projection
|
the projection of the output windows. |
required |
name
|
str | None
|
see add_windows_from_geometries |
None
|
grid_size
|
int | None
|
see add_windows_from_geometries |
None
|
window_size
|
int | None
|
see add_windows_from_geometries |
None
|
time_range
|
tuple[datetime, datetime] | None
|
see add_windows_from_geometries |
None
|
use_utm
|
bool
|
see add_windows_from_geometries |
False
|
Returns:
| Type | Description |
|---|---|
list[Window]
|
list of newly created windows |