PoisotLab / SimpleSDMLayers.jl

Simple layers for species distribution modeling and bioclimatic data
https://docs.ecojulia.org/SimpleSDMLayers.jl/stable/
MIT License
19 stars 2 forks source link

Occupancy mask #60

Closed gottacatchenall closed 3 years ago

gottacatchenall commented 3 years ago

expanding on #59

one thing i found myself needing is wanting to create a SDMLayer that contained 1 at all locations with given occurrence data, and 0 elsewhere. the not optimized example i have is

getOccupancyLayer(envLayer::SimpleSDMPredictor, occupancy) = begin
    occLayer = similar(envLayer)
    for o in occupancy
        long,lat = longitude(o), latitude(o) 
        occLayer[long,lat] = convert(eltype(occLayer), 1)
    end
    occLayer
end
tpoisot commented 3 years ago

wouldn't it be more julianesque to convert a GBIFRecords to a layer storing AbstractBool? I've been meaning to do this for a while now.

tpoisot commented 3 years ago

I settled on using mask, which can either do presence/absence or do a cumulative count of occurrences in a cell -- see #65

gottacatchenall commented 3 years ago

think this is closed as a product of #65