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

Urban Nature Access crashes with cryptic type error #1350

Closed
phargogh opened this issue Jul 20, 2023 · 1 comment · Fixed by #1390
Closed

Urban Nature Access crashes with cryptic type error #1350

phargogh opened this issue Jul 20, 2023 · 1 comment · Fixed by #1390
Assignees
Labels
bug Something isn't working in progress This issue is actively being worked on

Comments

@phargogh
Copy link
Member

A user on the forums reported an interesting GDAL-land TypeError:

2023-06-22 12:16:47,682 (taskgraph.Task) Task.add_task(706) ERROR Something went wrong when adding task Aggregate supply-demand to admin units (single rasters) (16), terminating taskgraph.
Traceback (most recent call last):
  File "taskgraph\Task.py", line 674, in add_task
  File "taskgraph\Task.py", line 1093, in _call
  File "natcap\invest\urban_nature_access.py", line 1981, in _supply_demand_vector_for_single_raster_modes
  File "natcap\invest\urban_nature_access.py", line 2018, in _write_supply_demand_vector
  File "osgeo\ogr.py", line 4392, in SetField
TypeError: Wrong number or type of arguments for overloaded function 'Feature_SetField'.
  Possible C/C++ prototypes are:
    OGRFeatureShadow::SetField(int,char const *)
    OGRFeatureShadow::SetField(char const *,char const *)
    OGRFeatureShadow::SetField(int,double)
    OGRFeatureShadow::SetField(char const *,double)
    OGRFeatureShadow::SetField(int,int,int,int,int,int,float,int)
    OGRFeatureShadow::SetField(char const *,int,int,int,int,int,float,int)

This is curious because I sent him a dev build and the numerical values look fine. I've requested his data to dig into it.

@phargogh phargogh added bug Something isn't working in progress This issue is actively being worked on labels Jul 20, 2023
@phargogh phargogh self-assigned this Jul 20, 2023
@phargogh
Copy link
Member Author

I confirmed with the user that casting the value to a float before setting the value in the field resolved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in progress This issue is actively being worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant