-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Description
In src/regridder/intersection_areas.jl:35, the _area_criterion function for Extents.Extent (used with Planar grids) explicitly throws an error:
_area_criterion(cap::Extents.Extent) = error("Area criterion for multithreading has to be customizable, for 2D planar extents - this needs to be implemented!")This means using threaded=true (the default) with Planar grids will always fail once the multithreaded dual DFS calls _area_criterion on the tree node extents.
The Spherical path has a working implementation for SphericalCap on line 34.
Note: reproducing this in isolation requires first fixing #65 (the mapreduce argument swap), since tree construction fails before reaching the threading code path.
MWE
using ConservativeRegridding
using GeoInterface
using GeometryOpsCore
using Extents
function make_grid(nx, ny)
polys = Matrix{GeoInterface.Polygon}(undef, nx, ny)
for j in 1:ny, i in 1:nx
x0, x1 = (i-1)/nx, i/nx
y0, y1 = (j-1)/ny, j/ny
ring = GeoInterface.LinearRing([(x0,y0),(x1,y0),(x1,y1),(x0,y1),(x0,y0)])
polys[i,j] = GeoInterface.Polygon([ring])
end
polys
end
src_grid = make_grid(2, 2)
dst_grid = make_grid(3, 3)
# First, fix bug #65 so we can reach the threading code path:
@eval function ConservativeRegridding.Trees.cell_range_extent(
q::ConservativeRegridding.Trees.ExplicitPolygonGrid{<:GeometryOpsCore.Planar},
irange::UnitRange{Int}, jrange::UnitRange{Int},
)
return mapreduce(
GeoInterface.extent, Extents.union,
(ConservativeRegridding.Trees.getcell(q, i, j) for i in irange, j in jrange),
)
end
# This errors with: "Area criterion for multithreading has to be customizable..."
r = ConservativeRegridding.Regridder(GeometryOpsCore.Planar(), dst_grid, src_grid; threaded=true)Error
ErrorException: Area criterion for multithreading has to be customizable, for 2D planar extents - this needs to be implemented!
Workaround
Use threaded=false:
r = ConservativeRegridding.Regridder(GeometryOpsCore.Planar(), dst_grid, src_grid; threaded=false)Version
ConservativeRegridding v0.2.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels