Commit 792d30ec authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Adapted the changes of the current geoarray branch 'feature/improve_metadata_handling'.

parent 63200c23
Pipeline #3073 failed with stage
in 17 minutes and 47 seconds
......@@ -876,10 +876,10 @@ class ReferenceCube_Generator(object):
for tgt_sat, tgt_sen in self.tgt_sat_sen_list:
# perform spectral resampling
self.logger.info('Performing spectral resampling to match %s %s specifications...' % (tgt_sat, tgt_sen))
unif_random_spectra_rsp = \
self.resample_spectra(unif_random_spectra,
src_cwl=np.array(src_im.meta.loc['wavelength'], dtype=np.float).flatten(),
tgt_srf=self._get_tgt_SRF_object(tgt_sat, tgt_sen))
unif_random_spectra_rsp = self.resample_spectra(
unif_random_spectra,
src_cwl=np.array(src_im.meta.band_meta['wavelength'], dtype=np.float).flatten(),
tgt_srf=self._get_tgt_SRF_object(tgt_sat, tgt_sen))
# add the spectra as GeoArray instance to the in-mem ref cubes
refcube = self.refcubes[(tgt_sat, tgt_sen)] # type: RefCube
......@@ -979,7 +979,7 @@ class ReferenceCube_Generator(object):
# read input image
self.logger.info('Reading the input image %s...' % im_name)
im_gA.cwl = np.array(im_gA.meta.loc['wavelength'], dtype=np.float).flatten()
im_gA.cwl = np.array(im_gA.meta.band_meta['wavelength'], dtype=np.float).flatten()
# perform spectral resampling of input image to match spectral properties of target sensor
self.logger.info('Performing spectral resampling to match spectral properties of %s %s...'
......@@ -1030,8 +1030,7 @@ class RefCube(object):
self.data.bandnames = ['Band %s' % b for b in self.LayerBandsAssignment]
# set wavelengths
self.data.metadata.loc['wavelength'] = self.wavelengths
# TODO: NOTE: wavelengths are not written to ENVI header because currently GeoArray does not support that
self.data.metadata.band_meta['wavelength'] = self.wavelengths
@property
def n_images(self):
......
......@@ -2032,7 +2032,7 @@ def get_bands_after_AC(GMS_id):
def get_center_wavelengths_by_LBA(satellite, sensor, LBA, subsystem=None):
# type: (str, str, list) -> list
# type: (str, str, list) -> List[float]
"""Returns a list of center wavelengths of spectral bands for the given satellite/sensor/LayerBandsAss. combination.
:param satellite: target satellite (e.g., 'Sentinel-2A')
......
py_tools_ds>=0.12.4
geoarray>=0.7.13
arosics>=0.6.6
geoarray>=0.8.0
arosics>=0.8.5
git+https://gitext.gfz-potsdam.de/EnMAP/sicor.git
matplotlib
numpy
......
......@@ -18,7 +18,7 @@ with open("gms_preprocessing/version.py") as version_file:
requirements = [
'matplotlib', 'numpy', 'scikit-learn', 'scipy', 'gdal', 'pyproj', 'shapely', 'ephem', 'pyorbital', 'dill', 'pytz',
'pandas', 'numba', 'spectral>=0.16', 'geopandas', 'iso8601', 'pyinstrument', 'geoalchemy2', 'sqlalchemy',
'psycopg2', 'py_tools_ds>=0.12.4', 'geoarray>=0.7.13', 'arosics>=0.6.6', 'six', 'tqdm', 'jsmin', 'cerberus',
'psycopg2', 'py_tools_ds>=0.12.4', 'geoarray>=0.8.0', 'arosics>=0.8.5', 'six', 'tqdm', 'jsmin', 'cerberus',
'nested_dict', 'openpyxl', 'timeout_decorator', 'redis', 'retools', 'redis-semaphore', 'psutil', 'pysptools'
# spectral<0.16 has some problems with writing signed integer 8bit data
# fmask # conda install -c conda-forge python-fmask
......
......@@ -80,8 +80,8 @@ dependencies:
- psutil
- pysptools
- py_tools_ds>=0.12.4
- geoarray>=0.7.13
- arosics>=0.6.6
- geoarray>=0.8.0
- arosics>=0.8.5
# sicor
- https://software.ecmwf.int/wiki/download/attachments/56664858/ecmwf-api-client-python.tgz
......@@ -79,7 +79,7 @@ class Test_ReferenceCube_Generator(unittest.TestCase):
dataset_ID=-9999, proc_level='L1A', logger=None))
unif_random_spectra_rsp = \
self.SHC.resample_spectra(unif_random_spectra,
src_cwl=np.array(src_im.meta.loc['wavelength'], dtype=np.float).flatten(),
src_cwl=np.array(src_im.meta.band_meta['wavelength'], dtype=np.float).flatten(),
tgt_srf=tgt_srf)
self.assertIsInstance(unif_random_spectra_rsp, np.ndarray)
self.assertEqual(unif_random_spectra_rsp.shape, (self.tgt_n_samples, len(tgt_srf.bands)))
......
......@@ -42,7 +42,7 @@ class Test_SpectralResampler(unittest.TestCase):
def test_resample_signature(self):
# Get a hyperspectral spectrum.
spectrum_wvl = np.array(self.geoArr.meta.loc['wavelength'], dtype=np.float).flatten()
spectrum_wvl = np.array(self.geoArr.meta.band_meta['wavelength'], dtype=np.float).flatten()
spectrum = self.geoArr[0, 0, :].flatten()
sr = SR(spectrum_wvl, self.srf_l8)
......@@ -51,7 +51,7 @@ class Test_SpectralResampler(unittest.TestCase):
def test_resample_image(self):
# Get a hyperspectral spectrum.
image_wvl = np.array(self.geoArr.meta.loc['wavelength'], dtype=np.float).flatten()
image_wvl = np.array(self.geoArr.meta.band_meta['wavelength'], dtype=np.float).flatten()
image = self.geoArr[:]
sr = SR(image_wvl, self.srf_l8)
......
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