0

A mean for a month of sentinel 2 data was created for 8 different bands.

I want to write and download this image into a geotiff. But this code doesn't seem to work.

# Compute a single mean from all data
ds_mean = ds.mean('time')

from datacube.utils.cog import write_cog

rgb_tiff = ds_mean.to_array()

write_cog(rgb_tiff,
          fname='mean.tif',
          overwrite=True) 
2
  • 1
    Why do you think it is not working?
    – Padmanabha
    Jun 12 at 10:41
  • My kernel is crashing when writing, I'm think that it needs to specify the specific time
    – Colette
    Jun 12 at 10:48

1 Answer 1

1

How large, in pixels, is your x and y dimensions? And how large is your compute environment? Often the kernel crashing means you've exceeded RAM. And write_cog is very memory intensive (1.5-2 times the size of the file) as it produces overview images. See here

1
  • Yes I think that might be it. I think the y: 8673, x: 9466. So I'm trying to use the Lazy loading with Dask now to see if I can reduce the amount of memory needed
    – Colette
    Jun 14 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.