Skip to content

GO.difference bug report #335

@gaelforget

Description

@gaelforget

In Climatology.jl we use GO.difference to calculate overlaps and differences between regions where sea surface temperature exceeds certain thresholds (see Marine Heat Waves).

However, we find that the behavior of GO.difference is not robust. In some cases it works but other times it errors out for no obvious reason. As long as that is the case, I cannot recommend adopting this method for tracking heatwaves.

Help would be greatly appreciated. Is this a well known bug? Is there hope it could be fixed quickly?

Code to reproduce error :

  1. setup
using Climatology, NCDatasets, CairoMakie
import GeometryOps as GO
import GeoInterface as GI

begin
    path_OISST_stats=Climatology.downloads.OISST_stats_download()
	file_climatology=joinpath(path_OISST_stats,"OISST_mean_monthly_1992_2011.nc")

    input_path=joinpath(tempdir(),"sst_dev")
    files_list=SST_processing.download_files(path=input_path,short_demo=true)
    file_sst=joinpath(input_path,"202509","oisst-avhrr-v02r01.20250915_preliminary.nc")
    sst_anom=SST_FILES.read_map(variable="anom_recompute",file=file_sst,file_climatology=file_climatology)
end

begin
	var0=deepcopy(sst_anom); var0[ismissing.(var0)].=NaN
	
	min0=2.0; max0=Inf; min1=1.0
	pol0=GO.polygonize(0.125:0.25:359.875,-89.875:0.25:89.875, min0 .< var0 .< max0)
	pol1=GO.polygonize(0.125:0.25:359.875,-89.875:0.25:89.875, min1 .< var0 .< max0)
end

begin
    i0=9 ; i1=2;
    plot(pol1); plot!(pol0);
    p1_geom=GI.getgeom(pol1)[i1];
    p0_geom=GI.getgeom(pol0)[i0];
    plot!(p1_geom); plot!(p0_geom)
    current_figure()
end

should create the following plot

Image

2. to reproduce error

GO.difference(p1_geom, p0_geom; target = GI.PolygonTrait())

3. error message

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions