Open-EO / openeo-processes-dask

Python implementations of many OpenEO processes, dask-friendly by default.
Apache License 2.0
19 stars 14 forks source link

filter_bbox: No crs => error #214

Closed m-mohr closed 10 months ago

m-mohr commented 10 months ago

If I provide a bbox to filter_bbox without a CRS:

{
          "west": 16.1,
          "south": 48.1,
          "east": 16.6,
          "north": 48.6
}

I get an error:

Unexpected exception: 'dict' object has no attribute 'crs'

I guess parsing some datatypes in openeo-pg-parser-networkx is not ideal...

GeraldIr commented 10 months ago

Could you please provide the entire process graph.

m-mohr commented 10 months ago

I'm doing individual process tests for the test suite, so there's no full process graph. I'm directly accessing the filter_bbox process with the extent above and a xarray DataArray.

GeraldIr commented 10 months ago

So you're passing a dict directly to a function that is expecting a BoundingBox object?

m-mohr commented 10 months ago

Yes, I'm not using openeo-pg-parser-networkx. Am I expected to still import it although I'm not using the parser, just to use the BoundingBox class? I'm also not quite sure how I have to use the BoundingBox class. I thought if I pass a dict it would be converted automatically.

GeraldIr commented 10 months ago

I don't see why it would be converted automatically.

Also the parser is a direct dependency for the openeo-processes-dask library and BoundingBox gets imported regardless.

If you want to call the function directly you'll have to make a BoundingBox object like so:

from openeo_pg_parser_networkx.pg_schema import BoundingBox

bb = BoundingBox(**extent)

and then pass bb into the function.

m-mohr commented 10 months ago

Yeah, I guess the dependency on the parser is what bugs me.

Thanks for the example, doing that solves the issue for the test suite at least.