Skip to content

Commit

Permalink
hotfix dn2toa
Browse files Browse the repository at this point in the history
  • Loading branch information
fwfichtner committed Sep 19, 2022
1 parent b8c8df1 commit f9c2ae5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 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.3] (2022-09-19)
---------------------
Fixed
^^^^^
- Fixed bug in bandorder dn2toa

[1.4.2] (2022-09-19)
---------------------
Changed
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.2"
__version__ = "1.4.3"
8 changes: 4 additions & 4 deletions ukis_pysat/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,14 @@ def dn2toa(self, platform, mtl_file=None, mtd_file=None, wavelengths=None):

if pb_baseline >= 4.0:
radio_offsets = product_image_characteristics["Radiometric_Offset_List"]["RADIO_ADD_OFFSET"]
for b in self._lookup_bands(platform=Platform.Sentinel2, wavelengths=wavelengths):
for idx, b in enumerate(self._lookup_bands(platform=Platform.Sentinel2, wavelengths=wavelengths)):
radio_offset = float([i for i in radio_offsets if i["@band_id"] == b][0]["#text"])

# rescale reflectance bands
toa.append((self.__arr[int(b), :, :].astype(np.float32) + radio_offset) / quantification_value)
toa.append((self.__arr[idx, :, :].astype(np.float32) + radio_offset) / quantification_value)
else:
for b in self._lookup_bands(platform=Platform.Sentinel2, wavelengths=wavelengths):
toa.append(self.__arr[int(b), :, :].astype(np.float32) / quantification_value)
for idx, _ in enumerate(self._lookup_bands(platform=Platform.Sentinel2, wavelengths=wavelengths)):
toa.append(self.__arr[idx, :, :].astype(np.float32) / quantification_value)

self.__arr = np.array(np.stack(toa, axis=0))
else:
Expand Down

0 comments on commit f9c2ae5

Please sign in to comment.