From 9d7908beaf12d54cc853d1e7a41bb7ef4874585c Mon Sep 17 00:00:00 2001 From: Microwave Remote Sensing Laboratory <50493465+MIRSL@users.noreply.github.com> Date: Thu, 26 Sep 2019 15:25:09 -0400 Subject: [PATCH] Add files via upload updated for radiometric terrain correction control looks by providing 'posting' in xml --- components/isceobj/RtcProc/Factories.py | 1 + components/isceobj/RtcProc/RtcProc.py | 2 +- components/isceobj/RtcProc/runNormalize.py | 30 +++++++++++++--------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/components/isceobj/RtcProc/Factories.py b/components/isceobj/RtcProc/Factories.py index c779864..038f1f7 100644 --- a/components/isceobj/RtcProc/Factories.py +++ b/components/isceobj/RtcProc/Factories.py @@ -46,5 +46,6 @@ createPreprocessor = _factory("runPreprocessor") createVerifyDEM = _factory("runVerifyDEM") createLooks = _factory("runLooks") createTopo = _factory("runTopo") +createNormalize = _factory("runNormalize") #createGeocode = _factory("runGeocode") diff --git a/components/isceobj/RtcProc/RtcProc.py b/components/isceobj/RtcProc/RtcProc.py index f529106..aac8b9a 100644 --- a/components/isceobj/RtcProc/RtcProc.py +++ b/components/isceobj/RtcProc/RtcProc.py @@ -69,7 +69,7 @@ INC_FILENAME = Component.Parameter( GAMMA0_FILENAME = Component.Parameter( 'gamma0FileName', public_name='Gamma0 backscatter file', - default = 'gamma0.rdr', + default = 'gamma0.img', type = str, mandatory = False, doc = 'Unmasked gamma0 backscatter file') diff --git a/components/isceobj/RtcProc/runNormalize.py b/components/isceobj/RtcProc/runNormalize.py index ce1e6c9..7d018e1 100644 --- a/components/isceobj/RtcProc/runNormalize.py +++ b/components/isceobj/RtcProc/runNormalize.py @@ -1,4 +1,4 @@ -# +#!/usr/bin/env python3 # Author: Piyush Agram # Copyright 2016 # @@ -6,6 +6,8 @@ import logging import isceobj import mroipac +from .runTopo import filenameWithLooks +from .runLooks import takeLooks import os import numpy as np from isceobj.Util.decorators import use_api @@ -18,7 +20,6 @@ def runNormalize(self): ''' Make sure that a DEM is available for processing the given data. ''' - refPol = self._grd.polarizations[0] master = self._grd.loadProduct( os.path.join(self._grd.outputFolder, 'beta_{0}.xml'.format(refPol))) @@ -26,17 +27,22 @@ def runNormalize(self): azlooks, rglooks = self._grd.getLooks( self.posting, master.groundRangePixelSize, master.azimuthPixelSize, self.numberAzimuthLooks, self.numberRangeLooks) - if (azlooks == 1) and (rglooks == 1): - return - - slantRange = False for pol in self._grd.polarizations: - inname = os.path.join( self._grd.outputFolder, 'beta_{0}.img'.format(pol) ) - takeLooks(inname, azlooks, rglooks) + if (azlooks == 1) and (rglooks == 1): + inname = os.path.join( self._grd.outputFolder, 'beta_{0}.img'.format(pol)) + else: + inname = os.path.join( self._grd.outputFolder, filenameWithLooks('beta_{0}.img'.format(pol), azlooks, rglooks)) - if not slantRange: - inname = master.slantRangeImage.filename - takeLooks(inname, azlooks, rglooks) - slantRange = True + incname = os.path.join(self._grd.geometryFolder, self._grd.incFileName) + outname = os.path.join(self._grd.outputFolder, filenameWithLooks('gamma_{0}'.format(pol), azlooks, rglooks)) + maskname = os.path.join(self._grd.geometryFolder, self._grd.slMaskFileName) + cmd = "imageMath.py --e='a*cos(b_0*PI/180.)/cos(b_1*PI/180.) * (c==0)' --a={beta} --b={inc} --c={mask} -o {out} -t FLOAT -s BIL" + + cmdrun = cmd.format(inc = incname, + beta = inname, + out = outname, + mask = maskname) + status = os.system(cmdrun) + return