Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot save mutable Georaster after changes #257

Open
AmitAronovitch opened this issue Sep 8, 2019 · 0 comments
Open

cannot save mutable Georaster after changes #257

AmitAronovitch opened this issue Sep 8, 2019 · 0 comments

Comments

@AmitAronovitch
Copy link
Contributor

Typical usecase for mutable georaster is for chaning properties of existing rasters:

raster=GeoRaster2.open(path, mutable=True)
raster.affine = new_affine
raster.save(path)

However, this fails with the following

telluric.georaster.GeoRaster2IOError: /tmp/tmpr3uk6ttb/overlap2.tif and /tmp/tmpr3uk6ttb/overlap2.tif identify the same dataset.

Note that this is only because of the lazy loading. If you add lazy_load=False to the open call above, everything works fine.

Possible remedies:

  1. On save, if output path is equal to input and lazy_loaded: load before saving (instead of trying to copy to self)
  2. On save, if it is a mutable raster, then load before saving
  3. In open(), if mutable=True, then the default for lazy_load becomes True instead of False

(3) is easiest to implement, (1) may be more general, both may have confusing edge cases. Any opinions?

AmitAronovitch pushed a commit that referenced this issue Sep 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant