From 0e3b06567f1462533b3690d23d44c977dbdc7468 Mon Sep 17 00:00:00 2001 From: Microwave Remote Sensing Laboratory <50493465+MIRSL@users.noreply.github.com> Date: Mon, 30 Sep 2019 15:26:54 -0400 Subject: [PATCH] Add files via upload changed to use imagemath.main() instead of command line --- components/isceobj/RtcProc/runNormalize.py | 32 +++++++++++++++------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/components/isceobj/RtcProc/runNormalize.py b/components/isceobj/RtcProc/runNormalize.py index 170c6de..70ce9cb 100644 --- a/components/isceobj/RtcProc/runNormalize.py +++ b/components/isceobj/RtcProc/runNormalize.py @@ -9,12 +9,15 @@ import mroipac from .runTopo import filenameWithLooks from .runLooks import takeLooks import os +import itertools import numpy as np from isceobj.Util.decorators import use_api +from applications import imageMath logger = logging.getLogger('isce.grdsar.looks') - +class Dummy: + pass def runNormalize(self): ''' @@ -33,16 +36,25 @@ def runNormalize(self): else: inname = os.path.join( self._grd.outputFolder, filenameWithLooks('beta_{0}.img'.format(pol), azlooks, rglooks)) - incname = os.path.join(self._grd.geometryFolder, self._grd.incFileName) + basefolder, output = os.path.split(self._grd.outputFolder) + incname = os.path.join(basefolder, self._grd.geometryFolder, self._grd.incFileName) outname = os.path.join(self._grd.outputFolder, filenameWithLooks('gamma_{0}'.format(pol)+'.img', azlooks, rglooks)) - maskname = os.path.join(self._grd.geometryFolder, self._grd.slMaskFileName) + maskname = os.path.join(basefolder, 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" + args = imageMath.createNamespace() + args.equation = 'a*cos(b_0*PI/180.)/cos(b_1*PI/180.) * (c==0)' + args.dtype = np.float32 + args.scheme = 'BIL' + args.out = outname + #args.debug = True + + files = Dummy() + files.a = inname + files.b = incname + files.c = maskname + + + + imageMath.main(args, files) - cmdrun = cmd.format(inc = incname, - beta = inname, - out = outname, - mask = maskname) - status = os.system(cmdrun) - return