rslearn 0.0.1__py3-none-any.whl → 0.0.21__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 (166) hide show
  1. rslearn/arg_parser.py +31 -0
  2. rslearn/config/__init__.py +6 -12
  3. rslearn/config/dataset.py +520 -401
  4. rslearn/const.py +9 -15
  5. rslearn/data_sources/__init__.py +8 -23
  6. rslearn/data_sources/aws_landsat.py +242 -98
  7. rslearn/data_sources/aws_open_data.py +111 -151
  8. rslearn/data_sources/aws_sentinel1.py +131 -0
  9. rslearn/data_sources/climate_data_store.py +471 -0
  10. rslearn/data_sources/copernicus.py +884 -12
  11. rslearn/data_sources/data_source.py +43 -12
  12. rslearn/data_sources/earthdaily.py +484 -0
  13. rslearn/data_sources/earthdata_srtm.py +282 -0
  14. rslearn/data_sources/eurocrops.py +242 -0
  15. rslearn/data_sources/gcp_public_data.py +578 -222
  16. rslearn/data_sources/google_earth_engine.py +461 -135
  17. rslearn/data_sources/local_files.py +219 -150
  18. rslearn/data_sources/openstreetmap.py +51 -89
  19. rslearn/data_sources/planet.py +24 -60
  20. rslearn/data_sources/planet_basemap.py +275 -0
  21. rslearn/data_sources/planetary_computer.py +798 -0
  22. rslearn/data_sources/usda_cdl.py +195 -0
  23. rslearn/data_sources/usgs_landsat.py +115 -83
  24. rslearn/data_sources/utils.py +249 -61
  25. rslearn/data_sources/vector_source.py +1 -0
  26. rslearn/data_sources/worldcereal.py +449 -0
  27. rslearn/data_sources/worldcover.py +144 -0
  28. rslearn/data_sources/worldpop.py +153 -0
  29. rslearn/data_sources/xyz_tiles.py +150 -107
  30. rslearn/dataset/__init__.py +8 -2
  31. rslearn/dataset/add_windows.py +2 -2
  32. rslearn/dataset/dataset.py +40 -51
  33. rslearn/dataset/handler_summaries.py +131 -0
  34. rslearn/dataset/manage.py +313 -74
  35. rslearn/dataset/materialize.py +431 -107
  36. rslearn/dataset/remap.py +29 -4
  37. rslearn/dataset/storage/__init__.py +1 -0
  38. rslearn/dataset/storage/file.py +202 -0
  39. rslearn/dataset/storage/storage.py +140 -0
  40. rslearn/dataset/window.py +181 -44
  41. rslearn/lightning_cli.py +454 -0
  42. rslearn/log_utils.py +24 -0
  43. rslearn/main.py +384 -181
  44. rslearn/models/anysat.py +215 -0
  45. rslearn/models/attention_pooling.py +177 -0
  46. rslearn/models/clay/clay.py +231 -0
  47. rslearn/models/clay/configs/metadata.yaml +295 -0
  48. rslearn/models/clip.py +68 -0
  49. rslearn/models/component.py +111 -0
  50. rslearn/models/concatenate_features.py +103 -0
  51. rslearn/models/conv.py +63 -0
  52. rslearn/models/croma.py +306 -0
  53. rslearn/models/detr/__init__.py +5 -0
  54. rslearn/models/detr/box_ops.py +103 -0
  55. rslearn/models/detr/detr.py +504 -0
  56. rslearn/models/detr/matcher.py +107 -0
  57. rslearn/models/detr/position_encoding.py +114 -0
  58. rslearn/models/detr/transformer.py +429 -0
  59. rslearn/models/detr/util.py +24 -0
  60. rslearn/models/dinov3.py +177 -0
  61. rslearn/models/faster_rcnn.py +30 -28
  62. rslearn/models/feature_center_crop.py +53 -0
  63. rslearn/models/fpn.py +19 -8
  64. rslearn/models/galileo/__init__.py +5 -0
  65. rslearn/models/galileo/galileo.py +595 -0
  66. rslearn/models/galileo/single_file_galileo.py +1678 -0
  67. rslearn/models/module_wrapper.py +65 -0
  68. rslearn/models/molmo.py +69 -0
  69. rslearn/models/multitask.py +384 -28
  70. rslearn/models/olmoearth_pretrain/__init__.py +1 -0
  71. rslearn/models/olmoearth_pretrain/model.py +421 -0
  72. rslearn/models/olmoearth_pretrain/norm.py +86 -0
  73. rslearn/models/panopticon.py +170 -0
  74. rslearn/models/panopticon_data/sensors/drone.yaml +32 -0
  75. rslearn/models/panopticon_data/sensors/enmap.yaml +904 -0
  76. rslearn/models/panopticon_data/sensors/goes.yaml +9 -0
  77. rslearn/models/panopticon_data/sensors/himawari.yaml +9 -0
  78. rslearn/models/panopticon_data/sensors/intuition.yaml +606 -0
  79. rslearn/models/panopticon_data/sensors/landsat8.yaml +84 -0
  80. rslearn/models/panopticon_data/sensors/modis_terra.yaml +99 -0
  81. rslearn/models/panopticon_data/sensors/qb2_ge1.yaml +34 -0
  82. rslearn/models/panopticon_data/sensors/sentinel1.yaml +85 -0
  83. rslearn/models/panopticon_data/sensors/sentinel2.yaml +97 -0
  84. rslearn/models/panopticon_data/sensors/superdove.yaml +60 -0
  85. rslearn/models/panopticon_data/sensors/wv23.yaml +63 -0
  86. rslearn/models/pick_features.py +17 -10
  87. rslearn/models/pooling_decoder.py +60 -7
  88. rslearn/models/presto/__init__.py +5 -0
  89. rslearn/models/presto/presto.py +297 -0
  90. rslearn/models/presto/single_file_presto.py +926 -0
  91. rslearn/models/prithvi.py +1147 -0
  92. rslearn/models/resize_features.py +59 -0
  93. rslearn/models/sam2_enc.py +13 -9
  94. rslearn/models/satlaspretrain.py +38 -18
  95. rslearn/models/simple_time_series.py +188 -77
  96. rslearn/models/singletask.py +24 -13
  97. rslearn/models/ssl4eo_s12.py +40 -30
  98. rslearn/models/swin.py +44 -32
  99. rslearn/models/task_embedding.py +250 -0
  100. rslearn/models/terramind.py +256 -0
  101. rslearn/models/trunk.py +139 -0
  102. rslearn/models/unet.py +68 -22
  103. rslearn/models/upsample.py +48 -0
  104. rslearn/models/use_croma.py +508 -0
  105. rslearn/template_params.py +26 -0
  106. rslearn/tile_stores/__init__.py +41 -18
  107. rslearn/tile_stores/default.py +409 -0
  108. rslearn/tile_stores/tile_store.py +236 -132
  109. rslearn/train/all_patches_dataset.py +530 -0
  110. rslearn/train/callbacks/adapters.py +53 -0
  111. rslearn/train/callbacks/freeze_unfreeze.py +348 -17
  112. rslearn/train/callbacks/gradients.py +129 -0
  113. rslearn/train/callbacks/peft.py +116 -0
  114. rslearn/train/data_module.py +444 -20
  115. rslearn/train/dataset.py +588 -235
  116. rslearn/train/lightning_module.py +192 -62
  117. rslearn/train/model_context.py +88 -0
  118. rslearn/train/optimizer.py +31 -0
  119. rslearn/train/prediction_writer.py +319 -84
  120. rslearn/train/scheduler.py +92 -0
  121. rslearn/train/tasks/classification.py +55 -28
  122. rslearn/train/tasks/detection.py +132 -76
  123. rslearn/train/tasks/embedding.py +120 -0
  124. rslearn/train/tasks/multi_task.py +28 -14
  125. rslearn/train/tasks/per_pixel_regression.py +291 -0
  126. rslearn/train/tasks/regression.py +161 -44
  127. rslearn/train/tasks/segmentation.py +428 -53
  128. rslearn/train/tasks/task.py +6 -5
  129. rslearn/train/transforms/__init__.py +1 -1
  130. rslearn/train/transforms/concatenate.py +54 -10
  131. rslearn/train/transforms/crop.py +29 -11
  132. rslearn/train/transforms/flip.py +18 -6
  133. rslearn/train/transforms/mask.py +78 -0
  134. rslearn/train/transforms/normalize.py +101 -17
  135. rslearn/train/transforms/pad.py +19 -7
  136. rslearn/train/transforms/resize.py +83 -0
  137. rslearn/train/transforms/select_bands.py +76 -0
  138. rslearn/train/transforms/sentinel1.py +75 -0
  139. rslearn/train/transforms/transform.py +89 -70
  140. rslearn/utils/__init__.py +2 -6
  141. rslearn/utils/array.py +8 -6
  142. rslearn/utils/feature.py +2 -2
  143. rslearn/utils/fsspec.py +90 -1
  144. rslearn/utils/geometry.py +347 -7
  145. rslearn/utils/get_utm_ups_crs.py +2 -3
  146. rslearn/utils/grid_index.py +5 -5
  147. rslearn/utils/jsonargparse.py +178 -0
  148. rslearn/utils/mp.py +4 -3
  149. rslearn/utils/raster_format.py +268 -116
  150. rslearn/utils/rtree_index.py +64 -17
  151. rslearn/utils/sqlite_index.py +7 -1
  152. rslearn/utils/vector_format.py +252 -97
  153. {rslearn-0.0.1.dist-info → rslearn-0.0.21.dist-info}/METADATA +532 -283
  154. rslearn-0.0.21.dist-info/RECORD +167 -0
  155. {rslearn-0.0.1.dist-info → rslearn-0.0.21.dist-info}/WHEEL +1 -1
  156. rslearn-0.0.21.dist-info/licenses/NOTICE +115 -0
  157. rslearn/data_sources/raster_source.py +0 -309
  158. rslearn/models/registry.py +0 -5
  159. rslearn/tile_stores/file.py +0 -242
  160. rslearn/utils/mgrs.py +0 -24
  161. rslearn/utils/utils.py +0 -22
  162. rslearn-0.0.1.dist-info/RECORD +0 -88
  163. /rslearn/{data_sources/geotiff.py → py.typed} +0 -0
  164. {rslearn-0.0.1.dist-info → rslearn-0.0.21.dist-info}/entry_points.txt +0 -0
  165. {rslearn-0.0.1.dist-info → rslearn-0.0.21.dist-info/licenses}/LICENSE +0 -0
  166. {rslearn-0.0.1.dist-info → rslearn-0.0.21.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,167 @@
1
+ rslearn/__init__.py,sha256=fFmAen3vxZyosEfPbG0W46IttujYGVxzrGkJ0YutmmY,73
2
+ rslearn/arg_parser.py,sha256=Go1MyEflcau_cziirmNd7Yhxa0WtXTAljIVE4f5H1GE,1194
3
+ rslearn/const.py,sha256=FUCfsvFAs-QarEDJ0grdy0C1HjUjLpNFYGo5I2Vpc5Y,449
4
+ rslearn/lightning_cli.py,sha256=1eTeffUlFqBe2KnyuYyXJdNKYQClCA-PV1xr0vJyJao,17972
5
+ rslearn/log_utils.py,sha256=unD9gShiuO7cx5Nnq8qqVQ4qrbOOwFVgcHxN5bXuiAo,941
6
+ rslearn/main.py,sha256=jRMYeU3-QvYSkTAJB69S1mHEft7-5_-RomzX1B-b8GM,28581
7
+ rslearn/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ rslearn/template_params.py,sha256=Vop0Ha-S44ctCa9lvSZRjrMETznJZlR5y_gJrVIwrPg,791
9
+ rslearn/config/__init__.py,sha256=n1qpZ0ImshTtLYl5mC73BORYyUcjPJyHiyZkqUY1hiY,474
10
+ rslearn/config/dataset.py,sha256=AJlS-41B70E2Y4ST545J2P3Kz83jrFCRdkZecKZ7sQY,23255
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=gwlbugwAT0YoOINOKNVlZuzpxUO5G0tfzwy4XVlURFg,18360
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
31
+ rslearn/data_sources/vector_source.py,sha256=NCa7CxIrGKe9yRT0NyyFKFQboDGDZ1h7663PV9OfMOM,44
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
36
+ rslearn/dataset/__init__.py,sha256=bHtBlEEBCekO-gaJqiww0-VjvZTE5ahx0llleo8bfP8,289
37
+ rslearn/dataset/add_windows.py,sha256=NwIvku6zxCJ9kgVFa5phJc0Gj1Y1bCzh6TLb9nEGl0s,8462
38
+ rslearn/dataset/dataset.py,sha256=YyGFy_VGUaOPfrEQqBl0Fp5JAsH3KNCqo6ZTu3TW4yY,3223
39
+ rslearn/dataset/handler_summaries.py,sha256=wI99RDk5erCWkzl1A7Uc4chatQ9KWIr4F_0Hxr9Co6s,2607
40
+ rslearn/dataset/manage.py,sha256=-lGSIgk6Z7-verF_POwe4n5w9eSpgyt4nEOcOj382rc,18971
41
+ rslearn/dataset/materialize.py,sha256=o05OeLk_wWEOsw15oc5yjpD4J-twGCTfXAtxyAQsQ9I,20974
42
+ rslearn/dataset/remap.py,sha256=6MaImsY02GNACpvRM81RvWmjZWRfAHxo_R3Ox6XLF6A,2723
43
+ rslearn/dataset/window.py,sha256=X4q8YzcSOTtwKxCPf71QLMoyKUtYMSnZu0kPnmVSUx4,10644
44
+ rslearn/dataset/storage/__init__.py,sha256=R50AVV5LH2g7ol0-jyvGcB390VsclXGbJXz4fmkn9as,52
45
+ rslearn/dataset/storage/file.py,sha256=g9HZ3CD4QcgyVNsBaXhjIKQgDOAeZ4R08sJ7ntx4wo8,6815
46
+ rslearn/dataset/storage/storage.py,sha256=DxZ7iwV938PiLwdQzb5EXSb4Mj8bRGmOTmA9fzq_Ge8,4840
47
+ rslearn/models/__init__.py,sha256=_vWoF9d2Slah8-6XhYhdU4SRsy_CNxXjCGQTD2yvu3Q,22
48
+ rslearn/models/anysat.py,sha256=nzk6hB83ltNFNXYRNA1rTvq2AQcAhwyvgBaZui1M37o,8107
49
+ rslearn/models/attention_pooling.py,sha256=VeRoBLk0326Kpj780Pw8EiSFMU5_K9qg6HQO-B2r2PU,7044
50
+ rslearn/models/clip.py,sha256=QG1oUFqcVuNEhx7BNfJ1FnxIOMNUwRNBwXCe3CR6wFI,2415
51
+ rslearn/models/component.py,sha256=uikFDzPYaW_LSXsrSsES1aup4IDIuWHsitWLpKgF7zU,3432
52
+ rslearn/models/concatenate_features.py,sha256=Attemr5KurxlOojpclD0Pd5Cu2KHpNdpXe8jCSjpJ9U,3818
53
+ rslearn/models/conv.py,sha256=dEAAfhPo4bFlZPSAQjzqZTpP-hdJ394TytYssVK-fDA,2001
54
+ rslearn/models/croma.py,sha256=BcKV4-D4uira6f9zvW73aslF_XitAhObnyrE_3iTcTs,11008
55
+ rslearn/models/dinov3.py,sha256=-hyhkxbjns66s9xKT3bPU1dTzanPPc7qJ0dNAwV19-E,6497
56
+ rslearn/models/faster_rcnn.py,sha256=yOipLPmVHbadvYCR9xfCYgmkU9Mot6fgDK-kKicVTlo,8685
57
+ rslearn/models/feature_center_crop.py,sha256=_Mu3E4iJLBug9I4ZIBIpB_VJo-xGterHmhtIFGaHR34,1808
58
+ rslearn/models/fpn.py,sha256=qm7nKMgsZrCoAdz8ASmNKU2nvZ6USm5CedMfy_w_gwE,2079
59
+ rslearn/models/module_wrapper.py,sha256=73JspaglnNabUGZB2EiCYF_dZ3-Kicg_OpoTfUWHONk,2271
60
+ rslearn/models/molmo.py,sha256=lXnevwTCNyc1XcnJUB5_pK1G2AJGYMvQYU21mZFf5u0,2246
61
+ rslearn/models/multitask.py,sha256=bpFxvtFowRyT-tvRSdY7AKbEx_i1y7sToEzZgTMcF4s,16264
62
+ rslearn/models/panopticon.py,sha256=lXXBusXZfwdf10rBVPAQSbaGOMyKCDeEBmXShzvfMoU,5947
63
+ rslearn/models/pick_features.py,sha256=fI9SYubqpCWOAHYGVUSg5sgD31dsnAR9mNuLmqfIeL8,1110
64
+ rslearn/models/pooling_decoder.py,sha256=zrMH6wUExCa-XD1q9CIFD2ScgiasapyJs9plhcUxhIs,4767
65
+ rslearn/models/prithvi.py,sha256=J45eC1pd4l5AGlr19Qjrjrw5PPwvYE9bNM5qCFoznmg,40390
66
+ rslearn/models/resize_features.py,sha256=U7ZIVwwToJJnwchFG59wLWWP9eikHDB_1c4OtpubxHU,1693
67
+ rslearn/models/sam2_enc.py,sha256=WZOtlp0FjaVztW4gEVIcsFQdKArS9iblRODP0b6Oc8M,3641
68
+ rslearn/models/satlaspretrain.py,sha256=2R48ulbtd44Qy2FYJCkllE2Wk35eZxkc79ruSgkmgcQ,3384
69
+ rslearn/models/simple_time_series.py,sha256=Nfk5E3d9W-4AyLQiy-P8p-JvxmFYE3FBrvOgttjXSMw,14678
70
+ rslearn/models/singletask.py,sha256=9DM9a9-Mv3vVQqRhPOIXG2HHuVqVa_zuvgafeeYh4r0,1903
71
+ rslearn/models/ssl4eo_s12.py,sha256=DOlpIj6NfjIlWyJ27m9Xo8TMlovBDstFq0ARnmAJ6qY,3919
72
+ rslearn/models/swin.py,sha256=Xqr3SswbHP6IhwT2atZMAPF2TUzQqfxvihksb8WSeRo,6065
73
+ rslearn/models/task_embedding.py,sha256=Z6sf61BLCtvdrdnvjh8500b-KiFp3GeWbT4mOqpaCKk,9100
74
+ rslearn/models/terramind.py,sha256=Ob0bmpo2YdFb__cWcIdHhyvllNfbZ8FF3dpermutqjQ,8790
75
+ rslearn/models/trunk.py,sha256=1GCH9iyLIytoHVntLSMwfH9duQpe1W4DPmOClLpPKjc,4778
76
+ rslearn/models/unet.py,sha256=HuuINvkB1-5w9ZOTXZCWkVxJShruPKCol8pKeA3zw_4,7251
77
+ rslearn/models/upsample.py,sha256=JvfnktT6Dgcql3cSoySWXZ7dmkDkfpRo6vDkpz8KFAQ,1326
78
+ rslearn/models/use_croma.py,sha256=OSBqMuLp-pDtqPNWAVBfmX4wckmyYCKtUDdGCjJk_K8,17966
79
+ rslearn/models/clay/clay.py,sha256=q2vcqyRFhCJvzLHwHLxHfWGyvVt819Xmk7TzuhXdPFI,8478
80
+ rslearn/models/clay/configs/metadata.yaml,sha256=rZTFh4Yb9htEfbQNOPl4HTbFogEhzwIRqFzG-1uT01Y,4652
81
+ rslearn/models/detr/__init__.py,sha256=GGAnTIhyuvl34IRrJ_4gXjm_01OlM5rbQQ3c3TGfbK8,84
82
+ rslearn/models/detr/box_ops.py,sha256=ORCF6EwMpMBB_VgQT05SjR47dCR2rN2gPhL_gsuUWJs,3236
83
+ rslearn/models/detr/detr.py,sha256=ZiYNwJ3zWqZdvvzc0CXDzdvcwSCO_wSOCWlChemTsX8,19178
84
+ rslearn/models/detr/matcher.py,sha256=4h_xFlgTMEJvJ6aLZUamrKZ72L5hDk9wPglNZ81JBg8,4533
85
+ rslearn/models/detr/position_encoding.py,sha256=8FFoBT-Jtgqk7D4qDBTbVLOeAdmjdjtJTC608TaX6yY,3869
86
+ rslearn/models/detr/transformer.py,sha256=aK4HO7AkCZn7xGHP3Iq91w2iFPVshugOILYAjVjroCw,13971
87
+ rslearn/models/detr/util.py,sha256=NMHhHbkIo7PoBUVbDqa2ZknJBTswmaxFCGHrPtFKnGg,676
88
+ rslearn/models/galileo/__init__.py,sha256=QQa0C29nuPRva0KtGiMHQ2ZB02n9SSwj_wqTKPz18NM,112
89
+ rslearn/models/galileo/galileo.py,sha256=CTEuYGPmxhVv8YsZzFm0BeVW2yvdXp7j1GifT53EDLU,22525
90
+ rslearn/models/galileo/single_file_galileo.py,sha256=l5tlmmdr2eieHNH-M7rVIvcptkv0Fuk3vKXFW691ezA,56143
91
+ rslearn/models/olmoearth_pretrain/__init__.py,sha256=AjRvbjBdadCdPh-EdvySH76sVAQ8NGQaJt11Tsn1D5I,36
92
+ rslearn/models/olmoearth_pretrain/model.py,sha256=Mfq7mv438zhOHBsU2jT19NMslNlslWm1-sCE06wVlbo,17829
93
+ rslearn/models/olmoearth_pretrain/norm.py,sha256=pV-u9eBGxfiSFDMEipDwyTgKGhN1G5kSoOC5CBE1m-0,3336
94
+ rslearn/models/panopticon_data/sensors/drone.yaml,sha256=xqWS-_QMtJyRoWXJm-igoSur9hAmCFdqkPin8DT5qpw,431
95
+ rslearn/models/panopticon_data/sensors/enmap.yaml,sha256=b2j6bSgYR2yKR9DRm3SPIzSVYlHf51ny_p-1B4B9sB4,13431
96
+ rslearn/models/panopticon_data/sensors/goes.yaml,sha256=o00aoWCYqam0aB1rPmXq1MKe8hsKak_qyBG7BPL27Sc,152
97
+ rslearn/models/panopticon_data/sensors/himawari.yaml,sha256=UzAgB1jpRQkuDb_MUOQcGfs7t8RO3JhPDHgA5WSJkc0,152
98
+ rslearn/models/panopticon_data/sensors/intuition.yaml,sha256=Om82ICOxjy3uU5XAOUTgDsu_yx6Ms4cJUucbqHlToTA,8491
99
+ rslearn/models/panopticon_data/sensors/landsat8.yaml,sha256=MB8lq9FgyaGivx3OobBLsbPm8T4jBopGlQXUmSnleeU,1394
100
+ rslearn/models/panopticon_data/sensors/modis_terra.yaml,sha256=ltgje4i8qBabxvXI61JJdtsY-0AJ3zxcBSDfbALoSNA,1563
101
+ rslearn/models/panopticon_data/sensors/qb2_ge1.yaml,sha256=5IzuBOXctayDW-UpH6vP5nDDJZP60ViG5Q9RuM2Ll78,613
102
+ rslearn/models/panopticon_data/sensors/sentinel1.yaml,sha256=vbJuThuOo4JHb1cRajoOGb66_iuCVnUNDNR5GIg1YEs,1156
103
+ rslearn/models/panopticon_data/sensors/sentinel2.yaml,sha256=qYJ92x-GHO0ZdCrTtCjG_47Yw4MiSFeoKjVbJV-_60Q,1670
104
+ rslearn/models/panopticon_data/sensors/superdove.yaml,sha256=QpIRyopdV4hAez_EIsDwhGFT4VtTk7UgzQveyc8t8fc,795
105
+ rslearn/models/panopticon_data/sensors/wv23.yaml,sha256=SWYSlkka6UViKAz6YI8aqwQ-Ayo-S5kmNa9rO3iGW6o,1172
106
+ rslearn/models/presto/__init__.py,sha256=eZrB-XKi_vYqZhpyAOwppJi4dRuMtYVAdbq7KRygze0,64
107
+ rslearn/models/presto/presto.py,sha256=fkyHB85Hfx5L-4yejSFAFv83gk9VFqAR1GTgggtq0EA,11049
108
+ rslearn/models/presto/single_file_presto.py,sha256=-P00xjhj9dx3O6HqWpQmG9dPk_i6bT_t8vhX4uQm5tA,30242
109
+ rslearn/tile_stores/__init__.py,sha256=-cW1J7So60SEP5ZLHCPdaFBV5CxvV3QlOhaFnUkhTJ0,1675
110
+ rslearn/tile_stores/default.py,sha256=PYaDNvBxhJTDKJGw0EjDTSE1OKajR7_iJpMbOjj-mE8,15054
111
+ rslearn/tile_stores/tile_store.py,sha256=9AeYduDYPp_Ia2NMlq6osptpz_AFGIOQcLJrqZ_m-z0,10469
112
+ rslearn/train/__init__.py,sha256=fnJyY4aHs5zQqbDKSfXsJZXY_M9fbTsf7dRYaPwZr2M,30
113
+ rslearn/train/all_patches_dataset.py,sha256=EVoYCmS3g4OfWPt5CZzwHVx9isbnWh5HIGA0RBqPFeA,21145
114
+ rslearn/train/data_module.py,sha256=pgut8rEWHIieZ7RR8dUvhtlNqk0egEdznYF3tCvqdHg,23552
115
+ rslearn/train/dataset.py,sha256=Jy1jU3GigfHaFeX9rbveX9bqy2Pd5Wh_vquD6_aFnS8,36522
116
+ rslearn/train/lightning_module.py,sha256=HA9e-74oUZR5s7piQP9Mwxwz0vw0-p4HdmijfgBSpU0,14776
117
+ rslearn/train/model_context.py,sha256=6o66BY6okBK-D5e0JUwPd7fxD_XehVaqxdQkJJKmQ3E,2580
118
+ rslearn/train/optimizer.py,sha256=EKSqkmERalDA0bF32Gey7n6z69KLyaUWKlRsGJfKBmE,927
119
+ rslearn/train/prediction_writer.py,sha256=rW0BUaYT_F1QqmpnQlbrLiLya1iBfC5Pb78G_NlF-vA,15956
120
+ rslearn/train/scheduler.py,sha256=Yyq2fMHH08OyGt9qWD7iLc92XNIBbZHLtzlLR-f732s,2728
121
+ rslearn/train/callbacks/__init__.py,sha256=VNV0ArZyYMvl3dGK2wl6F046khYJ1dEBlJS6G_SYNm0,47
122
+ rslearn/train/callbacks/adapters.py,sha256=yfv8nyCj3jmo2_dNkFrjukKxh0MHsf2xKqWwMF0QUtY,1869
123
+ rslearn/train/callbacks/freeze_unfreeze.py,sha256=8fIzBMhCKKjpTffIeAdhdSjsBd8NjTZZEPBQaSul6Zc,17418
124
+ rslearn/train/callbacks/gradients.py,sha256=4YqCf0tBb6E5FnyFYbveXfQFlgNPyxIXb2FCWX4-6qs,5075
125
+ rslearn/train/callbacks/peft.py,sha256=wEOKsS3RhsRaZTXn_Kz2wdsZdIiIaZPdCJWtdJBurT8,4156
126
+ rslearn/train/tasks/__init__.py,sha256=dag1u72x1-me6y0YcOubUo5MYZ0Tjf6-dOir9UeFNMs,75
127
+ rslearn/train/tasks/classification.py,sha256=72ZBcbunMsdPYQN53S-4GfiLIDrr1X3Hni07dBJ0pu0,14261
128
+ rslearn/train/tasks/detection.py,sha256=B0tfB7UGIbRtjnye3PhzLmfeQ4X7ImO3A-_LeNhBA54,21988
129
+ rslearn/train/tasks/embedding.py,sha256=98ykdmfaxQjsH0UrUdTGmz1f0hCMPcNYTzt1YFqNQwQ,3869
130
+ rslearn/train/tasks/multi_task.py,sha256=1ML9mZ-kM3JfElisLOWBUn4k12gsKTFjoYYgamnyxt8,6124
131
+ rslearn/train/tasks/per_pixel_regression.py,sha256=znCLFaZbGx8lvIkntDXjcX7yy7giyyBdWN-TwTGaPV4,10197
132
+ rslearn/train/tasks/regression.py,sha256=bVS_ApZSpbL0NaaM8Mu5Bsu4SBUyLpVtrPslulvvZHs,12695
133
+ rslearn/train/tasks/segmentation.py,sha256=ie9ZV-sklLjQs35caiEglC1xff6dxeug_N-f_A8VosA,23034
134
+ rslearn/train/tasks/task.py,sha256=B-z5XheXPTDaKauYzwze5ZD_O43R9uF76awgEk05bGE,3954
135
+ rslearn/train/transforms/__init__.py,sha256=BkCAzm4f-8TEhPIuyvCj7eJGh36aMkZFYlq-H_jkSvY,778
136
+ rslearn/train/transforms/concatenate.py,sha256=hVVBaxIdk1Cx8JHPirj54TGpbWAJx5y_xD7k1rmGmT0,3166
137
+ rslearn/train/transforms/crop.py,sha256=d5mrC8k7g4zz9J0RJrjz_pS1q06HfhUdzH6dUlL3Wqc,4668
138
+ rslearn/train/transforms/flip.py,sha256=KjMoZ4eFbu8119IlUDU4BBK06U76WjWEFmvqr9oiOMk,3836
139
+ rslearn/train/transforms/mask.py,sha256=KMz-KeC4cuahA8CdRWXK9omeMfwheEM8avhj6yXGmm8,2407
140
+ rslearn/train/transforms/normalize.py,sha256=H9hAYDVA__v0IpqC-7q_PyZ05qG6YTsORVQ7DTiLP6o,6382
141
+ rslearn/train/transforms/pad.py,sha256=5Mks7Vp8_hRlsRjw9PERsQ7mVVKTAfg7Q6jUguXMhGY,5109
142
+ rslearn/train/transforms/resize.py,sha256=AeMuhMlG-G7NRIMNucPESethohGe1ZKew-EVK2HzeSM,2636
143
+ rslearn/train/transforms/select_bands.py,sha256=vqerph1UUS9i2G9xwyH6_5AoOuH9tLER8zppR4XiZs4,2802
144
+ rslearn/train/transforms/sentinel1.py,sha256=PMMFo4RysMpZS7PBZ3yHGzJ5JADPZAOZpCbGhqL5vsc,2384
145
+ rslearn/train/transforms/transform.py,sha256=n1Qzqix2dVvej-Q7iPzHeOQbqH79IBlvqPoymxhNVpE,4446
146
+ rslearn/utils/__init__.py,sha256=GNvdTUmXakiEMnLdje7k1fe5aC7SFVqP757kbpN6Fzw,558
147
+ rslearn/utils/array.py,sha256=RC7ygtPnQwU6Lb9kwORvNxatJcaJ76JPsykQvndAfes,2444
148
+ rslearn/utils/feature.py,sha256=lsg0WThZDJzo1mrbaL04dXYI5G3x-n5FG9aEjj7uUaI,1649
149
+ rslearn/utils/fsspec.py,sha256=h3fER_bkewzR9liEAULXguTIvXLUXA17pC_yZoWN5Tk,5902
150
+ rslearn/utils/geometry.py,sha256=Z4alE4u0xa3fKGwoa4WQN5ZCjeqkPCJWfgcn8aw9t8I,21487
151
+ rslearn/utils/get_utm_ups_crs.py,sha256=kUrcyjCK7KWvuP1XR-nURPeRqYeRO-3L8QUJ1QTF9Ps,3599
152
+ rslearn/utils/grid_index.py,sha256=hRmrtgpqN1pLa-djnZtgSXqKJlbgGyttGnCEmPLD0zo,2347
153
+ rslearn/utils/jsonargparse.py,sha256=TRyZA151KzhjJlZczIHYguEA-YxCDYaZ2IwCRgx76nM,4791
154
+ rslearn/utils/mp.py,sha256=XYmVckI5TOQuCKc49NJyirDJyFgvb4AI-gGypG2j680,1399
155
+ rslearn/utils/raster_format.py,sha256=qZpbODF4I7BsOxf43O6vTmH2TSNw6N8PP0wsFUVvdIw,26267
156
+ rslearn/utils/rtree_index.py,sha256=j0Zwrq3pXuAJ-hKpiRFQ7VNtvO3fZYk-Em2uBPAqfx4,6460
157
+ rslearn/utils/spatial_index.py,sha256=eomJAUgzmjir8j9HZnSgQoJHwN9H0wGTjmJkMkLLfsU,762
158
+ rslearn/utils/sqlite_index.py,sha256=YGOJi66544e6JNtfSft6YIlHklFdSJO2duxQ4TJ2iu4,2920
159
+ rslearn/utils/time.py,sha256=2ilSLG94_sxLP3y5RSV5L5CG8CoND_dbdzYEHVtN-I8,387
160
+ rslearn/utils/vector_format.py,sha256=4ZDYpfBLLxguJkiIaavTagiQK2Sv4Rz9NumbHlq-3Lw,15041
161
+ rslearn-0.0.21.dist-info/licenses/LICENSE,sha256=_99ZWPoLdlUbqZoSC5DF4ihiNwl5rTEmBaq2fACecdg,11352
162
+ rslearn-0.0.21.dist-info/licenses/NOTICE,sha256=wLPr6rwV_jCg-xEknNGwhnkfRfuoOE9MZ-lru2yZyLI,5070
163
+ rslearn-0.0.21.dist-info/METADATA,sha256=SUDvVod3HgoDdLYjRz9dwOL0c6V0SF-dTYuzsA4JJYk,37853
164
+ rslearn-0.0.21.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
165
+ rslearn-0.0.21.dist-info/entry_points.txt,sha256=doTBQ57NT7nq-dgYGgTTw6mafcGWb_4PWYtYR4rGm50,46
166
+ rslearn-0.0.21.dist-info/top_level.txt,sha256=XDKo90WBH8P9RQumHxo0giLJsoufT4r9odv-WE6Ahk4,8
167
+ rslearn-0.0.21.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.2.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -0,0 +1,115 @@
1
+ rslearn is released under Apache License 2.0
2
+ Copyright 2025 Allen Institute for AI
3
+
4
+ The following third party code is included in this repository.
5
+
6
+ ====================
7
+
8
+ rslearn.models.detr is adapted from https://github.com/facebookresearch/detr which is
9
+ released under Apache License 2.0.
10
+
11
+ Copyright 2020 - present, Facebook, Inc
12
+
13
+ ====================
14
+
15
+ rslearn.models.use_croma is copied from https://github.com/antofuller/CROMA
16
+
17
+ MIT License
18
+
19
+ Copyright (c) 2023 Anthony Fuller
20
+
21
+ Permission is hereby granted, free of charge, to any person obtaining a copy
22
+ of this software and associated documentation files (the "Software"), to deal
23
+ in the Software without restriction, including without limitation the rights
24
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
+ copies of the Software, and to permit persons to whom the Software is
26
+ furnished to do so, subject to the following conditions:
27
+
28
+ The above copyright notice and this permission notice shall be included in all
29
+ copies or substantial portions of the Software.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ SOFTWARE.
38
+
39
+ ====================
40
+
41
+ rslearn.models.galileo is adapted from https://github.com/nasaharvest/galileo
42
+
43
+ MIT License
44
+
45
+ Copyright (c) 2024 Presto Authors
46
+
47
+ Permission is hereby granted, free of charge, to any person obtaining a copy
48
+ of this software and associated documentation files (the "Software"), to deal
49
+ in the Software without restriction, including without limitation the rights
50
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
51
+ copies of the Software, and to permit persons to whom the Software is
52
+ furnished to do so, subject to the following conditions:
53
+
54
+ The above copyright notice and this permission notice shall be included in all
55
+ copies or substantial portions of the Software.
56
+
57
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
59
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
60
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
61
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
62
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
63
+ SOFTWARE.
64
+
65
+ ====================
66
+
67
+ rslearn.models.presto is adapted from https://github.com/nasaharvest/presto
68
+
69
+ MIT License
70
+
71
+ Copyright (c) 2024 Presto Authors
72
+
73
+ Permission is hereby granted, free of charge, to any person obtaining a copy
74
+ of this software and associated documentation files (the "Software"), to deal
75
+ in the Software without restriction, including without limitation the rights
76
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
77
+ copies of the Software, and to permit persons to whom the Software is
78
+ furnished to do so, subject to the following conditions:
79
+
80
+ The above copyright notice and this permission notice shall be included in all
81
+ copies or substantial portions of the Software.
82
+
83
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
84
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
85
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
86
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
87
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
88
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
89
+ SOFTWARE.
90
+
91
+ ====================
92
+
93
+ rslearn.models.prithvi includes code adapted from https://github.com/NASA-IMPACT/Prithvi-WxC
94
+
95
+ MIT License
96
+
97
+ Copyright (c) 2024 Inter Agency Implementation and Advanced Concepts
98
+
99
+ Permission is hereby granted, free of charge, to any person obtaining a copy
100
+ of this software and associated documentation files (the "Software"), to deal
101
+ in the Software without restriction, including without limitation the rights
102
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
103
+ copies of the Software, and to permit persons to whom the Software is
104
+ furnished to do so, subject to the following conditions:
105
+
106
+ The above copyright notice and this permission notice shall be included in all
107
+ copies or substantial portions of the Software.
108
+
109
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
110
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
111
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
112
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
113
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
114
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
115
+ SOFTWARE.
@@ -1,309 +0,0 @@
1
- """Helper functions for raster data sources."""
2
-
3
- from collections.abc import Callable
4
- from datetime import datetime
5
- from typing import Any
6
-
7
- import affine
8
- import numpy as np
9
- import numpy.typing as npt
10
- import rasterio.enums
11
- import rasterio.io
12
- import rasterio.transform
13
- from rasterio.crs import CRS
14
-
15
- from rslearn.config import BandSetConfig, RasterFormatConfig, RasterLayerConfig
16
- from rslearn.const import TILE_SIZE
17
- from rslearn.dataset import Window
18
- from rslearn.tile_stores import LayerMetadata, TileStore
19
- from rslearn.utils import Projection, STGeometry
20
- from rslearn.utils.raster_format import load_raster_format
21
-
22
-
23
- class ArrayWithTransform:
24
- """Stores an array along with the transform associated with the array."""
25
-
26
- def __init__(
27
- self, array: npt.NDArray[Any], crs: CRS, transform: rasterio.transform.Affine
28
- ) -> None:
29
- """Create a new ArrayWithTransform instance.
30
-
31
- Args:
32
- array: the numpy array (C, H, W) storing the raster data.
33
- crs: the CRS of the array
34
- transform: the transform from pixel coordinates to projection coordinates.
35
- """
36
- self.array = array
37
- self.crs = crs
38
- self.transform = transform
39
-
40
- # Store additional data matching rasterio.io.DatasetReader so we can use them
41
- # interchangeably in ingest_raster.
42
- self.width = self.array.shape[2]
43
- self.height = self.array.shape[1]
44
-
45
- # Left/top in projection units.
46
- self.left = self.transform.c
47
- self.top = self.transform.f
48
-
49
- # Resolution in projection units per pixel.
50
- self.x_resolution = self.transform.a
51
- self.y_resolution = self.transform.e
52
-
53
- # Right/bottom and bounds in projection units.
54
- self.right = self.left + self.width * self.x_resolution
55
- self.bottom = self.top + self.height * self.y_resolution
56
- self.bounds = [
57
- min(self.left, self.right),
58
- min(self.top, self.bottom),
59
- max(self.left, self.right),
60
- max(self.top, self.bottom),
61
- ]
62
-
63
- def read(self) -> npt.NDArray[Any]:
64
- """Reads the array.
65
-
66
- This is to mimic the rasterio.DatasetReader API.
67
-
68
- Returns:
69
- the array
70
- """
71
- return self.array
72
-
73
- def close(self):
74
- """This is to mimic the rasterio.DatasetReader API.
75
-
76
- The close function is a no-op.
77
- """
78
- pass
79
-
80
- def pixel_bounds(self) -> tuple[int, int, int, int]:
81
- """Returns the bounds of the array in global pixel coordinates.
82
-
83
- The bounds is computed based on the stored transform.
84
-
85
- The returned coordinates are (left, top, right, bottom).
86
- """
87
- start = (int(self.left / self.x_resolution), int(self.top / self.y_resolution))
88
- end = (start[0] + self.array.shape[2], start[1] + self.array.shape[1])
89
- return (start[0], start[1], end[0], end[1])
90
-
91
- def get_tile(self, tile: tuple[int, int]) -> npt.NDArray[Any]:
92
- """Returns portion of image corresponding to a tile.
93
-
94
- Args:
95
- tile: the tile to retrieve
96
-
97
- Returns:
98
- The portion of the image corresponding to the requested tile.
99
- """
100
- bounds = self.pixel_bounds()
101
- x1 = tile[0] * TILE_SIZE - bounds[0]
102
- y1 = tile[1] * TILE_SIZE - bounds[1]
103
- x2 = x1 + TILE_SIZE
104
- y2 = y1 + TILE_SIZE
105
- # Need to pad output if x1/y1/x2/y2 are out of bounds.
106
- # The padding is (before_y, after_y, before_x, after_x)
107
- padding = [0, 0, 0, 0]
108
- if x1 < 0:
109
- padding[2] = -x1
110
- x1 = 0
111
- if y1 < 0:
112
- padding[0] = -y1
113
- y1 = 0
114
- if x2 > self.array.shape[2]:
115
- padding[3] = x2 - self.array.shape[2]
116
- x2 = self.array.shape[2]
117
- if y2 > self.array.shape[1]:
118
- padding[1] = y2 - self.array.shape[1]
119
- y2 = self.array.shape[1]
120
- tile = self.array[:, y1:y2, x1:x2]
121
- return np.pad(
122
- tile, ((0, 0), (padding[0], padding[1]), (padding[2], padding[3]))
123
- )
124
-
125
-
126
- def get_needed_projections(
127
- tile_store: TileStore,
128
- raster_bands: list[str],
129
- band_sets: list[BandSetConfig],
130
- geometries: list[STGeometry],
131
- ) -> list[Projection]:
132
- """Determines the projections of an item that are needed for a given raster file.
133
-
134
- Projections that appear in geometries are skipped if a corresponding layer is
135
- present in tile_store with metadata marked completed.
136
-
137
- Args:
138
- tile_store: TileStore prefixed with the item name and file name
139
- raster_bands: list of bands contained in the raster file
140
- band_sets: configured band sets
141
- geometries: list of geometries for which the item is needed
142
-
143
- Returns:
144
- list of Projection objects for which the item has not been ingested yet
145
- """
146
- # Identify which band set configs are relevant to this raster.
147
- raster_bands = set(raster_bands)
148
- relevant_band_sets = []
149
- for band_set in band_sets:
150
- is_match = False
151
- for band in band_set.bands:
152
- if band not in raster_bands:
153
- continue
154
- is_match = True
155
- break
156
- if not is_match:
157
- continue
158
- relevant_band_sets.append(band_set)
159
-
160
- all_projections = {geometry.projection for geometry in geometries}
161
- needed_projections = []
162
- for projection in all_projections:
163
- for band_set in relevant_band_sets:
164
- final_projection, _ = band_set.get_final_projection_and_bounds(
165
- projection, None
166
- )
167
- ts_layer = tile_store.get_layer((str(final_projection),))
168
- if ts_layer and ts_layer.get_metadata().properties.get("completed"):
169
- continue
170
- needed_projections.append(final_projection)
171
- return needed_projections
172
-
173
-
174
- def ingest_raster(
175
- tile_store: TileStore,
176
- raster: rasterio.io.DatasetReader | ArrayWithTransform,
177
- projection: Projection,
178
- time_range: tuple[datetime, datetime] | None = None,
179
- layer_config: RasterLayerConfig | None = None,
180
- array_callback: Callable[[npt.NDArray[Any]], npt.NDArray[Any]] | None = None,
181
- ) -> None:
182
- """Ingests an in-memory rasterio dataset into the tile store.
183
-
184
- Args:
185
- tile_store: the tile store to ingest into, prefixed with the item name and
186
- raster band names
187
- raster: the rasterio raster
188
- projection: the projection to save the raster as
189
- time_range: time range of the raster
190
- layer_config: the RasterLayerConfig of this layer
191
- array_callback: callback function to apply on the array read from the raster
192
- """
193
- # Get layer in tile store to save under.
194
- ts_layer = tile_store.create_layer(
195
- (str(projection),), LayerMetadata(projection, time_range, {})
196
- )
197
- if ts_layer.get_metadata().properties.get("completed"):
198
- return
199
-
200
- # Warp each raster to this projection if needed.
201
- array = raster.read()
202
- if array_callback:
203
- array = array_callback(array)
204
-
205
- needs_warping = True
206
- if isinstance(raster.transform, affine.Affine):
207
- raster_projection = Projection(
208
- raster.crs, raster.transform.a, raster.transform.e
209
- )
210
- needs_warping = raster_projection != projection
211
-
212
- if not needs_warping:
213
- # Include the top-left pixel index.
214
- warped_array = ArrayWithTransform(array, raster.crs, raster.transform)
215
-
216
- else:
217
- # Compute the suggested target transform.
218
- # rasterio negates the y resolution itself so here we have to negate it.
219
- (dst_transform, dst_width, dst_height) = (
220
- rasterio.warp.calculate_default_transform(
221
- # Source info.
222
- src_crs=raster.crs,
223
- width=raster.width,
224
- height=raster.height,
225
- left=raster.bounds[0],
226
- bottom=raster.bounds[1],
227
- right=raster.bounds[2],
228
- top=raster.bounds[3],
229
- # Destination info.
230
- dst_crs=projection.crs,
231
- resolution=(projection.x_resolution, -projection.y_resolution),
232
- )
233
- )
234
-
235
- resampling_method = rasterio.enums.Resampling.bilinear
236
- if layer_config:
237
- resampling_method = layer_config.resampling_method
238
-
239
- # Re-project the raster to the destination crs, resolution, and transform.
240
- dst_array = np.zeros((array.shape[0], dst_height, dst_width), dtype=array.dtype)
241
- rasterio.warp.reproject(
242
- source=array,
243
- src_crs=raster.crs,
244
- src_transform=raster.transform,
245
- destination=dst_array,
246
- dst_crs=projection.crs,
247
- dst_transform=dst_transform,
248
- resampling=resampling_method,
249
- )
250
- warped_array = ArrayWithTransform(dst_array, projection.crs, dst_transform)
251
-
252
- ts_layer.write_raster(warped_array.pixel_bounds(), warped_array.array)
253
- ts_layer.set_property("completed", True)
254
-
255
-
256
- def materialize_raster(
257
- raster: rasterio.io.DatasetReader | ArrayWithTransform,
258
- window: Window,
259
- layer_name: str,
260
- band_cfg: BandSetConfig,
261
- ):
262
- """Materialize a given raster for a window.
263
-
264
- Currently it is only supported for materializing one band set.
265
-
266
- Args:
267
- raster: the raster data
268
- window: the window to materialize
269
- layer_name: the layer
270
- band_cfg: the band configuration
271
- """
272
- window_projection, window_bounds = band_cfg.get_final_projection_and_bounds(
273
- window.projection, window.bounds
274
- )
275
-
276
- # Re-project to just extract the window.
277
- array = raster.read()
278
- window_width = window_bounds[2] - window_bounds[0]
279
- window_height = window_bounds[3] - window_bounds[1]
280
- dst_transform = rasterio.transform.Affine(
281
- window_projection.x_resolution,
282
- 0,
283
- window_bounds[0] * window_projection.x_resolution,
284
- 0,
285
- window_projection.y_resolution,
286
- window_bounds[1] * window_projection.y_resolution,
287
- )
288
- dst_array = np.zeros(
289
- (array.shape[0], window_height, window_width), dtype=array.dtype
290
- )
291
- rasterio.warp.reproject(
292
- source=array,
293
- src_crs=raster.crs,
294
- src_transform=raster.transform,
295
- destination=dst_array,
296
- dst_crs=window_projection.crs,
297
- dst_transform=dst_transform,
298
- resampling=rasterio.enums.Resampling.bilinear,
299
- )
300
-
301
- # Write the array to layer directory.
302
- layer_dir = window.path / "layers" / layer_name
303
- out_dir = layer_dir / "_".join(band_cfg.bands)
304
- out_dir.mkdir(parents=True, exist_ok=True)
305
- raster_format = load_raster_format(
306
- RasterFormatConfig(band_cfg.format["name"], band_cfg.format)
307
- )
308
- raster_format.encode_raster(out_dir, window_projection, window_bounds, dst_array)
309
- (layer_dir / "completed").touch()
@@ -1,5 +0,0 @@
1
- """Model registry."""
2
-
3
- from class_registry import ClassRegistry
4
-
5
- Models = ClassRegistry()