Commit 25fda97e authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixed incorrect gains in L2A output data. Band statistics in L2A metadata now...


Fixed incorrect gains in L2A output data. Band statistics in L2A metadata now exclude the image background.
Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 8e02698b
Pipeline #24753 passed with stages
in 13 minutes and 58 seconds
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
History History
======= =======
0.18.5 (2021-06-21)
-------------------
* Fixed incorrect gains in L2A output data.
* Band statistics in L2A metadata now exclude the image background.
0.18.4 (2021-06-21) 0.18.4 (2021-06-21)
------------------- -------------------
......
...@@ -126,7 +126,7 @@ class EnMAP_Metadata_L2A_MapGeo(object): ...@@ -126,7 +126,7 @@ class EnMAP_Metadata_L2A_MapGeo(object):
self.wvl_center = np.array(wvls_l2a) self.wvl_center = np.array(wvls_l2a)
self.fwhm = np.hstack([meta_l1b.vnir.fwhm, meta_l1b.swir.fwhm])[bandidx_order] self.fwhm = np.hstack([meta_l1b.vnir.fwhm, meta_l1b.swir.fwhm])[bandidx_order]
self.gains = np.full((dims_mapgeo[2],), 100) # implies reflectance scaled between 0 and 10000 self.gains = np.full((dims_mapgeo[2],), 1. / self.cfg.scale_factor_boa_ref) # => value range 0-1
self.offsets = np.zeros((dims_mapgeo[2],)) self.offsets = np.zeros((dims_mapgeo[2],))
self.srf = SRF.from_cwl_fwhm(self.wvl_center, self.fwhm) self.srf = SRF.from_cwl_fwhm(self.wvl_center, self.fwhm)
self.solar_irrad = np.hstack([meta_l1b.vnir.solar_irrad, meta_l1b.swir.solar_irrad])[bandidx_order] self.solar_irrad = np.hstack([meta_l1b.vnir.solar_irrad, meta_l1b.swir.solar_irrad])[bandidx_order]
...@@ -192,9 +192,10 @@ class EnMAP_Metadata_L2A_MapGeo(object): ...@@ -192,9 +192,10 @@ class EnMAP_Metadata_L2A_MapGeo(object):
def add_band_statistics(self, datastack_vnir_swir: Union[np.ndarray, GeoArray]): def add_band_statistics(self, datastack_vnir_swir: Union[np.ndarray, GeoArray]):
R, C, B = datastack_vnir_swir.shape R, C, B = datastack_vnir_swir.shape
# NOTE: DEVIDE by gains to get reflectance in percent # NOTE: Multiply by gains to get reflectance in the range 0-1
self.band_means = np.mean(datastack_vnir_swir.reshape((R * C, B)), axis=0) / self.gains data = datastack_vnir_swir[datastack_vnir_swir.mask_nodata[:]]
self.band_stds = np.std(datastack_vnir_swir.reshape((R * C, B)), axis=0) / self.gains self.band_means = np.mean(data, axis=0) * self.gains
self.band_stds = np.std(data, axis=0) * self.gains
def add_product_fileinformation(self, filepaths: List[str], sizes: List[int] = None, versions: List[str] = None): def add_product_fileinformation(self, filepaths: List[str], sizes: List[int] = None, versions: List[str] = None):
self.fileinfos = [] self.fileinfos = []
......
...@@ -27,6 +27,6 @@ ...@@ -27,6 +27,6 @@
# You should have received a copy of the GNU Lesser General Public License along # You should have received a copy of the GNU Lesser General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>. # with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '0.18.4' __version__ = '0.18.5'
__versionalias__ = '20210621.01' __versionalias__ = '20210621.02'
__author__ = 'Daniel Scheffler' __author__ = 'Daniel Scheffler'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment