Go to the documentation of this file.
12 north=None, south=None, west=None, east=None,
32 self.__dict__[index] = item
35 return self.__dict__[index]
41 if not os.path.exists(self.
geofile):
42 print(
"ERROR: File '" + self.
geofile +
"' does not exist. Exiting.")
47 (0 != self.
west and not self.
west)
or \
49 print(
"Error: All four NSWE coordinates required!")
54 err_msg =
'Error! North value "{0}" non-numeric.'.format(self.
north)
58 err_msg =
'Error! South value "{0}" non-numeric.'.format(self.
south)
62 err_msg =
'Error! East value "{0}" non-numeric.'.format(self.
east)
66 err_msg =
'Error! West value "{0}" non-numeric.'.format(self.
west)
69 print(
"Error: North must be greater than South!")
71 if (north > 90.0)
or (south < -90.0):
72 print(
"Latitude range outside realistic bounds!")
74 if west < -180
or west > 180.
or east < -180.
or east > 180:
75 print(
"Longitudes must be between -180.0 and 180.0")
86 print(
"Locating pixel/line range ...")
87 exe = os.path.join(self.
dirs[
'bin'],
'lonlat2pixline')
88 pixlincmd = [exe,
'-F', self.
geofile,
91 p = subprocess.Popen(pixlincmd, stdout=subprocess.PIPE)
92 line = p.communicate()[0].decode(
"utf-8")
94 if p.returncode
in (0, 110):
97 pixlin = line.splitlines()[-5][2:].split()
98 pixlin = [
int(p)
for p
in pixlin]
100 pixlin = [p - 1
for p
in pixlin]
101 self.
spixl = pixlin[0]
102 self.
epixl = pixlin[1]
103 self.
sline = pixlin[2]
104 self.
eline = pixlin[3]
106 elif p.returncode == 120:
107 print(
"No extract necessary:",
108 "entire scene contained within specified region of interest.")
110 print(
"Error locating pixel/line range to extract.")
112 self.
status = p.returncode
def __getitem__(self, index)
def lonlat2pixline(self, zero=False)
def __init__(self, geofile=None, north=None, south=None, west=None, east=None, verbose=False)
def __setitem__(self, index, item)