Skip to content

Commit

Permalink
Change schema Sentinel-2 (#168)
Browse files Browse the repository at this point in the history
* change schema

* bump version
  • Loading branch information
fwfichtner authored Sep 19, 2022
1 parent 8a8be0f commit b8c8df1
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

[1.4.2] (2022-09-19)
---------------------
Changed
^^^^^^^
- Adapt band schema of Sentinel-2 #168

[1.4.1] (2022-09-19)
---------------------
Changed
Expand Down
34 changes: 31 additions & 3 deletions tests/test_raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,42 @@ def test_dn2toa(self):
"dn_file": target_dir.joinpath("S2B_MSIL1C_20200406T101559_N0209_R065_T32UPC_20200406T130159.tif"),
"toa_file": target_dir.joinpath("S2B_MSIL1C_20200406T101559_N0209_R065_T32UPC_20200406T130159_toa.tif"),
"mtd_file": target_dir.joinpath("S2B_MSIL1C_20200406T101559_N0209_R065_T32UPC_20200406T130159_MTD.xml"),
"wavelengths": ["B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B8A", "B9", "B10", "B11", "B12"],
"wavelengths": [
"Aerosol",
"Blue",
"Green",
"Red",
"Rededge1",
"Rededge2",
"Rededge3",
"NIR",
"Rededge4",
"Watervapor",
"Cirrus",
"Swir1",
"Swir2",
],
},
{ # post product upgrades, see https://github.com/dlr-eoc/ukis-pysat/issues/165
"platform": Platform.Sentinel2,
"dn_file": target_dir.joinpath("S2B_MSIL1C_20220615T101559_N0400_R065_T32UPC_20220615T122549.tif"),
"toa_file": target_dir.joinpath("S2B_MSIL1C_20220615T101559_N0400_R065_T32UPC_20220615T122549_toa.tif"),
"mtd_file": target_dir.joinpath("S2B_MSIL1C_20220615T101559_N0400_R065_T32UPC_20220615T122549_MTD.xml"),
"wavelengths": ["B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B8A", "B9", "B10", "B11", "B12"],
"wavelengths": [
"Aerosol",
"Blue",
"Green",
"Red",
"Rededge1",
"Rededge2",
"Rededge3",
"NIR",
"Rededge4",
"Watervapor",
"Cirrus",
"Swir1",
"Swir2",
],
},
]

Expand Down Expand Up @@ -329,7 +357,7 @@ def test__lookup_bands(self):
["8", "10", "11"],
self.img._lookup_bands(Platform.Landsat8, ["PAN", "Tirs1", "Tirs2"]),
)
self.assertEqual(["1", "2", "3"], self.img._lookup_bands(Platform.Sentinel2, ["B2", "B3", "B4"]))
self.assertEqual(["1", "2", "3"], self.img._lookup_bands(Platform.Sentinel2, ["Blue", "Green", "Red"]))

def test_get_tiles(self):
for idx, each in enumerate(self.img.get_tiles(5, 5, 1)):
Expand Down
2 changes: 1 addition & 1 deletion ukis_pysat/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.4.1"
__version__ = "1.4.2"
26 changes: 13 additions & 13 deletions ukis_pysat/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,19 +407,19 @@ def _lookup_bands(platform, wavelengths):
"tirs2": "11",
},
Platform.Sentinel2: {
"b1": "0",
"b2": "1",
"b3": "2",
"b4": "3",
"b5": "4",
"b6": "5",
"b7": "6",
"b8": "7",
"b8a": "8",
"b9": "9",
"b10": "10",
"b11": "11",
"b12": "12",
"aerosol": "0",
"blue": "1",
"green": "2",
"red": "3",
"rededge1": "4",
"rededge2": "5",
"rededge3": "6",
"nir": "7",
"rededge4": "8",
"watervapor": "9",
"cirrus": "10",
"swir1": "11",
"swir2": "12",
},
}

Expand Down

0 comments on commit b8c8df1

Please sign in to comment.