diff --git a/.gitignore b/.gitignore index 5ec1b7f..0513a65 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,162 @@ cpxlooks look_double rilooks + +*.pyc +__pycache__ +settings.conf + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don’t work, or not +# install all needed dependencies. +#Pipfile.lock + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +.idea/ + diff --git a/README.md b/README.md index 1424fbb..7d6f239 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,66 @@ -# slcp2pm - SLC Pair to Proxy Map +### slcp2pm (LAR) -## How to create log amplitude ratio images from ARIA SLC_PAIR products +#### SLC Pair to Log Amplitude Ratio -1. go to src +This repository contains jobs to convert S1-SLCP products to Log Amplitude Ratios (LARs) for creating Flood Proxy Maps v1 (FPMv1). + +A LAR is created based on the below pairing system, using 2 SLCs --> 1 SLCP --> 1 FPM: +![image](https://user-images.githubusercontent.com/6346909/77985672-9f6cea00-7304-11ea-807d-861833d4b1a3.png) + +_Note: Since SLCP:LAR is 1:1, the pairing of SLCPs is **not required** to make LARs. Hence, user simply needs to facet on target SLCPs to execute the LAR job on._ + + +### Job 1: S1 Log Amplitude Ratio +- Type: **Iterative** +- Facet: **SLCPs to create LARs from** +- User inputs: + + | Fields | Description | Type |Example | + | ------------- |-------------| :---------:| :---------:| + | `lar_range_looks` | Range looks to create LARs. (Overrides looks in SLCP's metadata)| int | 7 | + | `lar_azimuth_looks` | Azimuth looks to create LARs. (Overrides looks in SLCP's metadata) | int | 2 | + +- Important outputs: + + | Product | Description | Example | + | ------------- |-------------| :-----| + | Log Amplitude Ratio Products | Geocoded, multilooked LARs | logr_[burst]_[range_lks]_[az_lks].float.geo| + | Amplitude Products | Geocoded, multilooked amplitudes stored in 2 bands. Band 1 - Master scene's amp. Band 2 - Slave scene's amp. | amp_[subswath]_[range_lks]_[az_lks].amp.geo| + + +##### Notes on S1 Log Amplitude Ratio +The LARs in this PGE are computed as such (from `log_ratio.py`): + +* (**Latest**) From dataset `v2.0` onwards: + + ![formula](https://render.githubusercontent.com/render/math?math=LAR=\log_{10}{\frac{A_{post-event}}{A_{pre-event}}}) + ![formula](https://render.githubusercontent.com/render/math?math==\log_{10}{\frac{A_{slave}}{A_{master}}}) + + where _A_ = Amplitudes of SLCs of the given date in the co-registered SLCPs + + => Negative values / darker pixels correspond to decreased amplitudes in the post-event scene and possible open-water flood. + +* Before dataset `v2.0` (`v1.x` etc): + + ![formula](https://render.githubusercontent.com/render/math?math=LAR=\log_{10}{\frac{A_{pre-event}}{A_{post-event}}}) + ![formula](https://render.githubusercontent.com/render/math?math==\log_{10}{\frac{A_{master}}{A_{slave}}}) + + where _A_ = Amplitudes of SLCs of the given date in the co-registered SLCPs + + => Positive values / brighter pixels correspond to decreased amplitudes in the post-event scene and possible open-water flood. + + +### How to use the raw code for standalone use + +**How to create log amplitude ratio images from ARIA SLC_PAIR products:** + +1. Go to src. ``` ./compile.sh ``` -2. set environment variables. see set_env_variable.sh for details +2. Set environment variables. See set_env_variable.sh for details. 3. Then modify slcp2lar_S1.sh and run it. -## Authors +### Authors * **Sang-Ho Yun** - *initial work* diff --git a/docker/Dockerfile b/docker/Dockerfile index ba1f5c0..ce1df6c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,13 +1,7 @@ -FROM hysds/pge-isce_giant:latest +FROM hysds/isce2:latest LABEL description="PGE container for LAR product generation" -# create work directory -RUN set -ex \ - && mkdir -p /data/work \ - && chmod -R 755 /data \ - && chown -R ops:ops /data - USER ops # copy code ensure proper permissions, and move dependencies to final locations diff --git a/docker/hysds-io.json.s1-lar b/docker/hysds-io.json.s1-lar index f3c049e..7b75483 100644 --- a/docker/hysds-io.json.s1-lar +++ b/docker/hysds-io.json.s1-lar @@ -5,12 +5,12 @@ { "name": "localize_url", "from": "dataset_jpath:_source", - "lambda": "lambda ds: filter(lambda x: x.startswith('s3://'), ds['urls'])[0]" + "lambda": "lambda ds: list(filter(lambda x: x.startswith('s3://'), ds['urls']))[0]" }, { "name": "path", "from": "dataset_jpath:_source", - "lambda": "lambda ds: __import__('os').path.basename(filter(lambda x: x.startswith('s3://'), ds['urls'])[0])" + "lambda": "lambda ds: __import__('os').path.basename(list(filter(lambda x: x.startswith('s3://'), ds['urls']))[0])" }, { "name": "lar_range_looks", diff --git a/docker/job-spec.json.s1-lar b/docker/job-spec.json.s1-lar index 25667dd..3c13a74 100644 --- a/docker/job-spec.json.s1-lar +++ b/docker/job-spec.json.s1-lar @@ -16,6 +16,8 @@ "urgent-response-job_worker-large" ], "disk_usage":"100GB", + "soft_time_limit": 3300, + "time_limit": 3600, "params" : [ { "name": "localize_url", diff --git a/script/create_lar.py b/script/create_lar.py index 4d843f1..2d10024 100755 --- a/script/create_lar.py +++ b/script/create_lar.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +from builtins import str import os, sys, re, json, shutil, traceback, logging from subprocess import check_call, check_output from datetime import datetime @@ -89,7 +90,7 @@ def main(slcp_dir): # get dataset version, set dataset ID and met/dataset JSON files match = SLCP_RE.search(slcp_id) if not match: - raise(RuntimeError("Failed to recognize SLCP id: {}".format(slcp_id))) + raise RuntimeError("Failed to recognize SLCP id: {}".format(slcp_id)) id_base = "S1-LAR_{}".format(match.group(1)) swath = match.group(2) slcp_version = match.group(3) @@ -145,7 +146,7 @@ def main(slcp_dir): if __name__ == '__main__': try: status = main(sys.argv[1]) - except Exception as e: + except (Exception, SystemExit) as e: with open('_alt_error.txt', 'w') as f: f.write("%s\n" % str(e)) with open('_alt_traceback.txt', 'w') as f: diff --git a/script/create_lar.sh b/script/create_lar.sh index d3638ce..2dbd225 100755 --- a/script/create_lar.sh +++ b/script/create_lar.sh @@ -1,29 +1,13 @@ #!/bin/bash BASE_PATH=$(dirname "${BASH_SOURCE}") BASE_PATH=$(cd "${BASE_PATH}"; pwd) - -# source ISCE env -export GMT_HOME=/usr/local/gmt -export PYTHONPATH=/usr/local/isce:$PYTHONPATH -export ISCE_HOME=/usr/local/isce/isce -export PATH=$ISCE_HOME/applications:$ISCE_HOME/bin:/usr/local/gdal/bin:$PATH -export LD_LIBRARY_PATH=/usr/local/gdal/lib:$LD_LIBRARY_PATH -export GDAL_DATA=/usr/local/gdal/share/gdal - -export TROPMAP_HOME=$HOME/tropmap -export GIANT_HOME=/usr/local/giant/GIAnT -export PYTHONPATH=$ISCE_HOME/applications:$ISCE_HOME/components:$BASE_PATH:$ARIAMH_HOME:$TROPMAP_HOME:$GIANT_HOME:$PYTHONPATH -export PATH=$BASE_PATH:$TROPMAP_HOME:$GMT_HOME/bin:$PATH - - SLCP_PROD=$1 SWATH=$2 - echo "##########################################" 1>&2 echo -n "Running S1 log amp ratio generation: " 1>&2 date 1>&2 -python3 $BASE_PATH/create_lar.py $SLCP_PROD > create_lar.log 2>&1 +source /opt/isce2/isce_env.sh && python3 $BASE_PATH/create_lar.py $SLCP_PROD > create_lar.log 2>&1 STATUS=$? echo -n "Finished running S1 log amp ratio generation: " 1>&2 date 1>&2 diff --git a/script/geo_with_ll.py b/script/geo_with_ll.py index e02b11d..4747ce6 100755 --- a/script/geo_with_ll.py +++ b/script/geo_with_ll.py @@ -3,6 +3,7 @@ #Cunren Liang, JPL/Caltech +from builtins import range import os import sys import glob diff --git a/script/log_ratio.py b/script/log_ratio.py index c55d45a..ddc7c96 100755 --- a/script/log_ratio.py +++ b/script/log_ratio.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 - - - +from __future__ import division +from builtins import range +from past.utils import old_div import os import sys import glob @@ -25,13 +25,13 @@ def runCmd(cmd): - print("{}".format(cmd)) #status = os.system(cmd) status = check_call(cmd, shell=True) if status != 0: raise Exception('error when running:\n{}\n'.format(cmd)) + def getWidth(xmlfile): xmlfp = None try: @@ -51,6 +51,7 @@ def getWidth(xmlfile): xmlfp.close() return width + def getLength(xmlfile): xmlfp = None try: @@ -72,7 +73,6 @@ def getLength(xmlfile): def create_xml(fileName, width, length, fileType): - if fileType == 'slc': image = isceobj.createSlcImage() elif fileType == 'int': @@ -96,33 +96,23 @@ def create_xml(fileName, width, length, fileType): #image.finalizeImage() - - def cmdLineParse(): - ''' + """ Command line parser. - ''' + """ parser = argparse.ArgumentParser( description='log ratio') - parser.add_argument('-mdir', dest='mdir', type=str, required=True, - help = 'master directory containing the bursts') - parser.add_argument('-sdir', dest='sdir', type=str, required=True, - help = 'slave directory containing the bursts') + parser.add_argument('-mdir', dest='mdir', type=str, required=True, help='master directory containing the bursts') + parser.add_argument('-sdir', dest='sdir', type=str, required=True, help='slave directory containing the bursts') parser.add_argument('-gdir', dest='gdir', type=str, required=True, - help = 'geometric directory containing the lat/lon files ') - - parser.add_argument('-rlks',dest='rlks', type=int, default=0, - help = 'number of range looks') - parser.add_argument('-alks',dest='alks', type=int, default=0, - help = 'number of azimuth looks') - + help='geometric directory containing the lat/lon files') + parser.add_argument('-rlks', dest='rlks', type=int, default=0, help='number of range looks') + parser.add_argument('-alks', dest='alks', type=int, default=0, help='number of azimuth looks') parser.add_argument('-ssize', dest='ssize', type=float, default=1.0, - help = 'output geocoded sample size. default: 1.0 arcsec') - - + help='output geocoded sample size. default: 1.0 arcsec') return parser.parse_args() -if __name__ == '__main__': +if __name__ == '__main__': SCR_DIR = SCR_PATH inps = cmdLineParse() @@ -130,7 +120,6 @@ def cmdLineParse(): mbursts = sorted(glob.glob(os.path.join(inps.mdir, 'burst_*.slc'))) sbursts = sorted(glob.glob(os.path.join(inps.sdir, 'burst_*.slc'))) - nmb = len(mbursts) #number of master bursts nsb = len(sbursts) #number of slave bursts @@ -140,13 +129,11 @@ def cmdLineParse(): nb = nmb for i in range(nb): - print('+++++++++++++++++++++++++++++++++++') print('processing burst {} of {}'.format(i+1, nb)) print('+++++++++++++++++++++++++++++++++++') - - #find slave burst here + # find slave burst here master_burst = ntpath.basename(mbursts[i]) slave_burst_id = -1 for ii in range(nsb): @@ -158,7 +145,6 @@ def cmdLineParse(): print('no matching slave burst found, skip this burst') continue - amp = 'amp_%02d.amp' % (i+1) # cmd = "imageMath.py -e='(real(a)!=0)*(real(b)!=0)*(imag(a)!=0)*(imag(b)!=0)*sqrt(real(a)*real(a)+imag(a)*imag(a));(real(a)!=0)*(real(b)!=0)*(imag(a)!=0)*(imag(b)!=0)*sqrt(real(b)*real(b)+imag(b)*imag(b))' --a={} --b={} -o {} -t float -s BIP".format( # mbursts[i], @@ -169,24 +155,20 @@ def cmdLineParse(): width = getWidth(mbursts[i] + '.xml') length = getLength(mbursts[i] + '.xml') - width_looked = int(width/inps.rlks) - length_looked = int(length/inps.alks) + width_looked = int(old_div(width,inps.rlks)) + length_looked = int(old_div(length,inps.alks)) master = np.fromfile(mbursts[i], dtype=np.complex64).reshape(length, width) slave = np.fromfile(sbursts[slave_burst_id], dtype=np.complex64).reshape(length, width) amp_data = np.zeros((length, width*2), dtype=np.float) - amp_data[:, 0:width*2:2] = np.absolute(master) * (np.absolute(slave)!=0) - amp_data[:, 1:width*2:2] = np.absolute(slave) * (np.absolute(master)!=0) + amp_data[:, 0:width * 2:2] = np.absolute(master) * (np.absolute(slave) != 0) + amp_data[:, 1:width * 2:2] = np.absolute(slave) * (np.absolute(master) != 0) amp_data.astype(np.float32).tofile(amp) create_xml(amp, width, length, 'amp') - amp_looked = 'amp_%02d_%drlks_%dalks.amp' % (i+1,inps.rlks,inps.alks) - cmd = "{}/look.py -i {} -o {} -r {} -a {}".format(SCR_DIR, - amp, - amp_looked, - inps.rlks, - inps.alks) + amp_looked = 'amp_%02d_%drlks_%dalks.amp' % (i + 1, inps.rlks, inps.alks) + cmd = "{}/look.py -i {} -o {} -r {} -a {}".format(SCR_DIR, amp, amp_looked, inps.rlks, inps.alks) runCmd(cmd) # mburst_looked = 'master_%02d_%drlks_%dalks.slc' % (i+1,inps.rlks,inps.alks) @@ -205,7 +187,7 @@ def cmdLineParse(): # inps.alks) # runCmd(cmd) - lat_looked = 'lat_%02d_%drlks_%dalks.rdr' % (i+1,inps.rlks,inps.alks) + lat_looked = 'lat_%02d_%drlks_%dalks.rdr' % (i + 1, inps.rlks, inps.alks) #lat = os.path.join(inps.gdir, 'lat_%02d.rdr'%(i+1)) cmd = "{}/look.py -i {} -o {} -r {} -a {}".format(SCR_DIR, lats[slave_burst_id], @@ -214,59 +196,60 @@ def cmdLineParse(): inps.alks) runCmd(cmd) - lon_looked = 'lon_%02d_%drlks_%dalks.rdr' % (i+1,inps.rlks,inps.alks) + lon_looked = 'lon_%02d_%drlks_%dalks.rdr' % (i + 1, inps.rlks, inps.alks) #lon = os.path.join(inps.gdir, 'lon_%02d.rdr'%(i+1)) - cmd = "{}/look.py -i {} -o {} -r {} -a {}".format(SCR_DIR, + cmd = "{}/look.py -i {} -o {} -r {} -a {}".format( + SCR_DIR, lons[slave_burst_id], lon_looked, inps.rlks, inps.alks) runCmd(cmd) - logr_looked = 'logr_%02d_%drlks_%dalks.float' % (i+1,inps.rlks,inps.alks) + logr_looked = 'logr_%02d_%drlks_%dalks.float' % (i + 1, inps.rlks, inps.alks) # cmd = "imageMath.py -e='log10((a_0)/(a_1+(a_1==0)))*(a_0!=0)*(a_1!=0)' --a={} -o {} -t float -s BIP".format( # amp_looked, # logr_looked) # runCmd(cmd) - amp_looked_data = np.fromfile(amp_looked, dtype=np.float32).reshape(length_looked, width_looked*2) - m = amp_looked_data[:, 0:width_looked*2:2] - s = amp_looked_data[:, 1:width_looked*2:2] + amp_looked_data = np.fromfile(amp_looked, dtype=np.float32).reshape(length_looked, width_looked * 2) + m = amp_looked_data[:, 0:width_looked * 2:2] + s = amp_looked_data[:, 1:width_looked * 2:2] # Only for S1-LAR before v2.0! Apre/Aco: # logr_looked_data = np.log10( (m+(m==0)) / (s+(s==0)) ) * (m!=0) * (s!=0) # Only for S1-LAR v2.0 onwards! Aco/Apre (-ve value is openwater flood, +ve value is veg-flood) - logr_looked_data = np.log10( (s+(s==0)) / (m+(m==0)) ) * (m!=0) * (s!=0) + logr_looked_data = np.log10(old_div((s + (s == 0)), (m + (m == 0)))) * (m != 0) * (s != 0) #remove white edges upper_edge = 0 for k in range(length_looked): - if logr_looked_data[k, int(width_looked/2)] != 0: + if logr_looked_data[k, int(old_div(width_looked, 2))] != 0: upper_edge = k break - lower_edge = length_looked-1 + lower_edge = length_looked - 1 for k in range(length_looked): - if logr_looked_data[length_looked-1-k, int(width_looked/2)] != 0: - lower_edge = length_looked-1-k + if logr_looked_data[length_looked - 1 - k, int(old_div(width_looked, 2))] != 0: + lower_edge = length_looked - 1 - k break left_edge = 0 for k in range(width_looked): - if logr_looked_data[int(length_looked/2), k] != 0: + if logr_looked_data[int(old_div(length_looked, 2)), k] != 0: left_edge = k break right_edge = width_looked-1 for k in range(width_looked): - if logr_looked_data[int(length_looked/2), width_looked-1-k] != 0: + if logr_looked_data[int(old_div(length_looked, 2)), width_looked - 1 - k] != 0: right_edge = width_looked-1-k break print('four edgeds: lower: {}, upper: {}, left: {}, right: {}'.format(lower_edge, upper_edge, left_edge, right_edge)) flag = np.zeros((length_looked, width_looked), dtype=np.float) delta = 3 - flag[upper_edge+delta:lower_edge-delta, left_edge+delta:right_edge-delta] = 1.0 + flag[upper_edge + delta:lower_edge - delta, left_edge + delta:right_edge - delta] = 1.0 logr_looked_data *= flag logr_looked_data.astype(np.float32).tofile(logr_looked) @@ -283,9 +266,9 @@ def cmdLineParse(): lon_min = np.amin(lon_looked_data) bbox = "{}/{}/{}/{}".format(lat_min, lat_max, lon_min, lon_max) - logr_looked_geo = 'logr_%02d_%drlks_%dalks.float.geo' % (i+1,inps.rlks,inps.alks) - cmd = "{}/geo_with_ll.py -input {} -output {} -lat {} -lon {} -bbox={} -ssize {} -rmethod {}".format(SCR_DIR, + cmd = "{}/geo_with_ll.py -input {} -output {} -lat {} -lon {} -bbox={} -ssize {} -rmethod {}".format( + SCR_DIR, logr_looked, logr_looked_geo, lat_looked, @@ -295,10 +278,10 @@ def cmdLineParse(): 1) runCmd(cmd) - amp_looked_geo = 'amp_%02d_%drlks_%dalks.amp.geo' % (i+1,inps.rlks,inps.alks) - cmd = "{}/geo_with_ll.py -input {} -output {} -lat {} -lon {} -bbox={} -ssize {} -rmethod {}".format(SCR_DIR, - amp_looked, + cmd = "{}/geo_with_ll.py -input {} -output {} -lat {} -lon {} -bbox={} -ssize {} -rmethod {}".format( + SCR_DIR, + amp_looked, amp_looked_geo, lat_looked, lon_looked, @@ -307,7 +290,6 @@ def cmdLineParse(): 1) runCmd(cmd) - os.remove(amp) os.remove(amp_looked) os.remove(lat_looked) @@ -326,6 +308,4 @@ def cmdLineParse(): os.remove(lon_looked+'.vrt') os.remove(logr_looked+'.vrt') - #log_ratio.py -mdir /u/hm/NC/data/S1-COH_STCM3S3_TN077_20160929T231332-20161011T231433_s1-resorb-v1.0/master -sdir /u/hm/NC/data/S1-COH_STCM3S3_TN077_20160929T231332-20161011T231433_s1-resorb-v1.0/fine_coreg -gdir /u/hm/NC/data/S1-COH_STCM3S3_TN077_20160929T231332-20161011T231433_s1-resorb-v1.0/geom_master -rlks 7 -alks 2 - diff --git a/script/look.py b/script/look.py index ce5abf6..63ca1a7 100755 --- a/script/look.py +++ b/script/look.py @@ -3,6 +3,8 @@ #Cunren Liang, JPL/Caltech +from __future__ import division +from past.utils import old_div import os import sys import argparse @@ -68,8 +70,8 @@ def ampLooks(inps): inWidth = getWidth(inps.input + '.xml') inLength = getLength(inps.input + '.xml') - outWidth = int(inWidth/inps.rlks) - outLength = int(inLength/inps.alks) + outWidth = int(old_div(inWidth,inps.rlks)) + outLength = int(old_div(inLength,inps.alks)) #run it #cmd = 'echo -e "{}\n{}\n{} {}\n{} {}\n" | {}/rilooks'.format(inps.input, inps.output, inWidth, inLength, inps.rlks, inps.alks, BIN_PATH) @@ -92,8 +94,8 @@ def intLooks(inps): inWidth = getWidth(inps.input + '.xml') inLength = getLength(inps.input + '.xml') - outWidth = int(inWidth/inps.rlks) - outLength = int(inLength/inps.alks) + outWidth = int(old_div(inWidth,inps.rlks)) + outLength = int(old_div(inLength,inps.alks)) #run program here cmd = 'echo "{}\n{}\n{} {}\n{} {}\n" | {}/cpxlooks'.format(inps.input, inps.output, inWidth, inLength, inps.rlks, inps.alks, BIN_PATH) @@ -115,8 +117,8 @@ def mskLooks(inps): inWidth = getWidth(inps.input + '.xml') inLength = getLength(inps.input + '.xml') - outWidth = int(inWidth/inps.rlks) - outLength = int(inLength/inps.alks) + outWidth = int(old_div(inWidth,inps.rlks)) + outLength = int(old_div(inLength,inps.alks)) #look_msk infile outfile nrg nrlks nalks #run program here @@ -142,8 +144,8 @@ def hgtLooks(inps): inWidth = getWidth(inps.input + '.xml') inLength = getLength(inps.input + '.xml') - outWidth = int(inWidth/inps.rlks) - outLength = int(inLength/inps.alks) + outWidth = int(old_div(inWidth,inps.rlks)) + outLength = int(old_div(inLength,inps.alks)) #look_msk infile outfile nrg nrlks nalks #run program here