Skip to content

Commit

Permalink
removed unnecessary if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewPlayer3 committed Mar 11, 2024
1 parent 19362a6 commit 6a50055
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions opera-rtc-reproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,26 @@ def process_item(self, item: pystac.Item, source) -> pystac.Item:

input_filename = download(asset.href, '.', logger=self.logger, access_token=self.message.accessToken)

if os.path.splitext(input_filename)[-1] == 'tif':
crs = self.message.format.process('crs')
crs = self.message.format.process('crs')

print(f'Processing item {item.id}')
# Stage the output file with a conventional filename
output_filename = os.path.splitext(os.path.basename(input_filename))[0] + '_reprojected.tif'
gdal.Warp(output_filename, input_filename, dstSRS=crs, format='COG', multithread=True, creationOptions=['NUM_THREADS=all_cpus'])
url = stage(output_filename, output_filename, 'image/tiff', location=self.message.stagingLocation,
logger=self.logger)
print(f'Processing item {item.id}')
# Stage the output file with a conventional filename
# TODO: Investigate proper way of generating filename. Look into `generate_output_filename` in harmony-service-lib-py.
output_filename = os.path.splitext(os.path.basename(asset.title))[0] + '_reprojected.tif'
gdal.Warp(output_filename, input_filename, dstSRS=crs, format='COG', multithread=True, creationOptions=['NUM_THREADS=all_cpus'])
url = stage(output_filename, output_filename, 'image/tiff', location=self.message.stagingLocation,
logger=self.logger)

# Update the STAC record
result.assets[key] = Asset(url, title=output_filename, media_type='image/tiff', roles=['data'])
# Other metadata updates may be appropriate, such as result.bbox and result.geometry
# if a spatial subset was performed
# Update the STAC record
result.assets[key] = Asset(url, title=output_filename, media_type='image/tiff', roles=['data'])
# Other metadata updates may be appropriate, such as result.bbox and result.geometry
# if a spatial subset was performed

# Return the STAC record
return result
finally:
# Clean up any intermediate resources
pass
print("Finished Processing")


def run_cli(args):
Expand Down

0 comments on commit 6a50055

Please sign in to comment.