isce-framework / isce2

InSAR Scientific Computing Environment version 2
Other
495 stars 246 forks source link

ElementTree.Element.getchildren() removed in python 3.9 #265

Closed guangbaoshen closed 3 years ago

guangbaoshen commented 3 years ago

I insatlled the latest version of ISCE (v2.5.1), and when I use the stack model to prepare interferograms for the times-series process(using Mintpy). I met this problem. I listed the files and dictionaries (DEM AuxDir Orbits SLC) and error message.

(isce2) guangbao@guangbao-BAD-INDEX:~/ISCE$ ^C (isce2) guangbao@guangbao-BAD-INDEX:~/ISCE$ cd AuxDir/ (isce2) guangbao@guangbao-BAD-INDEX:~/ISCE/AuxDir$ ls data manifest.safe support (isce2) guangbao@guangbao-BAD-INDEX:~/ISCE/AuxDir$ cd SLC bash: cd: SLC: No such file or directory (isce2) guangbao@guangbao-BAD-INDEX:~/ISCE/AuxDir$ cd .. (isce2) guangbao@guangbao-BAD-INDEX:~/ISCE$ cd SLC (isce2) guangbao@guangbao-BAD-INDEX:~/ISCE/SLC$ ls S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip S1B_IW_SLC__1SDV_20180521T221211_20180521T221238_011025_014336_38A0.zip S1B_IW_SLC1SDV_20180602T221212_20180602T221239_011200_0148E0_4F05.zip S1B_IW_SLC1SDV_20180614T221213_20180614T221240_011375_014E44_06CB.zip S1B_IW_SLC__1SDV_20180626T221213_20180626T221240_011550_0153AF_5390.zip S1B_IW_SLC1SDV_20180708T221214_20180708T221241_011725_01591E_0B8A.zip (isce2) guangbao@guangbao-BAD-INDEX:~/ISCE/SLC$ cd .. (isce2) guangbao@guangbao-BAD-INDEX:~/ISCE$ cd DEM/ (isce2) guangbao@guangbao-BAD-INDEX:~/ISCE/DEM$ ls demLat_N38_N40_Lon_E116_E118.dem.wgs84 demLat_N38_N40_Lon_E116_E118.dem.wgs84.xml isce.log demLat_N38_N40_Lon_E116_E118.dem.wgs84.vrt insar.log (isce2) guangbao@guangbao-BAD-INDEX:~/ISCE/DEM$ cd .. (isce2) guangbao@guangbao-BAD-INDEX:~/ISCE$ cd Orbits/ (isce2) guangbao@guangbao-BAD-INDEX:~/ISCE/Orbits$ ls S1B_OPER_AUX_POEORB_OPOD_20180529T110601_V20180508T225942_20180510T005942.EOF S1B_OPER_AUX_POEORB_OPOD_20180610T110539_V20180520T225942_20180522T005942.EOF S1B_OPER_AUX_POEORB_OPOD_20180622T110648_V20180601T225942_20180603T005942.EOF S1B_OPER_AUX_POEORB_OPOD_20180704T110539_V20180613T225942_20180615T005942.EOF S1B_OPER_AUX_POEORB_OPOD_20180716T110549_V20180625T225942_20180627T005942.EOF S1B_OPER_AUX_POEORB_OPOD_20180728T110605_V20180707T225942_20180709T005942.EOF

(isce2) guangbao@guangbao-BAD-INDEX:~/ISCE$ SentinelWrapper.py -c configs/config_reference /home/guangbao/anaconda3/envs/isce2/isce2/contrib/stack/topsStack/SentinelWrapper.py:113: SyntaxWarning: "is" with a literal. Did you mean "=="? if iString is '': Completed Parsing the Configuration file Functions to be executed: ['Function-1', 'Function-2'] Running: Sentinel1_TOPS ['--dirname', '/home/guangbao/ISCE/SLC/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip', '--swaths', '1 2 3', '--orbitdir', '/home/guangbao/ISCE/Orbits', '--outdir', '/home/guangbao/ISCE/reference', '--auxdir', '/home/guangbao/ISCE/AuxDir', '--bbox', '38 39 116 117', '--pol', 'vv'] This is the Open Source version of ISCE. Some of the workflows depend on a separate licensed package. To obtain the licensed package, please make a request for ISCE through the website: https://download.jpl.nasa.gov/ops/request/index.cfm. Alternatively, if you are a member, or can become a member of WinSAR you may be able to obtain access to a version of the licensed sofware at https://winsar.unavco.org/software/isce Input XML files: ['/vsizip//home/guangbao/ISCE/SLC/S1B_IW_SLC__1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.SAFE/annotation/s1b-iw1-slc-vv-20180509t221211-20180509t221236-010850-013d8b-004.xml'] Input TIFF files: ['/vsizip//home/guangbao/ISCE/SLC/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip/S1B_IW_SLC__1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.SAFE/measurement/s1b-iw1-slc-vv-20180509t221211-20180509t221236-010850-013d8b-004.tiff'] Manifest files: ['/vsizip//home/guangbao/ISCE/SLC/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.SAFE/manifest.safe'] MANS: /home/guangbao/ISCE/SLC/S1B_IW_SLC__1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.SAFE/manifest.safe Setting IPF version to : 002.90 'xml.etree.ElementTree.Element' object has no attribute 'getchildren' Input XML files: ['/vsizip//home/guangbao/ISCE/SLC/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip/S1B_IW_SLC__1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.SAFE/annotation/s1b-iw2-slc-vv-20180509t221212-20180509t221237-010850-013d8b-005.xml'] Input TIFF files: ['/vsizip//home/guangbao/ISCE/SLC/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.SAFE/measurement/s1b-iw2-slc-vv-20180509t221212-20180509t221237-010850-013d8b-005.tiff'] Manifest files: ['/vsizip//home/guangbao/ISCE/SLC/S1B_IW_SLC__1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.SAFE/manifest.safe'] MANS: /home/guangbao/ISCE/SLC/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip S1B_IW_SLC__1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.SAFE/manifest.safe Setting IPF version to : 002.90 'xml.etree.ElementTree.Element' object has no attribute 'getchildren' Input XML files: ['/vsizip//home/guangbao/ISCE/SLC/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.SAFE/annotation/s1b-iw3-slc-vv-20180509t221210-20180509t221236-010850-013d8b-006.xml'] Input TIFF files: ['/vsizip//home/guangbao/ISCE/SLC/S1B_IW_SLC__1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.SAFE/measurement/s1b-iw3-slc-vv-20180509t221210-20180509t221236-010850-013d8b-006.tiff'] Manifest files: ['/vsizip//home/guangbao/ISCE/SLC/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip/S1B_IW_SLC__1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.SAFE/manifest.safe'] MANS: /home/guangbao/ISCE/SLC/S1B_IW_SLC1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.zip S1B_IW_SLC__1SDV_20180509T221210_20180509T221237_010850_013D8B_B303.SAFE/manifest.safe Setting IPF version to : 002.90 'xml.etree.ElementTree.Element' object has no attribute 'getchildren' Running: topo ['--reference', '/home/guangbao/ISCE/reference', '--dem', '/home/guangbao/ISCE/DEM/demLat_N38_N40_Lon_E116_E118.dem.wgs84', '--geom_referenceDir', '/home/guangbao/ISCE/geom_reference', '--numProcess', '1'] running in parallel with 1 processes Traceback (most recent call last): File "/home/guangbao/anaconda3/envs/isce2/isce2/contrib/stack/topsStack/SentinelWrapper.py", line 251, in main(args.start,args.end) File "/home/guangbao/anaconda3/envs/isce2/isce2/contrib/stack/topsStack/SentinelWrapper.py", line 242, in main cfgParser.runCmd() File "/home/guangbao/anaconda3/envs/isce2/isce2/contrib/stack/topsStack/SentinelWrapper.py", line 54, in runCmd func_modules.main(self.funcParams[section]) File "/home/guangbao/anaconda3/envs/isce2/isce2/contrib/stack/topsStack/topo.py", line 112, in main bbox = [np.min(boxes[:,0]), np.max(boxes[:,1]), np.min(boxes[:,2]), np.max(boxes[:,3])] IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

It seems that this is the cause of python version(I am using v3.9.2), and I am trying to fix this problem, I will post the result if I fixed this problem. And I hope all of your kind help if you have any solution. Thank you very much.

guangbaoshen commented 3 years ago

I replaced the python(version=3.9.2) to the one(pyhton=3.6.13), and the problem above was solved.

rtburns-jpl commented 3 years ago

The ElementTree getchildren() method has been removed in python 3.9: https://docs.python.org/3.8/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.getchildren. There are quite a few uses of getchildren() in isce2 but they should be fairly easy to fix.

rtburns-jpl commented 3 years ago

@scottyhq thanks for reminding me of this, I think the changes are pretty minor so I will see if I can push a quick PR. Would appreciate if you could test it out once I do

Dani-Lindsay commented 3 years ago

Hi, just wanted to let you know I've just come across this same issue when testing stack processing for alos2 (alosStack/read_data.py). I installed isce2 with condo-forge yesterday, I will try with python=3.6.13 for now as mentioned above. See error below.

(isce2) [daniellelindsay@ln001 proc]$ /global/home/users/daniellelindsay/.conda/envs/isce2/share/isce2/alosStack/read_data.py -idir /global/scratch/daniellelindsay/NZ_ALOS2/194/data -odir dates -ref_date 161018 -sec_date 161018 161115 161129 170110 -pol HH -frames 4400 4450 -virtual This is the Open Source version of ISCE. Some of the workflows depend on a separate licensed package. To obtain the licensed package, please make a request for ISCE through the website: https://download.jpl.nasa.gov/ops/request/index.cfm. Alternatively, if you are a member, or can become a member of WinSAR you may be able to obtain access to a version of the licensed sofware at https://winsar.unavco.org/software/isce

list of dates: index date frames

000 161018 ['4400', '4450'] reference 001 161115 ['4400', '4450'] 002 161129 ['4400', '4450'] 003 170110 ['4400', '4450']

161018 already exists, do not create processing date 161115 frame 4400 swath 1 Traceback (most recent call last): File "/global/home/users/daniellelindsay/.conda/envs/isce2/share/isce2/alosStack/read_data.py", line 274, in (imageFDR, imageData)=sensor.readImage() File "/global/home/users/daniellelindsay/.conda/envs/isce2/lib/python3.9/site-packages/isce/components/isceobj/Sensor/MultiMode/ALOS2.py", line 114, in readImage imageFDR = CEOS.CEOSDB(xml=os.path.join(xmlPrefix,'alos2_slc/image_file.xml'), dataFile=fp) File "/global/home/users/daniellelindsay/.conda/envs/isce2/lib/python3.9/site-packages/isce/components/isceobj/Sensor/CEOS.py", line 47, in init self.rootChildren = ET(file=self.xmlFP).getroot().getchildren() AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'