Re: Serializing and deserializing rasterio object


Sean Gillies
 

Hi,

On Mon, Sep 16, 2019 at 5:36 AM Juliano <juliano.ecc@...> wrote:
Hi all
Is there an easy way to serialize and deserialize rasterio object?
Thanks!

Do you mean a dataset object returned by rasterio.open()? We have left them not pickleable for the same reason Python file objects aren't pickleable: in the implementation there is an OS file descriptor (or several) that isn't serializable.

As an approximation, you could could save the dataset's filename or URL (its .name attribute) and the creation or opening options (in its .options attribute) and then call rasterio.open() when you want to "deserialize".
 
--
Sean Gillies

Join main@rasterio.groups.io to automatically receive all group messages.