-
Hey all, I have a In an ideal world I'd use import json
import geopandas as gpd
import numpy as np
from geocube.api.core import make_geocube
from shapely.geometry import box, mapping, Point
# global bounding box
bbox = (-180, -90, 180, 90)
# some random points
points = [Point(np.random.uniform(-180, 180), np.random.uniform(-90, 90)) for _ in range(1000)]
# some random data values
data = np.random.rand(1000)
# create GeoDataFrame
gdf = gpd.GeoDataFrame({'data': data}, geometry=points, crs='EPSG:4326')
grid = make_geocube(
vector_data=gdf,
measurements=[column],
resolution=(-0.5, 0.5),
geom=json.dumps(mapping(box(*bbox))),
) The problem here, if I understand correctly, is that Is there a way to easily implement a custom AVERAGE merge algorithm in this case, or will I need to do it all manually, e.g. with rioxarray or other tools? And in case I'm missing something, is there another built-in method |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I am not aware of any. However, as a workaround, you could use |
Beta Was this translation helpful? Give feedback.
I am not aware of any. However, as a workaround, you could use
ADD
and rasterize two vectors. One with the values and a duplicate with a1
replacing the values. Then, divide the raster with values by the raster generated by the vector filled with ones.