Commit 643398f3 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Added version of gms_preprocessing to written header files and job log (fixes feature request #67).

parent 3c3f424c
......@@ -269,7 +269,7 @@ class L1A_object(GMS_object):
del ds
def import_metadata(self, v=False):
def import_metadata(self):
"""Reads metainformation of the given file from the given ASCII metafile.
Works for: RapidEye (metadata.xml),SPOT(metadata.dim),LANDSAT(mtl.txt),ASTER(downloaded coremetadata),
ALOS(summary.txt & Leader file)
......@@ -283,9 +283,8 @@ class L1A_object(GMS_object):
self.MetaObj.read_meta(self.scene_ID, self.path_InFilePreprocessor,
self.path_MetaPreprocessor, self.LayerBandsAssignment)
if v:
self.logger.info("The following metadata have been read:")
[self.logger.info("%20s : %-4s" % (key, val)) for key, val in self.MetaObj.overview.items()]
self.logger.debug("The following metadata have been read:")
[self.logger.debug("%20s : %-4s" % (key, val)) for key, val in self.MetaObj.overview.items()]
# set some object attributes directly linked to metadata
self.subsystem = self.MetaObj.Subsystem
......
......@@ -43,14 +43,15 @@ if TYPE_CHECKING:
enviHdr_keyOrder = \
['ENVI', 'description', 'samples', 'lines', 'bands', 'header offset', 'file type', 'data type',
'interleave', 'data ignore value', 'sensor type', 'byte order', 'file compression', 'reflectance scale factor',
'class lookup', 'classes', 'class names', 'map info', 'coordinate system string', 'CS_TYPE', 'CS_EPSG', 'CS_DATUM',
'CS_UTM_ZONE', 'corner coordinates lonlat', 'image_type', 'Satellite', 'Sensor', 'Subsystem', 'SceneID',
'EntityID', 'arr_pos', 'arr_shape', 'Metafile', 'gResolution', 'AcqDate', 'AcqTime', 'wavelength', 'bandwidths',
'band names', 'LayerBandsAssignment', 'data gain values', 'data offset values', 'reflectance gain values',
'reflectance offset values', 'ThermalConstK1', 'ThermalConstK2', 'ProcLCode', 'PhysUnit', 'ScaleFactor',
'wavelength units', 'SunElevation', 'SunAzimuth', 'SolIrradiance', 'EarthSunDist', 'ViewingAngle',
'IncidenceAngle', 'FieldOfView', 'scene length', 'overpass duraction sec', 'Quality', 'Additional']
'interleave', 'data ignore value', 'sensor type', 'byte order', 'file compression', 'version_gms_preprocessing',
'versionalias_gms_preprocessing', 'reflectance scale factor', 'class lookup', 'classes', 'class names', 'map info',
'coordinate system string', 'CS_TYPE', 'CS_EPSG', 'CS_DATUM', 'CS_UTM_ZONE', 'corner coordinates lonlat',
'image_type', 'Satellite', 'Sensor', 'Subsystem', 'SceneID', 'EntityID', 'arr_pos', 'arr_shape', 'Metafile',
'gResolution', 'AcqDate', 'AcqTime', 'wavelength', 'bandwidths', 'band names', 'LayerBandsAssignment',
'data gain values', 'data offset values', 'reflectance gain values', 'reflectance offset values', 'ThermalConstK1',
'ThermalConstK2', 'ProcLCode', 'PhysUnit', 'ScaleFactor', 'wavelength units', 'SunElevation', 'SunAzimuth',
'SolIrradiance', 'EarthSunDist', 'ViewingAngle', 'IncidenceAngle', 'FieldOfView', 'scene length',
'overpass duraction sec', 'Quality', 'Additional']
def silent_envi_write_image(hdr_file, data, header, **kwargs):
......
......@@ -117,6 +117,9 @@ class METADATA(object):
self.wvlUnit = ""
self.spec_vals = {'fill': None, 'zero': None, 'saturated': None}
self.version_gms_preprocessing = CFG.version
self.versionalias_gms_preprocessing = CFG.versionalias
def read_meta(self, scene_ID, stacked_image, data_folderOrArchive, LayerBandsAssignment=None):
"""
Read metadata.
......@@ -1808,6 +1811,8 @@ map_odictKeys_objAttrnames = {
'samples': 'cols',
'lines': 'rows',
'bands': 'bands',
'version_gms_preprocessing': 'version_gms_preprocessing',
'versionalias_gms_preprocessing': 'versionalias_gms_preprocessing',
'CS_EPSG': 'CS_EPSG',
'CS_TYPE': 'CS_TYPE',
'CS_DATUM': 'CS_DATUM',
......
......@@ -24,6 +24,7 @@ from pprint import pformat
from typing import TYPE_CHECKING
from .options_schema import gms_schema_input, gms_schema_config_output
from ..version import __version__, __versionalias__
if TYPE_CHECKING:
from gms_preprocessing.misc.database_tools import GMS_JOB # noqa F401 # flake8 issue
......@@ -179,6 +180,8 @@ class JobConfig(object):
self.end_time = None
self.computation_time = None
self.hostname = socket.gethostname()
self.version = __version__
self.versionalias = __versionalias__
#######################
# POPULATE PARAMETERS #
......
......@@ -27,7 +27,7 @@ def L1A_map(dataset_dict): # map (scene-wise parallelization)
L1A_obj = L1A_P.L1A_object(**dataset_dict)
L1A_obj.import_rasterdata()
L1A_obj.import_metadata(v=False)
L1A_obj.import_metadata()
L1A_obj.validate_GeoTransProj_GeoAlign() # sets self.GeoTransProj_ok and self.GeoAlign_ok
L1A_obj.apply_nodata_mask_to_ObjAttr('arr') # nodata mask is automatically calculated
L1A_obj.add_rasterInfo_to_MetaObj()
......@@ -53,7 +53,7 @@ def L1A_map_1(dataset_dict, block_size=None): # map (scene-wise parallelization
L1A_obj = L1A_P.L1A_object(**dataset_dict)
L1A_obj.import_rasterdata()
L1A_obj.import_metadata(v=False)
L1A_obj.import_metadata()
L1A_obj.validate_GeoTransProj_GeoAlign() # sets self.GeoTransProj_ok and self.GeoAlign_ok
L1A_obj.apply_nodata_mask_to_ObjAttr('arr') # nodata mask is automatically calculated
L1A_obj.add_rasterInfo_to_MetaObj()
......
......@@ -28,6 +28,7 @@ from ..options.config import set_config
from .multiproc import MAP, imap_unordered
from ..misc.definition_dicts import proc_chain, db_jobs_statistics_def
from ..misc.locks import release_unclosed_locks
from ..version import __version__, __versionalias__
from py_tools_ds.numeric.array import get_array_tilebounds
......@@ -84,6 +85,7 @@ class process_controller(object):
if os.path.exists(path_job_logfile):
HLP_F.silentremove(path_job_logfile)
self.logger.info("Executing gms_preprocessing, version: %s (%s)" % (__version__, __versionalias__))
self.logger.info('Process Controller initialized for job ID %s (comment: %s).'
% (self.config.ID, self.DB_job_record.comment))
......@@ -432,6 +434,7 @@ class process_controller(object):
self.logger.info('Execution of entire GeoMultiSens pre-processing chain started for job ID %s...'
% self.config.ID)
self.DB_job_record.reset_job_progress() # updates attributes of DB_job_record and related DB entry
self.config.status = 'running'
GMS_object.proc_status_all_GMSobjs.clear() # reset
......
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