TUDelftGeodesy / stmtools

Xarray extension for Space-Time Matrix
https://tudelftgeodesy.github.io/stmtools/
Apache License 2.0
7 stars 0 forks source link

Space-Time matrix query from polygon fields #3

Closed rogerkuou closed 1 year ago

rogerkuou commented 2 years ago

Define a member function of class SpaceTimeMatrix, which queries the a field from a Polygon file with the coordinates of each point, then returns the query results as a new data variable.

Expected result:


import geopandas as gpd
import xarray as xr
import stmat

# Read polygon
polygon = gdp.read_file('example_polygon.shp')

# Initiate a dataset, ds contains both data and coordinates
ds = xr.Dataset(...)

# This will add a new data variable "field_name_str" to ds
ds = ds.stm.query_polygon(polygon, "field_name_str")
rogerkuou commented 2 years ago

Useful links:

rogerkuou commented 1 year ago

The notebook Meiert made already gave a good example of querying using pygeo

The next step should be integrating the geom_enrich function in the notebook to STM