Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.4 #72

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

v0.4 #72

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,47 @@ authors = ["michael catchen <michael.catchen@colorado.edu>"]
version = "0.2.1"

[deps]
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
Clustering = "aaaa29a8-35af-508c-8bc3-b662a17a0fe5"
DelaunayTriangulation = "927a84f5-c5f4-47a5-9785-b46e178433df"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
GeometryOps = "3251bfac-6a57-4b6d-aa61-ac1fef2975ab"
HaltonSequences = "13907d55-377f-55d6-a9d6-25ac19e11b95"
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MultivariateStats = "6f286f6a-111f-5878-ab1e-185364afe411"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
SimpleSDMLayers = "2c645270-77db-11e9-22c3-0f302a89c64c"
SliceMap = "82cb661a-3f19-5665-9e27-df437c7e54c8"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
SpeciesDistributionToolkit = "72b53823-5c0b-4575-ad0e-8e97227ad13b"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Term = "22787eb5-b846-44ae-b979-8e399b8463ab"
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"

[weakdeps]
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
NeutralLandscapes = "71847384-8354-4223-ac08-659a5128069f"

[extensions]
BONsMakieExt = "Makie"

[compat]
Clustering = "0.15.7"
DelaunayTriangulation = "1.6.3"
Distributions = "0.25"
GeoInterface = "1.4.0"
GeometryOps = "0.1.13"
HaltonSequences = "0.2"
HiGHS = "1.5"
JuMP = "1.11"
MultivariateStats = "0.10.3"
ProgressMeter = "1.7.2"
Requires = "1.3"
SliceMap = "0.2.7"
SpecialFunctions = "2.1"
SpeciesDistributionToolkit = "1.2.0"
StatsBase = "0.34"
julia = "1.9"
4 changes: 4 additions & 0 deletions _SCRATCH/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[deps]
BiodiversityObservationNetworks = "a5b868d3-191d-4bba-a38a-ad28190da010"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
GeoMakie = "db073c08-6b98-4ee5-b6a4-5efafb3259c6"
39 changes: 39 additions & 0 deletions _SCRATCH/scratchpad.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Pkg
Pkg.activate(@__DIR__)

using BiodiversityObservationNetworks
using CairoMakie, GeoMakie


import BiodiversityObservationNetworks as BONs
import BiodiversityObservationNetworks.SpeciesDistributionToolkit as SDT
import BiodiversityObservationNetworks.GeoInterface as GI
import BiodiversityObservationNetworks.GeometryOps as GO


col = SDT.gadm("COL")
col_states = SDT.gadm("COL", 1)

bioclim = RasterStack([SDT.mask!(SDT.SDMLayer(SDT.RasterData(SDT.WorldClim2, SDT.BioClim); layer=i, SDT.boundingbox(col)...), col) for i in 1:19])

bon = sample(SimpleRandom(50), bioclim)
bon = sample(SimpleRandom(10), col_states)
bon = sample(SpatiallyStratified(100), col_states)
bon = BONs.sample(Grid(), col)
bon = BONs.sample(KMeans(75), bioclim)


cornerplot(bioclim)



begin
f = Figure(size=(900,900))
ga = GeoAxis(f[1,1])
for (i,st) in enumerate(convert(Polygon, col_states))
poly!(ga, st.geometry, strokewidth=2, color=Symbol("grey", string(20+2*i)))
scatter!(ga, [node[1] for node in bon], [node[2] for node in bon], color=(:red))
end
f
end

2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using BiodiversityObservationNetworks
bib = CitationBibliography(joinpath(@__DIR__, "BONs.bib"))

makedocs(
sitename = "BiodiversityObservationNetwork.jl",
sitename = "BiodiversityObservationNetworks.jl",
authors = "Michael D. Catchen, Timothée Poisot, Kari Norman, Hana Mayall, Tom Malpas",
modules = [BiodiversityObservationNetworks],
format = DocumenterVitepress.MarkdownVitepress(
Expand Down
45 changes: 4 additions & 41 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,12 @@ The purpose of this package is to provide a high-level, extensible, modular
interface to the selection of sampling point for biodiversity processes in
space. It is based around a collection of types representing point selection
algorithms, used to select the most informative sampling points based on raster
data. Specifically, many algorithms work from a layer indicating *entropy* of a
model based prediction at each location.
data.

!!! warning "This package is in development"
The `BiodiversityObservationNetworks.jl` package is currently under development. The API is not expected to change a lot, but it may change in order to facilitate the integration of new features.

## High-level types

```@docs
BONSampler
BONSeeder
BONRefiner
```

## Seeder and refiner functions

```@docs
seed
seed!
```

```@docs
refine
refine!
```

## Seeder algorithms

```@docs
BalancedAcceptance
```

## Refiner algorithms

```@docs
AdaptiveSpatial
Uniqueness
```

## Helper functions

```@docs
squish
entropize!
entropize
```@autodocs
Modules = [BiodiversityObservationNetworks]
Order = [:type, :function]
```
34 changes: 0 additions & 34 deletions docs/src/vignettes/entropize.md

This file was deleted.

79 changes: 0 additions & 79 deletions docs/src/vignettes/overview.md

This file was deleted.

54 changes: 0 additions & 54 deletions docs/src/vignettes/uniqueness.md

This file was deleted.

13 changes: 13 additions & 0 deletions ext/BONsMakieExt/BONsMakieExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module BONsMakieExt

@info "Loading Makie Extension for BiodiversityObservationNetworks.jl..."

@static if isdefined(Base, :get_extension)
using Makie, BiodiversityObservationNetworks
else
using ..Makie, ..BiodiversityObservationNetworks
end

include(joinpath(@__DIR__, "recipes.jl"))

end
33 changes: 33 additions & 0 deletions ext/BONsMakieExt/recipes.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const MAX_CORNERPLOT_DIMS_BEFORE_PCA = 20

function BiodiversityObservationNetworks.cornerplot(
layers::RasterStack;
pca_layers = false
)

_, mat = BiodiversityObservationNetworks.features(layers)
num_layers = length(layers)
if num_layers > MAX_CORNERPLOT_DIMS_BEFORE_PCA || pca_layers
pca = BiodiversityObservationNetworks.MultivariateStats.fit(BiodiversityObservationNetworks.MultivariateStats.PCA, mat)
@info length(pca.prinvars)
num_layers = length(pca.prinvars)
mat = BiodiversityObservationNetworks.MultivariateStats.transform(pca, mat)
end

f = Figure(size=(900,900))
for i in 1:num_layers-1, j in 1:num_layers
if j > i
ax = Axis(
f[j-1,i],
xlabel = j == num_layers ? "$i" : "",
ylabel = i == 1 ? "$j" : "",
xticksvisible=false,
yticksvisible=false,
xticklabelsvisible=false,
yticklabelsvisible=false,
)
hexbin!(ax, mat[i,:], mat[j,:], bins=40)
end
end
f
end
4 changes: 0 additions & 4 deletions ext/SDTExt.jl

This file was deleted.

Loading
Loading