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

GeoImage.open doesn't seem to follow docs #171

Open
ra-tolson opened this issue Sep 13, 2019 · 1 comment
Open

GeoImage.open doesn't seem to follow docs #171

ra-tolson opened this issue Sep 13, 2019 · 1 comment

Comments

@ra-tolson
Copy link

Looks like either the API has drifted or else the docs need updating. The docs say you can go:

geoimg = GeoImage.open(filename, bandnames=(['red', 'green', 'blue']), nodata=0)

But when I try it it looks like it's iterating over the filename's characters:

(Pdb) gippy.GeoImage.open('foo.tif')
*** RuntimeError: 4: f: No such file or directory

I can workaround with a list though:

(Pdb) gippy.GeoImage.open(['foo.tif'])
*** RuntimeError: 4: foo.tif: No such file or directory

The reason I'd like to call GeoImage.open() over GeoImage() is that with the former I can set nodata & gain as part of the call; I don't see how to do that with GeoImage().

@matthewhanson
Copy link
Member

Yes, it looks like the docs are wrong. GeoImage.open accepts a list of filenames. If you provide a string it iterates over it like it was a list, which returns the individual characters.

It's true you can't set those parameters with the normal constructor. It's because the regular constructor essentially opens up the dataset as GDAL does it, whereas the nodata and gain are set after the dataset is open, so that is in the higher-level convenience function GeoImage.open.

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

2 participants