Skip to content

Commit

Permalink
small fix in EnFireMap ingest_data script
Browse files Browse the repository at this point in the history
  • Loading branch information
janzandr committed Mar 7, 2024
1 parent 5602daa commit ef7fe36
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions enmapboxprocessing/algorithm/translaterasteralgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,12 @@ def isBadBand(bandNo: int) -> bool:
spectralBandList = [i + 1 for i in range(spectralRaster.bandCount())]

wavelength = np.array([reader.wavelength(bandNo) for bandNo in bandList])
bandList = [int(np.argmin(np.abs(wavelength - spectralReader.wavelength(bandNo))) + 1)
for bandNo in spectralBandList]

bandList = list()
for targetBandNo in spectralBandList:
targetWavelength = spectralReader.wavelength(targetBandNo)
bandNo = int(np.argmin(np.abs(wavelength - targetWavelength)) + 1)
bandList.append(bandNo)

if bandList is None:
nBands = raster.bandCount()
Expand Down
2 changes: 2 additions & 0 deletions scripts/EnFireMAP/bad_wavelengths.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
1366.69
1378.6
1390.48
1461.1
1759.51
4 changes: 1 addition & 3 deletions scripts/EnFireMAP/ingest_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from enmapboxprocessing.rasterreader import RasterReader
from enmapboxprocessing.rasterwriter import RasterWriter
from enmapboxprocessing.utils import Utils

from qgis.core import QgsPointXY, QgsCoordinateReferenceSystem, QgsCoordinateTransform, \
QgsProject, QgsVectorLayer, QgsGeometry, Qgis, QgsRectangle

Expand Down Expand Up @@ -60,7 +59,7 @@ def prepareSpectralImages():
alg = ImportEnmapL2AAlgorithm()
parameters = {
alg.P_FILE: xmlFilename,
alg.P_SET_BAD_BANDS: True,
alg.P_SET_BAD_BANDS: False,
alg.P_EXCLUDE_BAD_BANDS: False,
alg.P_DETECTOR_OVERLAP: alg.OrderByWavelengthOverlapOption,
alg.P_OUTPUT_RASTER: xmlFilename.replace('METADATA.XML', 'SPECTRAL_IMAGE_FULL.vrt'),
Expand Down Expand Up @@ -220,4 +219,3 @@ def auxDeriveSceneBoundingPolygon(xmlFilename) -> QgsGeometry:
prepareSpectralImages()
copyMetadataXml()
ingestData()
print('done')
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import numpy as np
from osgeo import gdal

from enmapboxtestdata import enmap, hires
from enmapboxprocessing.algorithm.testcase import TestCase
from enmapboxprocessing.algorithm.translaterasteralgorithm import TranslateRasterAlgorithm
from enmapboxprocessing.rasterreader import RasterReader
from enmapboxprocessing.utils import Utils
from enmapboxtestdata import enmap, hires
from enmapboxtestdata import water_mask_30m, enmap_grid_300m
from qgis.core import QgsRectangle, QgsCoordinateReferenceSystem, QgsRasterLayer, QgsRasterRenderer, Qgis

Expand Down

0 comments on commit ef7fe36

Please sign in to comment.