rasteret.core.collection¶
The central Collection class: Arrow dataset wrapper with filtering, output adapters, and persistence.
Most-used read APIs on Collection:
get_numpy(...)-> NumPy arrays ([N, H, W]single-band,[N, C, H, W]multi-band)get_xarray(...)->xarray.Datasetget_gdf(...)->geopandas.GeoDataFramesample_points(...)->pyarrow.Table(point-value table)to_table(...)-> Arrow/GeoArrow collection metadataread_window(...)-> fixed-grid window read for selected recordsfootprints(...)-> per-record COG pixel-grid bbox as aGeoDataFramein the target CRS, computed from band metadata (no bbox bloat from reprojection)
collection
¶
Classes¶
Collection
¶
Collection(
dataset: Dataset | None = None,
hf_streaming: HFStreamingSource | None = None,
collection_path: str | None = None,
record_index_path: str | None = None,
record_index_field_roles: dict[str, str] | None = None,
record_index_column_map: dict[str, str] | None = None,
record_index_href_column: str | None = None,
record_index_band_index_map: dict[str, int]
| None = None,
record_index_url_rewrite_patterns: dict[str, str]
| None = None,
record_index_filesystem: Any | None = None,
surface_fields: dict[str, list[str]] | None = None,
filter_capabilities: dict[str, list[str]] | None = None,
record_index_filter_expr: Expression | None = None,
wide_filter_expr: Expression | None = None,
name: str = "",
description: str = "",
data_source: str = "",
start_date: datetime | None = None,
end_date: datetime | None = None,
)
A collection of raster data with flexible initialization.
Collections can be created from: - Local partitioned datasets - Single Arrow tables
Collections maintain efficient partitioned storage when using files.
Examples:
From partitioned dataset¶
Filter and process¶
Initialize a Collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset
|
Backing Arrow dataset. |
None
|
hf_streaming
|
HFStreamingSource
|
Hugging Face streaming-backed metadata source. |
None
|
name
|
str
|
Human-readable collection name. |
''
|
description
|
str
|
Free-text description. |
''
|
data_source
|
str
|
Data source identifier (e.g. |
''
|
start_date
|
datetime
|
Collection temporal start. |
None
|
end_date
|
datetime
|
Collection temporal end. |
None
|
Source code in src/rasteret/core/collection.py
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 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
Attributes¶
bounds
property
¶
Spatial extent as (minx, miny, maxx, maxy) or None.
Functions¶
from_parquet
classmethod
¶
from_parquet(
path: str | Path,
name: str = "",
*,
data_source: str = "",
defer_dataset_open: bool = False,
record_index_path: str | None = None,
record_index_field_roles: dict[str, str] | None = None,
record_index_column_map: dict[str, str] | None = None,
record_index_href_column: str | None = None,
record_index_band_index_map: dict[str, int]
| None = None,
record_index_url_rewrite_patterns: dict[str, str]
| None = None,
record_index_filesystem: Any | None = None,
surface_fields: dict[str, list[str]] | None = None,
filter_capabilities: dict[str, list[str]] | None = None,
) -> Collection
Load a Collection from any Parquet file or directory.
Accepts local paths and cloud URIs (s3://, gs://).
Tries Hive-style partitioning first (year/month), falls back to
plain Parquet. Validates that the core contract columns are present.
See the Schema Contract <../explanation/schema-contract/>_ docs page.
Source code in src/rasteret/core/collection.py
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 | |
subset
¶
subset(
*,
cloud_cover_lt: float | None = None,
date_range: tuple[str, str] | None = None,
bbox: tuple[float, float, float, float] | None = None,
geometries: Any = None,
split: str | Sequence[str] | None = None,
split_column: str = "split",
) -> Collection
Return a filtered view of this Collection.
All provided criteria are combined with AND.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud_cover_lt
|
float
|
Keep records with |
None
|
date_range
|
tuple of str
|
|
None
|
bbox
|
tuple of float
|
|
None
|
geometries
|
bbox tuple, pa.Array, Shapely, WKB bytes, or GeoJSON dict
|
Spatial filter; records whose bbox overlaps any geometry are kept.
Accepts |
None
|
split
|
str or sequence of str
|
Keep only rows matching the given split value(s). |
None
|
split_column
|
str
|
Column name holding split labels. Defaults to |
'split'
|
Returns:
| Type | Description |
|---|---|
Collection
|
A new Collection with the filtered dataset view. |
Source code in src/rasteret/core/collection.py
1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 | |
select_split
¶
select_split(
split: str | Sequence[str],
*,
split_column: str = "split",
) -> Collection
Return a split-filtered view of this Collection.
This is a convenience wrapper around subset(split=...) to keep the
intent obvious in training code.
Source code in src/rasteret/core/collection.py
where
¶
where(expr: Expression) -> Collection
Return a filtered view using a raw Arrow dataset expression.
Source code in src/rasteret/core/collection.py
head
¶
Return the first n metadata rows as a PyArrow table.
Source code in src/rasteret/core/collection.py
list_collections
classmethod
¶
List cached collections with summary metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace_dir
|
Path
|
Directory to scan for cached collections. Defaults to
|
None
|
Returns:
| Type | Description |
|---|---|
list of dict
|
Each dict contains |
Source code in src/rasteret/core/collection.py
1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 | |
export
¶
Export the collection as a partitioned Parquet dataset.
Use this to produce a portable copy of the collection that can
be shared with teammates via :func:rasteret.load.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Output directory. Accepts local paths and cloud URIs
( |
required |
partition_by
|
sequence of str
|
Columns to partition by. Defaults to |
('year', 'month')
|
Source code in src/rasteret/core/collection.py
1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 | |
iterate_rasters
async
¶
iterate_rasters(
data_source: str | None = None,
bands: list[str] | None = None,
) -> AsyncIterator[RasterAccessor]
Iterate through raster records in this Collection.
Each Parquet row becomes a :class:RasterAccessor that provides
async band-loading methods.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_source
|
str
|
Data source identifier for band mapping. Defaults to
|
None
|
Yields:
| Type | Description |
|---|---|
RasterAccessor
|
|
Source code in src/rasteret/core/collection.py
1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 | |
get_first_raster
async
¶
get_first_raster() -> RasterAccessor
Return the first raster record in the collection.
Returns:
| Type | Description |
|---|---|
RasterAccessor
|
|
Source code in src/rasteret/core/collection.py
to_table
¶
Materialize the collection metadata as a :class:pyarrow.Table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
columns
|
list of str
|
Selected columns to include. |
None
|
Returns:
| Type | Description |
|---|---|
Table
|
|
Source code in src/rasteret/core/collection.py
to_batches
¶
Iterate the collection metadata as a stream of Arrow batches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
columns
|
list of str
|
Selected columns to include. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[RecordBatch]
|
|
Source code in src/rasteret/core/collection.py
to_reader
¶
to_reader(
columns: list[str] | None = None,
requested_schema: Schema | None = None,
) -> RecordBatchReader
Return a :class:pyarrow.RecordBatchReader for the collection metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
columns
|
list of str
|
Selected columns to include. |
None
|
requested_schema
|
Schema
|
If provided, attempt to cast the stream to this schema. |
None
|
Returns:
| Type | Description |
|---|---|
RecordBatchReader
|
|
Source code in src/rasteret/core/collection.py
from_arrow
classmethod
¶
from_arrow(data: Any, **kwargs: Any) -> Collection
Create a Collection from an Arrow-compatible object.
This is the official constructor for wrapping Arrow-native objects (Tables, Datasets, Readers) as a Rasteret Collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Arrow-compatible object
|
Object implementing the Arrow PyCapsule protocol or a native PyArrow type. |
required |
**kwargs
|
Any
|
Forwarded to :func: |
{}
|
Returns:
| Type | Description |
|---|---|
Collection
|
|
Source code in src/rasteret/core/collection.py
describe
¶
Summary of this collection.
Returns a :class:~rasteret.core.display.DescribeResult that renders
as a clean table in terminals and as styled HTML in notebooks
(Jupyter, marimo, Colab).
The underlying data is accessible via .data or ["key"].
Examples:
>>> collection.describe() # pretty table in REPL
>>> collection.describe()["bands"] # programmatic access
>>> collection.describe().data # full dict
Source code in src/rasteret/core/collection.py
compare_to_catalog
¶
Compare this collection against its catalog source.
Shows collection properties side-by-side with the catalog entry (bands coverage, date range vs source range, spatial coverage, auth requirements).
Raises :class:ValueError if the collection has no catalog match.
Returns a :class:~rasteret.core.display.DescribeResult that renders
as a table in terminals and styled HTML in notebooks.
Examples:
>>> collection.compare_to_catalog() # pretty comparison table
>>> collection.compare_to_catalog().data # full dict with catalog info
Source code in src/rasteret/core/collection.py
create_name
classmethod
¶
Create a standardized collection name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
custom_name
|
str
|
User-chosen name component. Underscores are normalised to dashes. |
required |
date_range
|
tuple of str
|
|
required |
data_source
|
str
|
Data source identifier (e.g. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Name in the format |
Source code in src/rasteret/core/collection.py
parse_name
classmethod
¶
Parse a standardized collection name into its components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Collection name created by :meth: |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Keys: |
Source code in src/rasteret/core/collection.py
read_window
¶
read_window(
*,
record_ids: Sequence[str] | Array,
bounds: tuple[float, float, float, float],
res: tuple[float, float],
bands: list[str],
target_crs: int | None = None,
max_concurrent: int = 50,
backend: Any = None,
group_by: str | None = None,
) -> ndarray
Read selected records onto a fixed output grid and mosaic overlaps.
All bands for all requested records are fetched concurrently in a
single asyncio.gather submission. Overlapping records are
mosaicked with a first-valid-pixel strategy (no averaging).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record_ids
|
sequence of str or pyarrow.Array
|
IDs of the records to read. Order is used as mosaic priority — the first ID's pixels win where records overlap. |
required |
bounds
|
tuple of float
|
|
required |
res
|
tuple of float
|
|
required |
bands
|
list of str
|
Band codes to load (e.g. |
required |
target_crs
|
int
|
EPSG code for the output grid. Defaults to the CRS of the first matched record. Supply this explicitly when the collection has mixed CRS or when you want to reproject on read. |
None
|
max_concurrent
|
int
|
Per-call cap on concurrent HTTP byte-range requests. Increase for
large chips across many records; decrease to avoid rate limits.
Defaults to |
50
|
backend
|
StorageBackend
|
Pluggable I/O backend for authenticated or requester-pays buckets.
|
None
|
group_by
|
str
|
Time-series stacking mode. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Shape |
Raises:
| Type | Description |
|---|---|
ValueError
|
If record_ids is empty, no collection rows match the IDs, or every record fails to read. |
Source code in src/rasteret/core/collection.py
2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 | |
footprints
¶
Per-record COG footprints derived from band metadata.
Returns a GeoDataFrame with columns ['id', 'datetime', 'geometry']
where each geometry is the precise pixel-grid bbox computed from the
band's transform + image_width × image_height.
Prefer this over reprojecting the collection's WGS84 geometry
column: reprojecting an axis-aligned WGS84 bbox to a projected CRS
inflates the bounding box by projection curvature (tens to hundreds of
metres on UTM tile edges), which causes spatial index false-positives
at chip query time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crs
|
int
|
Target EPSG code. When omitted, footprints are returned in each record's native CRS; the GDF is tagged with the shared native CRS when all records agree, otherwise CRS is left unset. |
None
|
band
|
str
|
Band whose metadata defines the footprint. Defaults to the first available band. Multi-resolution collections (e.g. Sentinel-2 with 10 m and 20 m bands) may need an explicit choice here. |
None
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
|
Source code in src/rasteret/core/collection.py
2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 | |
native_res
¶
Native pixel resolution (x_res, y_res) for a band.
Read from the band's stored COG metadata, so no raster is opened.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
band
|
str
|
Band whose metadata defines the resolution. Defaults to the first available band. Multi-resolution collections (e.g. Sentinel-2 with 10 m and 20 m bands) should pass an explicit band. |
None
|
Returns:
| Type | Description |
|---|---|
tuple of float
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the collection has no bands, or no record carries a usable transform for band. |
Source code in src/rasteret/core/collection.py
get_xarray
¶
get_xarray(
geometries: Any,
bands: list[str],
*,
max_concurrent: int = 50,
progress: bool | None = None,
cloud_config: Any = None,
data_source: str | None = None,
backend: Any = None,
target_crs: int | None = None,
geometry_crs: GeometryCrsInput = AUTO_CRS,
geometry_column: str | None = None,
all_touched: bool = False,
xr_combine: str = "combine_first",
**filters: Any,
) -> Dataset
Load selected bands into an xarray Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geometries
|
bbox tuple, pa.Array, Shapely, WKB bytes, GeoJSON dict, or table
|
Area(s) of interest to load. Accepts |
required |
bands
|
list of str
|
Band codes to load. |
required |
max_concurrent
|
int
|
Maximum concurrent HTTP requests. |
50
|
cloud_config
|
CloudConfig
|
Cloud configuration for URL rewriting. |
None
|
data_source
|
str
|
Override the inferred data source. |
None
|
backend
|
StorageBackend
|
Pluggable I/O backend. |
None
|
target_crs
|
int
|
Reproject all records to this CRS before merging. |
None
|
geometry_column
|
str
|
Geometry column to read when |
None
|
all_touched
|
bool
|
Passed through to polygon masking behavior. |
False
|
xr_combine
|
str
|
Strategy for merging per-record xarray Datasets.
|
'combine_first'
|
progress
|
bool
|
If |
None
|
filters
|
kwargs
|
Additional keyword arguments passed to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Band arrays in native COG dtype (e.g. |
Source code in src/rasteret/core/collection.py
2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 | |
get_gdf
¶
get_gdf(
geometries: Any,
bands: list[str],
*,
max_concurrent: int = 50,
progress: bool | None = None,
cloud_config: Any = None,
data_source: str | None = None,
backend: Any = None,
target_crs: int | None = None,
geometry_crs: GeometryCrsInput = AUTO_CRS,
geometry_column: str | None = None,
all_touched: bool = False,
**filters: Any,
) -> GeoDataFrame
Load selected bands into a GeoDataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geometries
|
bbox tuple, pa.Array, Shapely, WKB bytes, GeoJSON dict, or table
|
Area(s) of interest to load. Accepts |
required |
bands
|
list of str
|
Band codes to load. |
required |
max_concurrent
|
int
|
Maximum concurrent HTTP requests. |
50
|
cloud_config
|
CloudConfig
|
Cloud configuration for URL rewriting. |
None
|
data_source
|
str
|
Override the inferred data source. |
None
|
backend
|
StorageBackend
|
Pluggable I/O backend. |
None
|
target_crs
|
int
|
Reproject all records to this CRS before building the GeoDataFrame. |
None
|
geometry_column
|
str
|
Geometry column to read when |
None
|
all_touched
|
bool
|
Passed through to polygon masking behavior. |
False
|
progress
|
bool
|
If |
None
|
filters
|
kwargs
|
Additional keyword arguments passed to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
Band arrays in native COG dtype. Each row is a geometry-record pair with pixel data and the read-window transform as columns. |
Source code in src/rasteret/core/collection.py
2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 | |
get_numpy
¶
get_numpy(
geometries: Any,
bands: list[str],
*,
max_concurrent: int = 50,
progress: bool | None = None,
cloud_config: Any = None,
data_source: str | None = None,
backend: Any = None,
target_crs: int | None = None,
geometry_crs: GeometryCrsInput = AUTO_CRS,
geometry_column: str | None = None,
all_touched: bool = False,
**filters: Any,
)
Load selected bands into NumPy arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geometries
|
bbox tuple, pa.Array, Shapely, WKB bytes, GeoJSON dict, or table
|
Area(s) of interest to load. |
required |
bands
|
list of str
|
Band codes to load. |
required |
max_concurrent
|
int
|
Maximum concurrent HTTP requests. |
50
|
cloud_config
|
CloudConfig
|
Cloud configuration for URL rewriting. |
None
|
data_source
|
str
|
Override the inferred data source. |
None
|
backend
|
StorageBackend
|
Pluggable I/O backend. |
None
|
target_crs
|
int
|
Reproject all records to this CRS before assembly. |
None
|
geometry_column
|
str
|
Geometry column to read when |
None
|
all_touched
|
bool
|
Passed through to polygon masking behavior. |
False
|
progress
|
bool
|
If |
None
|
filters
|
kwargs
|
Additional keyword arguments passed to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Single-band queries return |
Source code in src/rasteret/core/collection.py
3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 | |
sample_points
¶
sample_points(
points: Any,
bands: list[str],
*,
geometry_column: str | None = None,
x_column: str | None = None,
y_column: str | None = None,
max_concurrent: int = 50,
progress: bool | None = None,
cloud_config: Any = None,
data_source: str | None = None,
backend: Any = None,
geometry_crs: GeometryCrsInput = AUTO_CRS,
match: str = "all",
max_distance_pixels: int = 0,
return_neighbourhood: Literal[
"off", "always", "if_center_nodata"
] = "off",
**filters: Any,
) -> Table
Sample point values into an Arrow table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
Any
|
Point input as Arrow/GeoArrow/WKB/Shapely/GeoJSON, or tabular input (Arrow table, pandas/GeoPandas, Polars, DuckDB/SedonaDB relation). |
required |
bands
|
list of str
|
Band codes to sample. |
required |
geometry_column
|
str
|
Geometry column name when points is tabular. Column may contain WKB, GeoArrow points, or Shapely Point objects. |
None
|
x_column
|
str
|
Coordinate column names when points is tabular. |
None
|
y_column
|
str
|
Coordinate column names when points is tabular. |
None
|
max_concurrent
|
int
|
Maximum concurrent HTTP requests. |
50
|
progress
|
bool
|
If |
None
|
cloud_config
|
CloudConfig
|
Cloud configuration for URL rewriting. |
None
|
data_source
|
str
|
Override the inferred data source. |
None
|
backend
|
StorageBackend
|
Pluggable I/O backend. |
None
|
geometry_crs
|
int
|
CRS EPSG code of input points. Defaults to EPSG:4326. |
AUTO_CRS
|
match
|
('all', 'latest')
|
|
"all"
|
max_distance_pixels
|
int
|
Maximum pixel distance for nodata fallback search, measured in Chebyshev distance (square rings). Rasteret samples the base pixel containing the point first; when that pixel is nodata and this is
|
0
|
return_neighbourhood
|
('off', 'always', 'if_center_nodata')
|
Controls whether a neighbourhood window is returned:
|
"off"
|
filters
|
kwargs
|
Additional keyword arguments passed to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
Table
|
Table with sampled values and metadata columns. |
Source code in src/rasteret/core/collection.py
3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 | |