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

propose run udf on vector cube #200

Closed
wants to merge 1 commit into from
Closed

propose run udf on vector cube #200

wants to merge 1 commit into from

Conversation

jdries
Copy link
Contributor

@jdries jdries commented Jun 1, 2023

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':
Copy link
Member

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?

Copy link
Contributor Author

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
Copy link
Member

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

Copy link
Contributor Author

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
Copy link
Member

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

soxofaan added a commit that referenced this pull request Aug 2, 2023
soxofaan added a commit that referenced this pull request Aug 2, 2023
soxofaan added a commit that referenced this pull request Aug 2, 2023
- 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
soxofaan added a commit that referenced this pull request Aug 3, 2023
soxofaan added a commit that referenced this pull request Aug 3, 2023
- 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
soxofaan added a commit that referenced this pull request Aug 3, 2023
soxofaan added a commit that referenced this pull request Aug 3, 2023
soxofaan added a commit that referenced this pull request Aug 3, 2023
- 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
soxofaan added a commit that referenced this pull request Aug 3, 2023
aligns better with load_geojson spec
soxofaan added a commit that referenced this pull request Aug 3, 2023
aligns better with load_geojson spec
soxofaan added a commit that referenced this pull request Aug 3, 2023
soxofaan added a commit that referenced this pull request Aug 3, 2023
soxofaan added a commit that referenced this pull request Aug 3, 2023
@soxofaan
Copy link
Member

soxofaan commented Aug 3, 2023

I iterated further on this feature branch and merged in f83d1cf

@soxofaan soxofaan closed this Aug 3, 2023
@soxofaan soxofaan deleted the 437_udf_vectorcube branch August 3, 2023 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants