Skip to content

Commit

Permalink
fixes and tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
gillins committed Jul 4, 2024
1 parent 22c4a89 commit ad70512
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions parallel_examples/awsbatch/template/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ Resources:
JobDefinitionName: PyShepSegBatchJobDefinitionStitch
ContainerProperties:
Image: !Join ['', [!GetAtt BatchRepository.RepositoryUri, ":latest"]]
Vcpus: 2
Memory: 24000
Vcpus: 4
Memory: 12000
RetryStrategy:
Attempts: 1
BatchProcessingJobQueue:
Expand Down
16 changes: 10 additions & 6 deletions pyshepseg/tilingstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ def calcPerSegmentStatsTiledRIOS(imgfile, imgbandnum, segfile,
del imgds

controls = applier.ApplierControls()
controls.selectInputImageLayers([imgbandnum], imgfile)
controls.selectInputImageLayers([imgbandnum], 'imgfile')
# RIOS default is 256x256. This leads to too many incomplete
# segments and increases memory use dramatically.
controls.setWindowSize(tiling.TILESIZE, tiling.TILESIZE)

# now create a new temporary file for saving the new columns too
Expand Down Expand Up @@ -329,8 +331,9 @@ def calcPerSegmentStatsTiledRIOS(imgfile, imgbandnum, segfile,
otherArgs.numIntCols = numIntCols
otherArgs.numFloatCols = numFloatCols

applier.apply(rioscalcPerSegmentStatsTiled, inputs, outputs,
rtn = applier.apply(rioscalcPerSegmentStatsTiled, inputs, outputs,
controls=controls, otherArgs=otherArgs)
print(rtn.timings.formatReport())

del tempKEAAttrTbl
del tempKEABand
Expand All @@ -341,7 +344,6 @@ def calcPerSegmentStatsTiledRIOS(imgfile, imgbandnum, segfile,
raise PyShepSegStatsError('Not all pixels found during processing')

# now merge the stats from the tempfile band info segfile
print('copying RAT')
ratapplier.copyRAT(tempKEA, segfile)


Expand Down Expand Up @@ -1418,7 +1420,9 @@ def calcPerSegmentSpatialStatsTiledRIOS(imgfile, imgbandnum, segfile,
del imgds

controls = applier.ApplierControls()
controls.selectInputImageLayers([imgbandnum], imgfile)
controls.selectInputImageLayers([imgbandnum], 'imgfile')
# RIOS default is 256x256. This leads to too many incomplete
# segments and increases memory use dramatically.
controls.setWindowSize(tiling.TILESIZE, tiling.TILESIZE)

# now create a new temporary file for saving the new columns too
Expand Down Expand Up @@ -1463,8 +1467,9 @@ def calcPerSegmentSpatialStatsTiledRIOS(imgfile, imgbandnum, segfile,
otherArgs.userFunc = userFunc
otherArgs.userParam = userParam

applier.apply(rioscalcPerSegmentSpatialStatsTiled, inputs, outputs,
rtn = applier.apply(rioscalcPerSegmentSpatialStatsTiled, inputs, outputs,
controls=controls, otherArgs=otherArgs)
print(rtn.timings.formatReport())

del tempKEAAttrTbl
del tempKEABand
Expand All @@ -1475,7 +1480,6 @@ def calcPerSegmentSpatialStatsTiledRIOS(imgfile, imgbandnum, segfile,
raise PyShepSegStatsError('Not all pixels found during processing')

# now merge the stats from the tempfile band info segfile
print('copying RAT')
ratapplier.copyRAT(tempKEA, segfile)


Expand Down

0 comments on commit ad70512

Please sign in to comment.