nareshkamboju

code for rows and colmns

Feb 13th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. #!/usr/bin/python
  2. #
  3.  
  4. import sys
  5. import xml.etree.ElementTree as ET
  6.  
  7. input_file = sys.argv[1]
  8. tree = ET.parse(input_file)
  9. root = tree.getroot()
  10.  
  11. for geninfo in root.findall('General_Info'):
  12.     for archive in geninfo.findall('Archiving_Info'):
  13.          ARCHIVING_TIME = archive.find('ARCHIVING_TIME').text
  14.          print ARCHIVING_TIME
  15.  
  16. for geoinfo in root.findall('Geometric_Info'):
  17.     for tilegeocoding in geoinfo.findall('Tile_Geocoding'):
  18.         for size in tilegeocoding.findall('Size'):
  19.             print size.get('resolution')
  20.             if size.get('resolution') == "10":
  21.                print size.find('NROWS').text
  22.                print size.find('NCOLS').text
  23.                NROWS_10 = size.find('NROWS').text
  24.                NCOLS_10 = size.find('NCOLS').text
  25.             if size.get('resolution') == "20":
  26.                print size.find('NROWS').text
  27.                print size.find('NCOLS').text
  28.                NROWS_20 = size.find('NROWS').text
  29.                NCOLS_20 = size.find('NCOLS').text
  30.             if size.get('resolution') == "60":
  31.                print size.find('NROWS').text
  32.                print size.find('NCOLS').text
  33.                NROWS_60 = size.find('NROWS').text
  34.                NCOLS_60 = size.find('NCOLS').text
  35.  
  36. print "10", NROWS_10, NCOLS_10
  37. print "20", NROWS_20, NCOLS_20
  38. print "60", NROWS_60, NCOLS_60
Add Comment
Please, Sign In to add comment