You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check correctness & measure efficiency of the current & suggested approach -- make necessary changes if required.
Code snippet as per above comment:
profile = {
'dtype': dtype,
'width': data[0].data.shape[1],
'height': data[0].data.shape[0],
'count': len(data),
'nodata': np.nan,
'crs': crs,
'transform': transform,
'compress': 'lzw'
}
with tempfile.NamedTemporaryFile() as temp:
with rasterio.MemoryFile() as memfile:
with memfile.open(driver='GTiff', **profile) as f:
for i, da in enumerate(data):
f.write(da, i + 1)
# Making the channel name EE-safe.
f.set_band_description(i + 1,
get_ee_safe_name(channel_names[i]))
f.update_tags(i + 1, band_name=channel_names[i])
f.update_tags(i + 1, **da.attrs)
# Write attributes as tags in tiff.
f.update_tags(**attrs)
print("tags update : " + datetime.now().strftime("%H:%M:%S"))
# Create COG
rasterio_copy(f, temp.name, driver="COG", compress="lzw", bigtiff="IF_NEEDED")
# Copy the created COG to gcs.
target_path = os.path.join(self.asset_location, file_name)
gcs_copy(temp.name, target_path)
del f, memfile, data
The text was updated successfully, but these errors were encountered:
As per rasterio/rasterio#2675 (comment) the way we are creating COG's is not right.
Check correctness & measure efficiency of the current & suggested approach -- make necessary changes if required.
Code snippet as per above comment:
The text was updated successfully, but these errors were encountered: