Skip to content

Commit

Permalink
Specify exact chunk for transect mosaic #110
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Bodine committed Jul 12, 2024
1 parent 0e6ab44 commit 2af48b4
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/class_portstarObj.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ def _createMosaicTransect(self,
chunks = pd.unique(group[chunkField])
port_transect = []
for chunk in chunks:
img_path = os.path.join(portPath, '*{}.tif'.format(chunk))
zero = self._addZero(chunk)
img_path = os.path.join(portPath, '*{}{}.tif'.format(zero, chunk))
img = glob(img_path)[0]
port_transect.append(img)
port.append(port_transect)
Expand All @@ -419,7 +420,8 @@ def _createMosaicTransect(self,
chunks = pd.unique(group[chunkField])
star_transect = []
for chunk in chunks:
img_path = os.path.join(starPath, '*{}.tif'.format(chunk))
zero = self._addZero(chunk)
img_path = os.path.join(portPath, '*{}{}.tif'.format(zero, chunk))
img = glob(img_path)[0]
star_transect.append(img)
star.append(star_transect)
Expand All @@ -438,12 +440,14 @@ def _createMosaicTransect(self,
chunks = pd.unique(group[chunkField])
port_transect = []
for chunk in chunks:
try:
img_path = os.path.join(portPath, '*{}.tif'.format(chunk))
img = glob(img_path)[0]
port_transect.append(img)
except:
pass
# try:
zero = self.port._addZero(chunk)
img_path = os.path.join(portPath, '*{}{}.tif'.format(zero, chunk))
img = glob(img_path)[0]
print(img_path, img)
port_transect.append(img)
# except:
# pass
port.append(port_transect)

self.star._loadSonMeta()
Expand All @@ -456,12 +460,13 @@ def _createMosaicTransect(self,
chunks = pd.unique(group[chunkField])
star_transect = []
for chunk in chunks:
try:
img_path = os.path.join(starPath, '*{}.tif'.format(chunk))
img = glob(img_path)[0]
star_transect.append(img)
except:
pass
# try:
zero = self.star._addZero(chunk)
img_path = os.path.join(portPath, '*{}{}.tif'.format(zero, chunk))
img = glob(img_path)[0]
star_transect.append(img)
# except:
# pass
star.append(star_transect)

srcToMosaic = [list(itertools.chain(*i)) for i in zip(port, star)]
Expand Down

0 comments on commit 2af48b4

Please sign in to comment.