-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: alpha support for major-tom-core
- Loading branch information
Showing
38 changed files
with
447 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,6 +105,48 @@ def eurosat_ms_root() -> Path: | |
return p | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def major_tom_core_s1_root() -> Path: | ||
str_p = ( | ||
os.environ.get("RICO_HDL_MAJOR_TOM_CORE_S1_PATH") | ||
or "./tiffs/Major-TOM-Core/S1RTC/" | ||
) | ||
p = Path(str_p) | ||
assert p.exists() | ||
assert p.is_dir() | ||
return p | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def major_tom_core_s2_root() -> Path: | ||
str_p = ( | ||
os.environ.get("RICO_HDL_MAJOR_TOM_CORE_S2_PATH") | ||
or "./tiffs/Major-TOM-Core/S2L2A/" | ||
) | ||
p = Path(str_p) | ||
assert p.exists() | ||
assert p.is_dir() | ||
return p | ||
|
||
|
||
@pytest.fixture | ||
def encoded_major_tom_core_path( | ||
major_tom_core_s1_root, major_tom_core_s2_root, tmpdir_factory | ||
) -> Path: | ||
tmp_path = tmpdir_factory.mktemp("lmdb") | ||
subprocess.run( | ||
[ | ||
"rico-hdl", | ||
"major-tom-core", | ||
f"--s1-dir={major_tom_core_s1_root}", | ||
f"--s2-dir={major_tom_core_s2_root}", | ||
f"--target-dir={tmp_path}", | ||
], | ||
check=True, | ||
) | ||
return Path(tmp_path) | ||
|
||
|
||
# https://docs.pytest.org/en/6.2.x/tmpdir.html#[email protected](scope="session") | ||
@pytest.fixture | ||
def encoded_bigearthnet_s1_s2_path( | ||
|
@@ -306,6 +348,78 @@ def test_bigearthnet_integration( | |
) | ||
|
||
|
||
def test_major_tom_core_integration( | ||
major_tom_core_s1_root, major_tom_core_s2_root, encoded_major_tom_core_path | ||
): | ||
env = lmdb.open(str(encoded_major_tom_core_path), readonly=True) | ||
|
||
with env.begin(write=False) as txn: | ||
cur = txn.cursor() | ||
decoded_lmdb_data = {k.decode("utf-8"): load(v) for (k, v) in cur} | ||
|
||
assert decoded_lmdb_data.keys() == set( | ||
[ | ||
"0U_199R_S1A_IW_GRDH_1SDV_20220703T043413_20220703T043438_043931_053E87_rtc", | ||
"897U_171R_S1B_IW_GRDH_1SDV_20210827T012624_20210827T012653_028425_036437_rtc", | ||
"0U_199R_S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419", | ||
"199U_1099R_S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543", | ||
] | ||
) | ||
|
||
sample_s1_safetensors_dict = decoded_lmdb_data.get( | ||
"0U_199R_S1A_IW_GRDH_1SDV_20220703T043413_20220703T043438_043931_053E87_rtc", | ||
) | ||
sample_s2_safetensors_dict = decoded_lmdb_data.get( | ||
"0U_199R_S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419" | ||
) | ||
safetensors_s1_keys = sample_s1_safetensors_dict.keys() | ||
safetensors_s2_keys = sample_s2_safetensors_dict.keys() | ||
assert ( | ||
set( | ||
[ | ||
"B01", | ||
"B02", | ||
"B03", | ||
"B04", | ||
"B05", | ||
"B06", | ||
"B07", | ||
"B08", | ||
"B8A", | ||
"B09", | ||
"B11", | ||
"B12", | ||
] | ||
) | ||
== safetensors_s2_keys | ||
) | ||
assert ( | ||
set( | ||
[ | ||
"vv", | ||
"vh", | ||
] | ||
) | ||
== safetensors_s1_keys | ||
) | ||
|
||
assert all(arr.shape == (1068, 1068) for arr in sample_s1_safetensors_dict.values()) | ||
assert all(arr.dtype == "float32" for arr in sample_s1_safetensors_dict.values()) | ||
|
||
assert all(arr.dtype == "uint16" for arr in sample_s2_safetensors_dict.values()) | ||
assert all( | ||
sample_s2_safetensors_dict[key].shape == (1068, 1068) | ||
for key in ["B02", "B03", "B04", "B08"] | ||
) | ||
assert all( | ||
sample_s2_safetensors_dict[key].shape == (534, 534) | ||
for key in ["B05", "B06", "B07", "B8A", "B11", "B12"] | ||
) | ||
assert all( | ||
sample_s2_safetensors_dict[key].shape == (178, 178) for key in ["B01", "B09"] | ||
) | ||
|
||
|
||
def test_ssl4eo_s12_integration( | ||
ssl4eo_s12_s1_root, | ||
ssl4eo_s12_s2_l1c_root, | ||
|
Binary file added
BIN
+446 KB
...1A_IW_GRDH_1SDV_20220703T043413_20220703T043438_043931_053E87_rtc/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.88 MB
...1RTC/0U/0U_199R/S1A_IW_GRDH_1SDV_20220703T043413_20220703T043438_043931_053E87_rtc/vh.tif
Binary file not shown.
Binary file added
BIN
+4.89 MB
...1RTC/0U/0U_199R/S1A_IW_GRDH_1SDV_20220703T043413_20220703T043438_043931_053E87_rtc/vv.tif
Binary file not shown.
Binary file added
BIN
+444 KB
...1B_IW_GRDH_1SDV_20210827T012624_20210827T012653_028425_036437_rtc/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.95 MB
.../897U/897U_171R/S1B_IW_GRDH_1SDV_20210827T012624_20210827T012653_028425_036437_rtc/vh.tif
Binary file not shown.
Binary file added
BIN
+4.96 MB
.../897U/897U_171R/S1B_IW_GRDH_1SDV_20210827T012624_20210827T012653_028425_036437_rtc/vv.tif
Binary file not shown.
Binary file added
BIN
+68.1 KB
...ore/S2L2A/0U/0U_199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/B01.tif
Binary file not shown.
Binary file added
BIN
+1.8 MB
...ore/S2L2A/0U/0U_199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/B02.tif
Binary file not shown.
Binary file added
BIN
+1.77 MB
...ore/S2L2A/0U/0U_199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/B03.tif
Binary file not shown.
Binary file added
BIN
+1.78 MB
...ore/S2L2A/0U/0U_199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/B04.tif
Binary file not shown.
Binary file added
BIN
+535 KB
...ore/S2L2A/0U/0U_199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/B05.tif
Binary file not shown.
Binary file added
BIN
+514 KB
...ore/S2L2A/0U/0U_199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/B06.tif
Binary file not shown.
Binary file added
BIN
+510 KB
...ore/S2L2A/0U/0U_199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/B07.tif
Binary file not shown.
Binary file added
BIN
+1.66 MB
...ore/S2L2A/0U/0U_199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/B08.tif
Binary file not shown.
Binary file added
BIN
+79.3 KB
...ore/S2L2A/0U/0U_199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/B09.tif
Binary file not shown.
Binary file added
BIN
+504 KB
...ore/S2L2A/0U/0U_199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/B11.tif
Binary file not shown.
Binary file added
BIN
+509 KB
...ore/S2L2A/0U/0U_199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/B12.tif
Binary file not shown.
Binary file added
BIN
+506 KB
...ore/S2L2A/0U/0U_199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/B8A.tif
Binary file not shown.
Binary file added
BIN
+7.7 KB
...2A/0U/0U_199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/cloud_mask.tif
Binary file not shown.
Binary file added
BIN
+183 KB
...199R/S2A_MSIL2A_20220706T085611_N0400_R007_T33NZA_20220706T153419/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+57.2 KB
...2L2A/199U/199U_1099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/B01.tif
Binary file not shown.
Binary file added
BIN
+1.85 MB
...2L2A/199U/199U_1099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/B02.tif
Binary file not shown.
Binary file added
BIN
+1.89 MB
...2L2A/199U/199U_1099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/B03.tif
Binary file not shown.
Binary file added
BIN
+2.04 MB
...2L2A/199U/199U_1099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/B04.tif
Binary file not shown.
Binary file added
BIN
+562 KB
...2L2A/199U/199U_1099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/B05.tif
Binary file not shown.
Binary file added
BIN
+618 KB
...2L2A/199U/199U_1099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/B06.tif
Binary file not shown.
Binary file added
BIN
+635 KB
...2L2A/199U/199U_1099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/B07.tif
Binary file not shown.
Binary file added
BIN
+2.1 MB
...2L2A/199U/199U_1099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/B08.tif
Binary file not shown.
Binary file added
BIN
+76.2 KB
...2L2A/199U/199U_1099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/B09.tif
Binary file not shown.
Binary file added
BIN
+657 KB
...2L2A/199U/199U_1099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/B11.tif
Binary file not shown.
Binary file added
BIN
+642 KB
...2L2A/199U/199U_1099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/B12.tif
Binary file not shown.
Binary file added
BIN
+637 KB
...2L2A/199U/199U_1099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/B8A.tif
Binary file not shown.
Binary file added
BIN
+7.7 KB
...9U/199U_1099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/cloud_mask.tif
Binary file not shown.
Binary file added
BIN
+276 KB
...099R/S2B_MSIL2A_20200223T032739_N9999_R018_T48QUE_20230924T183543/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.