-
Notifications
You must be signed in to change notification settings - Fork 6
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
propose run udf on vector cube #200
Conversation
context: Optional[dict] = None, | ||
env: EvalEnv, | ||
) -> "DriverVectorCube": | ||
if dimension == "bands" and target_dimension == None and len(process) == 1 and next(iter(process.values())).get('process_id') == 'run_udf': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this check for the "geometries" dimension instead of the "bands" dimension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought so too at first, but when you want to run a udf for each feature, and get all its properties, then the dimension you are working on is "bands" I guess?
from openeo.udf import FeatureCollection, UdfData | ||
collection = FeatureCollection(id='VectorCollection', data=self._as_geopandas_df()) | ||
data = UdfData( | ||
proj={"EPSG": self._geometries.crs.to_epsg()}, feature_collection_list=[collection], user_context=context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only the vector data (labels along geometry dimension) is passed here as feature collection, but the vector cube might also contain actual data cube values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at _as_geopandas_df, I have the impression that it does merge the geometries with the datacube values?
I'm only a bit worried about from_geojson, which does not seem to extract any property values into cube values, but that's maybe not relevant to what I try to solve here.
from openeo_driver.datastructs import SarBackscatterArgs, ResolutionMergeArgs, StacAsset | ||
from openeo_driver.errors import FeatureUnsupportedException, InternalException | ||
from openeo_driver.util.geometry import GeometryBufferer, validate_geojson_coordinates | ||
from openeo_driver.util.ioformats import IOFORMATS | ||
from openeo_driver.util.utm import area_in_square_meters | ||
from openeo_driver.utils import EvalEnv | ||
from openeogeotrellis.backend import SingleNodeUDFProcessGraphVisitor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to build unit test for this feature: but failed on this:
import of geopyspark-driver in python driver code is not going to work
- flattening: move options to export phase iso vector cube constructor - introduce `VectorCube.from_geodataframe` wiith support for promoting selected columns to cube values - regardless of promotion: all properties are still associated with `VectorCube.geometries` for now (otherwise properties can not be preserved when using `aggregate_spatial`, see Open-EO/openeo-api#504) - only promote numerical values by default for now
- flattening: move options to export phase iso vector cube constructor - introduce `VectorCube.from_geodataframe` wiith support for promoting selected columns to cube values - regardless of promotion: all properties are still associated with `VectorCube.geometries` for now (otherwise properties can not be preserved when using `aggregate_spatial`, see Open-EO/openeo-api#504) - only promote numerical values by default for now
- flattening: move options to export phase iso vector cube constructor - introduce `VectorCube.from_geodataframe` wiith support for promoting selected columns to cube values - regardless of promotion: all properties are still associated with `VectorCube.geometries` for now (otherwise properties can not be preserved when using `aggregate_spatial`, see Open-EO/openeo-api#504) - only promote numerical values by default for now
aligns better with load_geojson spec
aligns better with load_geojson spec
I iterated further on this feature branch and merged in f83d1cf |
Open-EO/openeo-geopyspark-driver#437