rslearn 0.0.15__py3-none-any.whl → 0.0.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. rslearn/config/__init__.py +2 -10
  2. rslearn/config/dataset.py +414 -420
  3. rslearn/data_sources/__init__.py +8 -31
  4. rslearn/data_sources/aws_landsat.py +13 -24
  5. rslearn/data_sources/aws_open_data.py +21 -46
  6. rslearn/data_sources/aws_sentinel1.py +3 -14
  7. rslearn/data_sources/climate_data_store.py +21 -40
  8. rslearn/data_sources/copernicus.py +30 -91
  9. rslearn/data_sources/data_source.py +26 -0
  10. rslearn/data_sources/earthdaily.py +13 -38
  11. rslearn/data_sources/earthdata_srtm.py +14 -32
  12. rslearn/data_sources/eurocrops.py +5 -9
  13. rslearn/data_sources/gcp_public_data.py +46 -43
  14. rslearn/data_sources/google_earth_engine.py +31 -44
  15. rslearn/data_sources/local_files.py +91 -100
  16. rslearn/data_sources/openstreetmap.py +21 -51
  17. rslearn/data_sources/planet.py +12 -30
  18. rslearn/data_sources/planet_basemap.py +4 -25
  19. rslearn/data_sources/planetary_computer.py +58 -141
  20. rslearn/data_sources/usda_cdl.py +15 -26
  21. rslearn/data_sources/usgs_landsat.py +4 -29
  22. rslearn/data_sources/utils.py +9 -0
  23. rslearn/data_sources/worldcereal.py +47 -54
  24. rslearn/data_sources/worldcover.py +16 -14
  25. rslearn/data_sources/worldpop.py +15 -18
  26. rslearn/data_sources/xyz_tiles.py +11 -30
  27. rslearn/dataset/dataset.py +6 -6
  28. rslearn/dataset/manage.py +14 -20
  29. rslearn/dataset/materialize.py +9 -45
  30. rslearn/lightning_cli.py +370 -1
  31. rslearn/main.py +3 -3
  32. rslearn/models/concatenate_features.py +93 -0
  33. rslearn/tile_stores/__init__.py +0 -11
  34. rslearn/train/dataset.py +4 -12
  35. rslearn/train/prediction_writer.py +16 -32
  36. rslearn/train/tasks/classification.py +2 -1
  37. rslearn/utils/fsspec.py +20 -0
  38. rslearn/utils/jsonargparse.py +79 -0
  39. rslearn/utils/raster_format.py +1 -41
  40. rslearn/utils/vector_format.py +1 -38
  41. {rslearn-0.0.15.dist-info → rslearn-0.0.16.dist-info}/METADATA +1 -1
  42. {rslearn-0.0.15.dist-info → rslearn-0.0.16.dist-info}/RECORD +47 -48
  43. rslearn/data_sources/geotiff.py +0 -1
  44. rslearn/data_sources/raster_source.py +0 -23
  45. {rslearn-0.0.15.dist-info → rslearn-0.0.16.dist-info}/WHEEL +0 -0
  46. {rslearn-0.0.15.dist-info → rslearn-0.0.16.dist-info}/entry_points.txt +0 -0
  47. {rslearn-0.0.15.dist-info → rslearn-0.0.16.dist-info}/licenses/LICENSE +0 -0
  48. {rslearn-0.0.15.dist-info → rslearn-0.0.16.dist-info}/licenses/NOTICE +0 -0
  49. {rslearn-0.0.15.dist-info → rslearn-0.0.16.dist-info}/top_level.txt +0 -0
@@ -12,10 +12,8 @@ from lightning.pytorch.callbacks import BasePredictionWriter
12
12
  from upath import UPath
13
13
 
14
14
  from rslearn.config import (
15
+ LayerConfig,
15
16
  LayerType,
16
- RasterFormatConfig,
17
- RasterLayerConfig,
18
- VectorLayerConfig,
19
17
  )
20
18
  from rslearn.dataset import Dataset, Window
21
19
  from rslearn.log_utils import get_logger
@@ -25,9 +23,8 @@ from rslearn.utils.geometry import PixelBounds
25
23
  from rslearn.utils.raster_format import (
26
24
  RasterFormat,
27
25
  adjust_projection_and_bounds_for_array,
28
- load_raster_format,
29
26
  )
30
- from rslearn.utils.vector_format import VectorFormat, load_vector_format
27
+ from rslearn.utils.vector_format import VectorFormat
31
28
 
32
29
  from .lightning_module import RslearnLightningModule
33
30
  from .tasks.task import Task
@@ -150,7 +147,7 @@ class RslearnWriter(BasePredictionWriter):
150
147
  selector: list[str] | None = None,
151
148
  merger: PatchPredictionMerger | None = None,
152
149
  output_path: str | Path | None = None,
153
- layer_config: RasterLayerConfig | VectorLayerConfig | None = None,
150
+ layer_config: LayerConfig | None = None,
154
151
  ):
155
152
  """Create a new RslearnWriter.
156
153
 
@@ -178,43 +175,31 @@ class RslearnWriter(BasePredictionWriter):
178
175
  )
179
176
 
180
177
  # Handle dataset and layer config
181
- self.layer_config: RasterLayerConfig | VectorLayerConfig
178
+ self.layer_config: LayerConfig
182
179
  if layer_config:
183
180
  self.layer_config = layer_config
184
- self.dataset = None if self.output_path else Dataset(self.path)
185
181
  else:
186
- self.dataset = Dataset(self.path)
187
- if self.output_layer not in self.dataset.layers:
182
+ dataset = Dataset(self.path)
183
+ if self.output_layer not in dataset.layers:
188
184
  raise KeyError(
189
185
  f"Output layer '{self.output_layer}' not found in dataset layers."
190
186
  )
191
- raw_layer_config = self.dataset.layers[self.output_layer]
192
- # Type narrowing to ensure compatibility
193
- if isinstance(raw_layer_config, (RasterLayerConfig | VectorLayerConfig)):
194
- self.layer_config = raw_layer_config
195
- else:
196
- raise ValueError(
197
- f"Layer config must be RasterLayerConfig or VectorLayerConfig, got {type(raw_layer_config)}"
198
- )
187
+ self.layer_config = dataset.layers[self.output_layer]
199
188
 
200
189
  self.format: RasterFormat | VectorFormat
201
- if self.layer_config.layer_type == LayerType.RASTER:
202
- assert isinstance(self.layer_config, RasterLayerConfig)
190
+ if self.layer_config.type == LayerType.RASTER:
203
191
  band_cfg = self.layer_config.band_sets[0]
204
- self.format = load_raster_format(
205
- RasterFormatConfig(band_cfg.format["name"], band_cfg.format)
206
- )
207
- elif self.layer_config.layer_type == LayerType.VECTOR:
208
- assert isinstance(self.layer_config, VectorLayerConfig)
209
- self.format = load_vector_format(self.layer_config.format)
192
+ self.format = band_cfg.instantiate_raster_format()
193
+ elif self.layer_config.type == LayerType.VECTOR:
194
+ self.format = self.layer_config.instantiate_vector_format()
210
195
  else:
211
- raise ValueError(f"invalid layer type {self.layer_config.layer_type}")
196
+ raise ValueError(f"invalid layer type {self.layer_config.type}")
212
197
 
213
198
  if merger is not None:
214
199
  self.merger = merger
215
- elif self.layer_config.layer_type == LayerType.RASTER:
200
+ elif self.layer_config.type == LayerType.RASTER:
216
201
  self.merger = RasterMerger()
217
- elif self.layer_config.layer_type == LayerType.VECTOR:
202
+ elif self.layer_config.type == LayerType.VECTOR:
218
203
  self.merger = VectorMerger()
219
204
 
220
205
  # Map from window name to pending data to write.
@@ -337,8 +322,7 @@ class RslearnWriter(BasePredictionWriter):
337
322
  logger.debug(f"Merging and writing for window {window.name}")
338
323
  merged_output = self.merger.merge(window, pending_output)
339
324
 
340
- if self.layer_config.layer_type == LayerType.RASTER:
341
- assert isinstance(self.layer_config, RasterLayerConfig)
325
+ if self.layer_config.type == LayerType.RASTER:
342
326
  raster_dir = window.get_raster_dir(
343
327
  self.output_layer, self.layer_config.band_sets[0].bands
344
328
  )
@@ -351,7 +335,7 @@ class RslearnWriter(BasePredictionWriter):
351
335
  )
352
336
  self.format.encode_raster(raster_dir, projection, bounds, merged_output)
353
337
 
354
- elif self.layer_config.layer_type == LayerType.VECTOR:
338
+ elif self.layer_config.type == LayerType.VECTOR:
355
339
  layer_dir = window.get_layer_dir(self.output_layer)
356
340
  assert isinstance(self.format, VectorFormat)
357
341
  self.format.encode_vector(layer_dir, merged_output)
@@ -26,7 +26,7 @@ class ClassificationTask(BasicTask):
26
26
  def __init__(
27
27
  self,
28
28
  property_name: str,
29
- classes: list, # TODO: Should this be a list of str or int or can it be both?
29
+ classes: list[str],
30
30
  filters: list[tuple[str, str]] = [],
31
31
  read_class_id: bool = False,
32
32
  allow_invalid: bool = False,
@@ -176,6 +176,7 @@ class ClassificationTask(BasicTask):
176
176
  # For multiclass classification or when using the default threshold
177
177
  class_idx = probs.argmax().item()
178
178
 
179
+ value: str | int
179
180
  if not self.read_class_id:
180
181
  value = self.classes[class_idx] # type: ignore
181
182
  else:
rslearn/utils/fsspec.py CHANGED
@@ -156,3 +156,23 @@ def open_rasterio_upath_writer(
156
156
  with path.open("wb") as f:
157
157
  with rasterio.open(f, "w", **kwargs) as raster:
158
158
  yield raster
159
+
160
+
161
+ def get_relative_suffix(base_dir: UPath, fname: UPath) -> str:
162
+ """Get the suffix of fname relative to base_dir.
163
+
164
+ Args:
165
+ base_dir: the base directory.
166
+ fname: a filename within the base directory.
167
+
168
+ Returns:
169
+ the suffix on base_dir that would yield the given filename.
170
+ """
171
+ if not fname.path.startswith(base_dir.path):
172
+ raise ValueError(
173
+ f"filename {fname.path} must start with base directory {base_dir.path}"
174
+ )
175
+ suffix = fname.path[len(base_dir.path) :]
176
+ if suffix.startswith("/"):
177
+ suffix = suffix[1:]
178
+ return suffix
@@ -1,7 +1,18 @@
1
1
  """Custom serialization for jsonargparse."""
2
2
 
3
+ from datetime import datetime
4
+ from typing import TYPE_CHECKING, Any
5
+
3
6
  import jsonargparse
4
7
  from rasterio.crs import CRS
8
+ from upath import UPath
9
+
10
+ from rslearn.config.dataset import LayerConfig
11
+
12
+ if TYPE_CHECKING:
13
+ from rslearn.data_sources.data_source import DataSourceContext
14
+
15
+ INITIALIZED = False
5
16
 
6
17
 
7
18
  def crs_serializer(v: CRS) -> str:
@@ -28,6 +39,74 @@ def crs_deserializer(v: str) -> CRS:
28
39
  return CRS.from_string(v)
29
40
 
30
41
 
42
+ def datetime_serializer(v: datetime) -> str:
43
+ """Serialize datetime for jsonargparse.
44
+
45
+ Args:
46
+ v: the datetime object.
47
+
48
+ Returns:
49
+ the datetime encoded to string
50
+ """
51
+ return v.isoformat()
52
+
53
+
54
+ def datetime_deserializer(v: str) -> datetime:
55
+ """Deserialize datetime for jsonargparse.
56
+
57
+ Args:
58
+ v: the encoded datetime.
59
+
60
+ Returns:
61
+ the decoded datetime object
62
+ """
63
+ return datetime.fromisoformat(v)
64
+
65
+
66
+ def data_source_context_serializer(v: "DataSourceContext") -> dict[str, Any]:
67
+ """Serialize DataSourceContext for jsonargparse."""
68
+ x = {
69
+ "ds_path": (str(v.ds_path) if v.ds_path is not None else None),
70
+ "layer_config": (
71
+ v.layer_config.model_dump(mode="json")
72
+ if v.layer_config is not None
73
+ else None
74
+ ),
75
+ }
76
+ return x
77
+
78
+
79
+ def data_source_context_deserializer(v: dict[str, Any]) -> "DataSourceContext":
80
+ """Deserialize DataSourceContext for jsonargparse."""
81
+ # We lazily import these to avoid cyclic dependency.
82
+ from rslearn.data_sources.data_source import DataSourceContext
83
+
84
+ return DataSourceContext(
85
+ ds_path=(UPath(v["ds_path"]) if v["ds_path"] is not None else None),
86
+ layer_config=(
87
+ LayerConfig.model_validate(v["layer_config"])
88
+ if v["layer_config"] is not None
89
+ else None
90
+ ),
91
+ )
92
+
93
+
31
94
  def init_jsonargparse() -> None:
32
95
  """Initialize custom jsonargparse serializers."""
96
+ global INITIALIZED
97
+ if INITIALIZED:
98
+ return
33
99
  jsonargparse.typing.register_type(CRS, crs_serializer, crs_deserializer)
100
+ jsonargparse.typing.register_type(
101
+ datetime, datetime_serializer, datetime_deserializer
102
+ )
103
+
104
+ from rslearn.data_sources.data_source import DataSourceContext
105
+
106
+ jsonargparse.typing.register_type(
107
+ DataSourceContext,
108
+ data_source_context_serializer,
109
+ data_source_context_deserializer,
110
+ )
111
+
112
+ INITIALIZED = True
@@ -2,8 +2,7 @@
2
2
 
3
3
  import hashlib
4
4
  import json
5
- from collections.abc import Callable
6
- from typing import Any, BinaryIO, TypeVar
5
+ from typing import Any, BinaryIO
7
6
 
8
7
  import affine
9
8
  import numpy as np
@@ -14,34 +13,12 @@ from rasterio.crs import CRS
14
13
  from rasterio.enums import Resampling
15
14
  from upath import UPath
16
15
 
17
- from rslearn.config import RasterFormatConfig
18
16
  from rslearn.const import TILE_SIZE
19
17
  from rslearn.log_utils import get_logger
20
18
  from rslearn.utils.fsspec import open_rasterio_upath_reader, open_rasterio_upath_writer
21
19
 
22
20
  from .geometry import PixelBounds, Projection
23
21
 
24
- _RasterFormatT = TypeVar("_RasterFormatT", bound="RasterFormat")
25
-
26
-
27
- class _RasterFormatRegistry(dict[str, type["RasterFormat"]]):
28
- """Registry for RasterFormat classes."""
29
-
30
- def register(
31
- self, name: str
32
- ) -> Callable[[type[_RasterFormatT]], type[_RasterFormatT]]:
33
- """Decorator to register a raster format class."""
34
-
35
- def decorator(cls: type[_RasterFormatT]) -> type[_RasterFormatT]:
36
- self[name] = cls
37
- return cls
38
-
39
- return decorator
40
-
41
-
42
- RasterFormats = _RasterFormatRegistry()
43
-
44
-
45
22
  logger = get_logger(__name__)
46
23
 
47
24
 
@@ -219,7 +196,6 @@ class RasterFormat:
219
196
  raise NotImplementedError
220
197
 
221
198
 
222
- @RasterFormats.register("image_tile")
223
199
  class ImageTileRasterFormat(RasterFormat):
224
200
  """A RasterFormat that stores data in image tiles corresponding to grid cells.
225
201
 
@@ -468,7 +444,6 @@ class ImageTileRasterFormat(RasterFormat):
468
444
  )
469
445
 
470
446
 
471
- @RasterFormats.register("geotiff")
472
447
  class GeotiffRasterFormat(RasterFormat):
473
448
  """A raster format that uses one big, tiled GeoTIFF with small block size."""
474
449
 
@@ -623,7 +598,6 @@ class GeotiffRasterFormat(RasterFormat):
623
598
  return GeotiffRasterFormat(**kwargs)
624
599
 
625
600
 
626
- @RasterFormats.register("single_image")
627
601
  class SingleImageRasterFormat(RasterFormat):
628
602
  """A raster format that produces a single image called image.png/jpg.
629
603
 
@@ -775,17 +749,3 @@ class SingleImageRasterFormat(RasterFormat):
775
749
  if "format" in config:
776
750
  kwargs["format"] = config["format"]
777
751
  return SingleImageRasterFormat(**kwargs)
778
-
779
-
780
- def load_raster_format(config: RasterFormatConfig) -> RasterFormat:
781
- """Loads a RasterFormat from a RasterFormatConfig.
782
-
783
- Args:
784
- config: the RasterFormatConfig configuration object specifying the
785
- RasterFormat.
786
-
787
- Returns:
788
- the loaded RasterFormat implementation
789
- """
790
- cls = RasterFormats[config.name]
791
- return cls.from_config(config.name, config.config_dict)
@@ -1,15 +1,13 @@
1
1
  """Classes for writing vector data to a UPath."""
2
2
 
3
3
  import json
4
- from collections.abc import Callable
5
4
  from enum import Enum
6
- from typing import Any, TypeVar
5
+ from typing import Any
7
6
 
8
7
  import shapely
9
8
  from rasterio.crs import CRS
10
9
  from upath import UPath
11
10
 
12
- from rslearn.config import VectorFormatConfig
13
11
  from rslearn.const import WGS84_PROJECTION
14
12
  from rslearn.log_utils import get_logger
15
13
  from rslearn.utils.fsspec import open_atomic
@@ -18,25 +16,6 @@ from .feature import Feature
18
16
  from .geometry import PixelBounds, Projection, STGeometry, safely_reproject_and_clip
19
17
 
20
18
  logger = get_logger(__name__)
21
- _VectorFormatT = TypeVar("_VectorFormatT", bound="VectorFormat")
22
-
23
-
24
- class _VectorFormatRegistry(dict[str, type["VectorFormat"]]):
25
- """Registry for VectorFormat classes."""
26
-
27
- def register(
28
- self, name: str
29
- ) -> Callable[[type[_VectorFormatT]], type[_VectorFormatT]]:
30
- """Decorator to register a vector format class."""
31
-
32
- def decorator(cls: type[_VectorFormatT]) -> type[_VectorFormatT]:
33
- self[name] = cls
34
- return cls
35
-
36
- return decorator
37
-
38
-
39
- VectorFormats = _VectorFormatRegistry()
40
19
 
41
20
 
42
21
  class VectorFormat:
@@ -85,7 +64,6 @@ class VectorFormat:
85
64
  raise NotImplementedError
86
65
 
87
66
 
88
- @VectorFormats.register("tile")
89
67
  class TileVectorFormat(VectorFormat):
90
68
  """TileVectorFormat stores data in GeoJSON files corresponding to grid cells.
91
69
 
@@ -275,7 +253,6 @@ class GeojsonCoordinateMode(Enum):
275
253
  WGS84 = "wgs84"
276
254
 
277
255
 
278
- @VectorFormats.register("geojson")
279
256
  class GeojsonVectorFormat(VectorFormat):
280
257
  """A vector format that uses one big GeoJSON."""
281
258
 
@@ -429,17 +406,3 @@ class GeojsonVectorFormat(VectorFormat):
429
406
  if "coordinate_mode" in config:
430
407
  kwargs["coordinate_mode"] = GeojsonCoordinateMode(config["coordinate_mode"])
431
408
  return GeojsonVectorFormat(**kwargs)
432
-
433
-
434
- def load_vector_format(config: VectorFormatConfig) -> VectorFormat:
435
- """Loads a VectorFormat from a VectorFormatConfig.
436
-
437
- Args:
438
- config: the VectorFormatConfig configuration object specifying the
439
- VectorFormat.
440
-
441
- Returns:
442
- the loaded VectorFormat implementation
443
- """
444
- cls = VectorFormats[config.name]
445
- return cls.from_config(config.name, config.config_dict)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rslearn
3
- Version: 0.0.15
3
+ Version: 0.0.16
4
4
  Summary: A library for developing remote sensing datasets and models
5
5
  Author: OlmoEarth Team
6
6
  License: Apache License
@@ -1,52 +1,51 @@
1
1
  rslearn/__init__.py,sha256=fFmAen3vxZyosEfPbG0W46IttujYGVxzrGkJ0YutmmY,73
2
2
  rslearn/arg_parser.py,sha256=GNlJncO6Ck_dCNrcg7z_SSG61I-2gKn3Ix2tAxIk9CI,1428
3
3
  rslearn/const.py,sha256=FUCfsvFAs-QarEDJ0grdy0C1HjUjLpNFYGo5I2Vpc5Y,449
4
- rslearn/lightning_cli.py,sha256=io1Agb2fr-fUu9yOODNJhP8-vJp_v9UbJJA2hkLubKA,2435
4
+ rslearn/lightning_cli.py,sha256=x8i2QJvEBaYdqh2_f0-ety7_sNEH9UCKRZUPkqWYZdU,17169
5
5
  rslearn/log_utils.py,sha256=unD9gShiuO7cx5Nnq8qqVQ4qrbOOwFVgcHxN5bXuiAo,941
6
- rslearn/main.py,sha256=JMNMhAHqpb9bDUoKzj6kN659Ft_-gZv_rKUieJcJNwI,29087
6
+ rslearn/main.py,sha256=0g1SRO975eC9DTzKqJnwlWHgVo2Pvotyr72KoJBgjew,29060
7
7
  rslearn/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  rslearn/template_params.py,sha256=Vop0Ha-S44ctCa9lvSZRjrMETznJZlR5y_gJrVIwrPg,791
9
- rslearn/config/__init__.py,sha256=Bhf2VVncdMYRC8Wfb4GsJJ13OAJYNCO_ODLSNTmBOHM,638
10
- rslearn/config/dataset.py,sha256=lIuFgJG0Hz7nxacFIpbwOyNJqjlkOlaMfWt91Chjb_M,21338
11
- rslearn/data_sources/__init__.py,sha256=8_7Pi3agKsatNoxXw74-U5G-QAP-rbdfcH8EkZfJbH4,1449
12
- rslearn/data_sources/aws_landsat.py,sha256=GA9H04KagBDm-N37jFdh_aHCX2ZneVdnqT1SNOyAwTs,20829
13
- rslearn/data_sources/aws_open_data.py,sha256=nU_D5cqc-wibxq4uyUNb0z-XD0Puf1gZ8v5FMiMAN5w,30258
14
- rslearn/data_sources/aws_sentinel1.py,sha256=cmf_ZcB7GCyFAdbwExeAwJIHqLL0JVoXtq5WcQ8UuiU,5197
15
- rslearn/data_sources/climate_data_store.py,sha256=Hct-0Ui-_CCQISOlzsqkK1dKz8684HRqfVUI-zXW2wA,11571
16
- rslearn/data_sources/copernicus.py,sha256=NBiZO3tLRqdi8lrFSrBtnv6gfobbDWGk_0eQoydizYE,36657
17
- rslearn/data_sources/data_source.py,sha256=69ptYhqa6pnKM04ux9hWvTPExN_lFNuU_0t_seYFnHE,3916
18
- rslearn/data_sources/earthdaily.py,sha256=dxOWm7Yiuh4fWVptRws_Ljh-HuNs1frf86ao91yS_80,19059
19
- rslearn/data_sources/earthdata_srtm.py,sha256=ysyVbVDLjhhLKdh7WKhQcwZezqvmTYaiPetTborW6zQ,11166
20
- rslearn/data_sources/eurocrops.py,sha256=bH_ul45RvNLLvVKU9JjZH1XMenAmgn7Lakq0pXjPXos,8861
21
- rslearn/data_sources/gcp_public_data.py,sha256=kr9stYo7ZCvz8s4E3wmoY-yAGZoLa_9RCwjS-Q5k9dM,36128
22
- rslearn/data_sources/geotiff.py,sha256=sFUp919chaX4j6lQytNp__xnMLlDI3Ac3rfB6F8sgZ0,45
23
- rslearn/data_sources/google_earth_engine.py,sha256=hpkt74ly2lEwjRrDp8FBmGvB3MEw_mQ38Av4rQOR3_w,24246
24
- rslearn/data_sources/local_files.py,sha256=d08m6IzrUN_80VfvgpHahMJrv-n6_CI6EIocp6kyDRs,19490
25
- rslearn/data_sources/openstreetmap.py,sha256=qUSMFiIA_laJkO3meBXf9TmSI7OBD-o3i4JxqllUv3Q,19232
26
- rslearn/data_sources/planet.py,sha256=F2JoLaQ5Cb3k1cTm0hwSWTL2TPfbaAUMXZ8q4Dy7UlA,10109
27
- rslearn/data_sources/planet_basemap.py,sha256=wuWM9dHSJMdINfyWb78Zk9i-KvJHTrf9J0Q2gyEyiiA,10450
28
- rslearn/data_sources/planetary_computer.py,sha256=Vi-aBHQe-BA8NjRyPMgurMAdo3sK6PJteCK5MwXygJo,31869
29
- rslearn/data_sources/raster_source.py,sha256=b8wo55GhVLxXwx1WYLzeRAlzD_ZkE_P9tnvUOdnsfQE,689
30
- rslearn/data_sources/usda_cdl.py,sha256=2_V11AhPRgLEGd4U5Pmx3UvE2HWBPbsFXhUIQVRVFeE,7138
31
- rslearn/data_sources/usgs_landsat.py,sha256=31GmOUfmxwTE6MTiVI4psb-ciVmunuA8cfvqDuvTHPE,19312
32
- rslearn/data_sources/utils.py,sha256=oi2ybE423TLgpXlNjZ5qDQxDiwbSs7b-qD71UueQZHE,11327
9
+ rslearn/config/__init__.py,sha256=a8xTvYSnpfIzniHgcnSeob5jo5PVBfacpakA_150MME,434
10
+ rslearn/config/dataset.py,sha256=iUFuwzlM9z6n1pGCd40SmAVj3fG6zTXWrlH6eenfon8,21143
11
+ rslearn/data_sources/__init__.py,sha256=zzuZUxrlEIw84YpD2I0HJvCoLDB29LbmnKTXiJykzGU,660
12
+ rslearn/data_sources/aws_landsat.py,sha256=0ZQtmd2NCnvLy4vFSB1AlmoguJbiQB_e_T4eS1tnW9Q,20443
13
+ rslearn/data_sources/aws_open_data.py,sha256=lrHnMJTH3NAaRdNjxwCIxSq8rq90IvV4ho-qAG6Hdgc,29348
14
+ rslearn/data_sources/aws_sentinel1.py,sha256=knBg2ZdwzGRIibUPAqnhYR-DbHqFL4tLsuRVrucTWU4,4745
15
+ rslearn/data_sources/climate_data_store.py,sha256=4ZPVtwFCc35IhPVM24tqrmXTB61zABCDKYa4U4IKQhQ,11191
16
+ rslearn/data_sources/copernicus.py,sha256=DLyXwnkFo2LzbxfLKHkOvHyZcNYFg5w-yXQPeBL67_w,35049
17
+ rslearn/data_sources/data_source.py,sha256=lxdcxefETX5ui5uUdZn-ACSBhy6YVo4XDfk368EMD40,4862
18
+ rslearn/data_sources/earthdaily.py,sha256=BNP7BK_vb9yQw6LaIaJ80vjCfBZ9TeALGkjHYIet_W0,18205
19
+ rslearn/data_sources/earthdata_srtm.py,sha256=bwo8e_y9fFPliZ411tTWOiAUlEcb3AWBkeZxnkFY5SI,10633
20
+ rslearn/data_sources/eurocrops.py,sha256=FQqdBcNl43fArq6rd_-iffVJyliIDbB0lIHvNdmtQBU,8663
21
+ rslearn/data_sources/gcp_public_data.py,sha256=E3BhJqOgHMqwcfaxg7D47KNmfAwJDiDjH8-OdqNdjuI,36524
22
+ rslearn/data_sources/google_earth_engine.py,sha256=xdoSDjSVp6lPVPMv4UJZ6BRUozUA2hFbSTl1707TBoM,23523
23
+ rslearn/data_sources/local_files.py,sha256=mo5W_BxBl89EPTIHNDEpXM6qBjrP225KK0PcmNgvJZQ,19090
24
+ rslearn/data_sources/openstreetmap.py,sha256=TzZfouc2Z4_xjx2v_uv7aPn4tVW3flRVQN4qBfl507E,18161
25
+ rslearn/data_sources/planet.py,sha256=6FWQ0bl1k3jwvwp4EVGi2qs3OD1QhnKOKP36mN4HELI,9446
26
+ rslearn/data_sources/planet_basemap.py,sha256=e9R6FlagJjg8Z6Rc1dC6zK3xMkCohz8eohXqXmd29xg,9670
27
+ rslearn/data_sources/planetary_computer.py,sha256=qgvGe_hQDxAIrRVB9szvJZL5IvE2jTo8UWuKCMzx7jM,29773
28
+ rslearn/data_sources/usda_cdl.py,sha256=_WvxZkm0fbXfniRs6NT8iVCbTTmVPflDhsFT2ci6_Dk,6879
29
+ rslearn/data_sources/usgs_landsat.py,sha256=kPOb3hsZe5-guUcFZZkwzcRpYZ3Zo7Bk4E829q_xiyU,18516
30
+ rslearn/data_sources/utils.py,sha256=v_90ALOuts7RHNcx-j8o-aQ_aFjh8ZhXrmsaa9uEGDA,11651
33
31
  rslearn/data_sources/vector_source.py,sha256=NCa7CxIrGKe9yRT0NyyFKFQboDGDZ1h7663PV9OfMOM,44
34
- rslearn/data_sources/worldcereal.py,sha256=Psdf3EF3REj1WDltHWyMaICY3--KAJO_nEqpF0Gl_G8,21808
35
- rslearn/data_sources/worldcover.py,sha256=rimHJpQN9a56GaYxyHTOGXKzE3bkWKgd1UbH5A4aaGs,6097
36
- rslearn/data_sources/worldpop.py,sha256=HZrDJjz_5gXlHG6IOGIzVaL0Y4rO6FKF4FELMEX-lk4,5856
37
- rslearn/data_sources/xyz_tiles.py,sha256=SJV8TB6WUP6DTPr2d3LXRKVjFxda7bdR9IM84VvaRto,14618
32
+ rslearn/data_sources/worldcereal.py,sha256=rGGxwJAC3pAASVBQoUhwS3qL-qcmF6W__Tb53qWCEmE,21501
33
+ rslearn/data_sources/worldcover.py,sha256=n7gi-JRytxkvkUhKT--dVziMcWSSyMbZA7ZCzLT2MJY,6037
34
+ rslearn/data_sources/worldpop.py,sha256=S3RSc5kTwSs2bcREjNarBsqf3MBX5CN0eHj7Qkx4K74,5625
35
+ rslearn/data_sources/xyz_tiles.py,sha256=P601CvUmoVDC_ZRVhPKaIoPYYCq5UhZ-v7DaGlN5y_0,13797
38
36
  rslearn/dataset/__init__.py,sha256=bHtBlEEBCekO-gaJqiww0-VjvZTE5ahx0llleo8bfP8,289
39
37
  rslearn/dataset/add_windows.py,sha256=pwCEvwLE1jQCoqQxw6CJ-sP46ayWppFa2hGYIB6VVkc,8494
40
- rslearn/dataset/dataset.py,sha256=bjf9nI55j-MF0bIQWSNPjNbpfqnLK4jy-96TAcwO0MM,5214
38
+ rslearn/dataset/dataset.py,sha256=qmZmFfQOHoKVx6_sBYtBR5H4GTNMgETvq0S4XrqafQU,5165
41
39
  rslearn/dataset/handler_summaries.py,sha256=wI99RDk5erCWkzl1A7Uc4chatQ9KWIr4F_0Hxr9Co6s,2607
42
40
  rslearn/dataset/index.py,sha256=Wni5m6h4gisRB54fPLnCfUrRTEsJ5EvwS0fs9sYc2wg,6025
43
- rslearn/dataset/manage.py,sha256=IURlbCtm9a5f4d52AXfte1yyodlf6MgjfYn3__GdIL4,19062
44
- rslearn/dataset/materialize.py,sha256=-z47svc_JqGhzkp8kq5Hd9fykWNqFEUCQezo887TWBw,22056
41
+ rslearn/dataset/manage.py,sha256=-lGSIgk6Z7-verF_POwe4n5w9eSpgyt4nEOcOj382rc,18971
42
+ rslearn/dataset/materialize.py,sha256=x7FewmdqFUviLtPZGZIfAcw1rd0wfKZhk_N-uN-tQms,20922
45
43
  rslearn/dataset/remap.py,sha256=6MaImsY02GNACpvRM81RvWmjZWRfAHxo_R3Ox6XLF6A,2723
46
44
  rslearn/dataset/window.py,sha256=I5RqZ12jlIXhohw4qews1x_I4tSDpml709DZRtLiN24,12546
47
45
  rslearn/models/__init__.py,sha256=_vWoF9d2Slah8-6XhYhdU4SRsy_CNxXjCGQTD2yvu3Q,22
48
46
  rslearn/models/anysat.py,sha256=3Oh2gWxicVdUzOjevBEZf0PuolmCy0KC5Ad7JY-0Plc,7949
49
47
  rslearn/models/clip.py,sha256=u5aqYnVB4Jag7o1h8EzPDAc1t2BAHeALA9FcUwP5tfo,2238
48
+ rslearn/models/concatenate_features.py,sha256=qQPwKF-wz18hC1EA1OS81C6RPjYggPrZ5grCuHIM4aY,3434
50
49
  rslearn/models/conv.py,sha256=fWyByeswIOKKzyPmP3erYUlZaKEV0huWHA4CyKTBbfY,1703
51
50
  rslearn/models/croma.py,sha256=n7yunpT7lo8vWWaOpx4yt8jZSXjgWqfgZcZKFW5zuEQ,10591
52
51
  rslearn/models/dinov3.py,sha256=9k9kNlXCorQQwKjLGptooANd48TUBsITQ1e4fUomlM4,6337
@@ -104,16 +103,16 @@ rslearn/models/panopticon_data/sensors/wv23.yaml,sha256=SWYSlkka6UViKAz6YI8aqwQ-
104
103
  rslearn/models/presto/__init__.py,sha256=eZrB-XKi_vYqZhpyAOwppJi4dRuMtYVAdbq7KRygze0,64
105
104
  rslearn/models/presto/presto.py,sha256=8mZnc0jk_r_JikybHQNyyHg6t7JNPmoPmgoivyNf-U8,9177
106
105
  rslearn/models/presto/single_file_presto.py,sha256=Kbwp8V7pO8HHM2vlCPpjekQiFiDryW8zQkWmt1g05BY,30381
107
- rslearn/tile_stores/__init__.py,sha256=o_tWVKu6UwFzZbO9jn_3cmIDqc_Q3qDd6tA9If0T_Qk,2050
106
+ rslearn/tile_stores/__init__.py,sha256=-cW1J7So60SEP5ZLHCPdaFBV5CxvV3QlOhaFnUkhTJ0,1675
108
107
  rslearn/tile_stores/default.py,sha256=PYaDNvBxhJTDKJGw0EjDTSE1OKajR7_iJpMbOjj-mE8,15054
109
108
  rslearn/tile_stores/tile_store.py,sha256=9AeYduDYPp_Ia2NMlq6osptpz_AFGIOQcLJrqZ_m-z0,10469
110
109
  rslearn/train/__init__.py,sha256=fnJyY4aHs5zQqbDKSfXsJZXY_M9fbTsf7dRYaPwZr2M,30
111
110
  rslearn/train/all_patches_dataset.py,sha256=xFJ96HU3CodrUBzXTsgrmEShosKH79T2SxI0xDVSH3Q,18217
112
111
  rslearn/train/data_module.py,sha256=pgut8rEWHIieZ7RR8dUvhtlNqk0egEdznYF3tCvqdHg,23552
113
- rslearn/train/dataset.py,sha256=8F3bpus25g_NG0-CwMCuznwKxOvBDClNBCOEvDbMyN8,34312
112
+ rslearn/train/dataset.py,sha256=OLPBtVf7tmHodoMnB_gI-jLQq2xQ9aXz38Hq8kBgbp0,33944
114
113
  rslearn/train/lightning_module.py,sha256=ZLBiId3secUlVs2yzkN-mwVv4rMdh5TkdZYl4vv_Cw0,14466
115
114
  rslearn/train/optimizer.py,sha256=EKSqkmERalDA0bF32Gey7n6z69KLyaUWKlRsGJfKBmE,927
116
- rslearn/train/prediction_writer.py,sha256=mDvREwEB5k5_tNuBnYIvAGnxS3sYFWQYvV07V3UEe2k,14106
115
+ rslearn/train/prediction_writer.py,sha256=D2CCLlwlElMoMxnPiI6B9Q9HafGspuwoqYD8TKq98pk,13173
117
116
  rslearn/train/scheduler.py,sha256=wFbmycMHgL6nRYeYalDjb0G8YVo8VD3T3sABS61jJ7c,2318
118
117
  rslearn/train/callbacks/__init__.py,sha256=VNV0ArZyYMvl3dGK2wl6F046khYJ1dEBlJS6G_SYNm0,47
119
118
  rslearn/train/callbacks/adapters.py,sha256=yfv8nyCj3jmo2_dNkFrjukKxh0MHsf2xKqWwMF0QUtY,1869
@@ -121,7 +120,7 @@ rslearn/train/callbacks/freeze_unfreeze.py,sha256=8fIzBMhCKKjpTffIeAdhdSjsBd8NjT
121
120
  rslearn/train/callbacks/gradients.py,sha256=4YqCf0tBb6E5FnyFYbveXfQFlgNPyxIXb2FCWX4-6qs,5075
122
121
  rslearn/train/callbacks/peft.py,sha256=wEOKsS3RhsRaZTXn_Kz2wdsZdIiIaZPdCJWtdJBurT8,4156
123
122
  rslearn/train/tasks/__init__.py,sha256=dag1u72x1-me6y0YcOubUo5MYZ0Tjf6-dOir9UeFNMs,75
124
- rslearn/train/tasks/classification.py,sha256=kahVdXPU6fDwDCdqlrjZGb9uA-PYG74DbQQ0kJUt-Eg,13186
123
+ rslearn/train/tasks/classification.py,sha256=8nSv0caf2PzV3Pmme_iN4WQIac4ry3hdW6FRHbh4L1M,13152
125
124
  rslearn/train/tasks/detection.py,sha256=9j9webusrjGexvUmZ7gl3NTBS63Qq511VFlB2WbLi5Y,22302
126
125
  rslearn/train/tasks/embedding.py,sha256=DK3l1aQ3d5gQUT1h3cD6vcUaNKvSsH26RHx2Bbzutbg,3667
127
126
  rslearn/train/tasks/multi_task.py,sha256=dBWsnbvQ0CReNsbDHmZ_-sXjUE0H4S2OPcbJwMquG9g,6016
@@ -142,22 +141,22 @@ rslearn/train/transforms/transform.py,sha256=n1Qzqix2dVvej-Q7iPzHeOQbqH79IBlvqPo
142
141
  rslearn/utils/__init__.py,sha256=GNvdTUmXakiEMnLdje7k1fe5aC7SFVqP757kbpN6Fzw,558
143
142
  rslearn/utils/array.py,sha256=RC7ygtPnQwU6Lb9kwORvNxatJcaJ76JPsykQvndAfes,2444
144
143
  rslearn/utils/feature.py,sha256=lsg0WThZDJzo1mrbaL04dXYI5G3x-n5FG9aEjj7uUaI,1649
145
- rslearn/utils/fsspec.py,sha256=9QwN46heBhjUnth3qFeRNE3W6Wlr6dM3twYVswPnS9o,5300
144
+ rslearn/utils/fsspec.py,sha256=h3fER_bkewzR9liEAULXguTIvXLUXA17pC_yZoWN5Tk,5902
146
145
  rslearn/utils/geometry.py,sha256=oZllq1aBFcDewTTDYAMnTeP1xR0EdB5Xz3ILmfASo-8,18455
147
146
  rslearn/utils/get_utm_ups_crs.py,sha256=kUrcyjCK7KWvuP1XR-nURPeRqYeRO-3L8QUJ1QTF9Ps,3599
148
147
  rslearn/utils/grid_index.py,sha256=hRmrtgpqN1pLa-djnZtgSXqKJlbgGyttGnCEmPLD0zo,2347
149
- rslearn/utils/jsonargparse.py,sha256=JcTKQoZ6jgwag-kSeTIEVBO9AsRj0X1oEJBsoaCazH4,658
148
+ rslearn/utils/jsonargparse.py,sha256=gpGbo5KOrF1_1_sgHFEzAA1c_-SZCATOg6hLju8jxUs,2697
150
149
  rslearn/utils/mp.py,sha256=XYmVckI5TOQuCKc49NJyirDJyFgvb4AI-gGypG2j680,1399
151
- rslearn/utils/raster_format.py,sha256=RDzDPnWUJunqcj-F4oXKBl-rKFBUpRjvq7mMYhid3iU,27413
150
+ rslearn/utils/raster_format.py,sha256=qZpbODF4I7BsOxf43O6vTmH2TSNw6N8PP0wsFUVvdIw,26267
152
151
  rslearn/utils/rtree_index.py,sha256=j0Zwrq3pXuAJ-hKpiRFQ7VNtvO3fZYk-Em2uBPAqfx4,6460
153
152
  rslearn/utils/spatial_index.py,sha256=eomJAUgzmjir8j9HZnSgQoJHwN9H0wGTjmJkMkLLfsU,762
154
153
  rslearn/utils/sqlite_index.py,sha256=YGOJi66544e6JNtfSft6YIlHklFdSJO2duxQ4TJ2iu4,2920
155
154
  rslearn/utils/time.py,sha256=2ilSLG94_sxLP3y5RSV5L5CG8CoND_dbdzYEHVtN-I8,387
156
- rslearn/utils/vector_format.py,sha256=EIChYCL6GLOILS2TO2JBkca1TuaWsSubWv6iRS3P2ds,16139
157
- rslearn-0.0.15.dist-info/licenses/LICENSE,sha256=_99ZWPoLdlUbqZoSC5DF4ihiNwl5rTEmBaq2fACecdg,11352
158
- rslearn-0.0.15.dist-info/licenses/NOTICE,sha256=wLPr6rwV_jCg-xEknNGwhnkfRfuoOE9MZ-lru2yZyLI,5070
159
- rslearn-0.0.15.dist-info/METADATA,sha256=HRkJjQfvxCEosmCBvLcLd9nZnXjbmfAgPIknMy_ORBo,36319
160
- rslearn-0.0.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
161
- rslearn-0.0.15.dist-info/entry_points.txt,sha256=doTBQ57NT7nq-dgYGgTTw6mafcGWb_4PWYtYR4rGm50,46
162
- rslearn-0.0.15.dist-info/top_level.txt,sha256=XDKo90WBH8P9RQumHxo0giLJsoufT4r9odv-WE6Ahk4,8
163
- rslearn-0.0.15.dist-info/RECORD,,
155
+ rslearn/utils/vector_format.py,sha256=4ZDYpfBLLxguJkiIaavTagiQK2Sv4Rz9NumbHlq-3Lw,15041
156
+ rslearn-0.0.16.dist-info/licenses/LICENSE,sha256=_99ZWPoLdlUbqZoSC5DF4ihiNwl5rTEmBaq2fACecdg,11352
157
+ rslearn-0.0.16.dist-info/licenses/NOTICE,sha256=wLPr6rwV_jCg-xEknNGwhnkfRfuoOE9MZ-lru2yZyLI,5070
158
+ rslearn-0.0.16.dist-info/METADATA,sha256=h0p9V4jlSLDsrC2_owCn0xEKL7Kka74mEsE_pj-tJf0,36319
159
+ rslearn-0.0.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
160
+ rslearn-0.0.16.dist-info/entry_points.txt,sha256=doTBQ57NT7nq-dgYGgTTw6mafcGWb_4PWYtYR4rGm50,46
161
+ rslearn-0.0.16.dist-info/top_level.txt,sha256=XDKo90WBH8P9RQumHxo0giLJsoufT4r9odv-WE6Ahk4,8
162
+ rslearn-0.0.16.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- """Placeholder for a GeoTIFF data source."""
@@ -1,23 +0,0 @@
1
- """Helper functions for raster data sources."""
2
-
3
- from rslearn.config import BandSetConfig
4
- from rslearn.log_utils import get_logger
5
-
6
- logger = get_logger(__name__)
7
-
8
-
9
- def is_raster_needed(raster_bands: list[str], band_sets: list[BandSetConfig]) -> bool:
10
- """Check if the raster by comparing its bands to the configured bands.
11
-
12
- Args:
13
- raster_bands: the list of bands in the raster in question.
14
- band_sets: the band sets configured in the dataset.
15
-
16
- Returns:
17
- whether the raster is needed for the dataset.
18
- """
19
- for band_set in band_sets:
20
- for band in band_set.bands:
21
- if band in raster_bands:
22
- return True
23
- return False