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

add gdal.UseExceptions() to invest-exported python scripts #1702

Open
davemfish opened this issue Dec 4, 2024 · 2 comments
Open

add gdal.UseExceptions() to invest-exported python scripts #1702

davemfish opened this issue Dec 4, 2024 · 2 comments
Labels
good first issue Good for new members of the software team task Something needs to be done

Comments

@davemfish
Copy link
Contributor

Now that invest issues a FutureWarning about using gdal.UseExcpetions(), scripts that invest generates through the Workbench and CLI should probably include that as part of the boilerplate. It seems like it needs to be called before the natcap.invest import to avoid the warning.

As a tangent, I wonder if import time is the best place to issue that FutureWarning. It kind of forces everyone to see it, which is good, but I also might already intend to call gdal.UseExceptions() in my script, I just haven't done it yet because I'm following PEP8 guidelines and doing all my imports first. In that case I don't really want to see the warning everytime.

@davemfish davemfish added the task Something needs to be done label Dec 4, 2024
@emlys
Copy link
Member

emlys commented Dec 9, 2024

I'd be fine with removing the warning, if it's too bothersome. GDAL implemented their similar warning by placing it at the start of a bunch of common functions (OpenEx, ReadArray, etc.) but I don't think that approach is very practical for us

@davemfish
Copy link
Contributor Author

That's interesting. Maybe the CLI or utils.prepare_workspace would be a good place for the warning. That could at least cover all the calls to execute.

@davemfish davemfish added the good first issue Good for new members of the software team label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for new members of the software team task Something needs to be done
Projects
None yet
Development

No branches or pull requests

2 participants