bugfix in `Alos2Proc.runFrameOffset` for 3-digit frames
While processing multiple frames of ALOS2 ScanSAR data using alos2App.py, an error occurs as below if the frame number has 3-digit, e.g. 750. This PR fixes this error by converting the frameNumber from str to int type, to remove the padding 0 for frames in 3-digit, consistent with the factual folder name and other parts of the workflow.
The remaining steps are (in order): ['frame_offset', 'frame_mosaic', 'rdr2geo', 'geo2rdr', 'rdrdem_offset', 'rect_rgoffset', 'diff_int', 'look', 'coherence'
Running step frame_offset
estimate offset frame 0700
estimate offset frame 0750
Traceback (most recent call last):
File "/home/zhangyunjun/tools/mambaforge/envs/insar/lib/python3.11/site-packages/isce/applications/alos2App.py", line 1173, in <module>
insar.run()
File "/home/zhangyunjun/tools/mambaforge/envs/insar/lib/python3.11/site-packages/isce/components/iscesys/Component/Application.py", line 142, in run
exitStatus = self._processSteps()
^^^^^^^^^^^^^^^^^^^^
File "/home/zhangyunjun/tools/mambaforge/envs/insar/lib/python3.11/site-packages/isce/components/iscesys/Component/Application.py", line 405, in _processSt
result = func(*pargs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/zhangyunjun/tools/mambaforge/envs/insar/lib/python3.11/site-packages/isce/components/isceobj/Alos2Proc/Factories.py", line 40, in __call__
return self.method(self.other, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zhangyunjun/tools/mambaforge/envs/insar/lib/python3.11/site-packages/isce/components/isceobj/Alos2Proc/runFrameOffset.py", line 40, in runFrame
offsetReference = frameOffset(referenceTrack, self._insar.referenceSlc, self._insar.referenceFrameOffset,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zhangyunjun/tools/mambaforge/envs/insar/lib/python3.11/site-packages/isce/components/isceobj/Alos2Proc/runFrameOffset.py", line 108, in frameOf
offsetMatching = estimateFrameOffset(swath1, swath2, image1, image2, matchingMode=matchingMode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zhangyunjun/tools/mambaforge/envs/insar/lib/python3.11/site-packages/isce/components/isceobj/Alos2Proc/runFrameOffset.py", line 172, in estimat
mSLC.load(image1+'.xml')
File "/home/zhangyunjun/tools/mambaforge/envs/insar/lib/python3.11/site-packages/isce/components/iscesys/Component/Configurable.py", line 1407, in load
tmpProp, tmpFact, tmpMisc = FP.parse(filename)
^^^^^^^^^^^^^^^^^^
File "/home/zhangyunjun/tools/mambaforge/envs/insar/lib/python3.11/site-packages/isce/components/iscesys/Parsers/XmlParser.py", line 41, in parse
root = ET.parse(filename)
^^^^^^^^^^^^^^^^^^
File "/home/zhangyunjun/tools/mambaforge/envs/insar/lib/python3.11/xml/etree/ElementTree.py", line 1218, in parse
tree.parse(source, parser)
File "/home/zhangyunjun/tools/mambaforge/envs/insar/lib/python3.11/xml/etree/ElementTree.py", line 569, in parse
source = open(source, "rb")
^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '../f1_0700/s1/220905.slc.xml'
Are the padding zeros needed anywhere else? If not, it might be more correct to cast to int when track.frames[j].frameNumber is initialized. I think it makes a little more sense for the frameNumber member to be int-typed anyway, and you wouldn't have to worry about leading zeros elsewhere.
The frame number is defined explicitly as str type in the code here and here, thus, I think keeping the string type as it's now in track.frams[j].frameNumber should be a better choice.
I also tried to cast as int in the runPreprocessor.py and testing failed in the frame_offset step due to another member variable using str type. Therefore, I still think this PR's simple fix is a more elegant solution.
For frames in 3-digit, e.g. 750, if we set the frame number in the XML file as 0750, then the code runs through without issue, so I revert the changes, and add a description in the example input file.