Hello,
I’m using wradlib for zonal statistics. I extract mean rainfall data from a radar image for a polygons (subbasins). Because my shapefile is quite large and not fully covered by the radar image, I would like to just open a subset of the shapefile, (defined by bounding box or shape) to save resources and time (I’m running thousands of cases on a HPC ).
I know that this partial opening of large shapefile is possible with geopandas/fiona (Reading and Writing Files — GeoPandas 0.12.2+0.gefcb367.dirty documentation) but is it also possible with wradlib Vector Source (gdal/ogr)?
wradlib.VectorSource can also take iterables as input: "sequence of source points (shape Nx2) or polygons (shape NxMx2) "
So another option would be to open the subset with geopandas and then convert it somehow to an iterable which is accepted by VectorSource as input.
I played around with this a little bit but I am not sure how exactly I can convert a geopandas Dataframe to the desired input format to create a VectorSource object with it.
Here, finally, my two questions:
- Can I open a subset of a large shapefile with VectorSource?
- How can I convert a geopandas Dataframe into a "sequence of source points (shape Nx2) or polygons (shape NxMx2) " as input to create a VectorSource object?
Looking forward for your ideas, thanks,
Paul