-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(sdt)!: zonal mosaic * doc: some more example * doc: show the top 10 districts * doc: example with more polygons * doc: map with polygons * doc: move around * doc: docstrings * doc: fix boxes * doc: update * doc: update * bug: GeoJSONT * feat: work with Feature and FeaturesCollection * feat: pass arguments to f in mosaic * docstring * feat: support for keyword args * doc: tutorial text update * doc: docstrings * doc: fix output
- Loading branch information
Showing
15 changed files
with
368 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Access GADM polygons | ||
|
||
The package come with a *very* lightweight series of convenience functions to | ||
interact with [GADM](https://gadm.org/). The [`GADM.jl` | ||
package](https://github.com/JuliaGeo/GADM.jl) is an alternative solution to the | ||
same problem. | ||
|
||
All methods assume that the first argument is an alpha-3 code valid under [ISO | ||
3166-1](https://www.iso.org/obp/ui/#search), and the following levels are | ||
sub-divisions of this territory. | ||
|
||
## Accessing polygons | ||
|
||
```@docs | ||
SpeciesDistributionToolkit.gadm | ||
``` | ||
|
||
## Listing polygons | ||
|
||
```@docs | ||
SpeciesDistributionToolkit.gadmlist | ||
``` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Documentation of integration functions | ||
|
||
These manual pages are focused on the functions integrating the different | ||
components of `SpeciesDistributionToolkit` together. | ||
|
||
The full docstrings for the different packages are in their own documentation | ||
webpages. | ||
|
||
::: details `GBIF.jl` | ||
|
||
A wrapper around the GBIF API, to retrieve taxa and occurrence datasets, and | ||
perform filtering on these occurrence data based on flags. | ||
|
||
[Read the documentation](https://poisotlab.github.io/SpeciesDistributionToolkit.jl/GBIF/) | ||
|
||
![GitHub Release](https://img.shields.io/github/v/release/poisotlab/speciesdistributiontoolkit.jl?filter=GBIF-*&style=flat-square&label=GBIF.jl) ![Lifecycle:Stable](https://img.shields.io/badge/Lifecycle-Stable-97ca00?style=flat-square) | ||
|
||
::: | ||
|
||
::: details `SimpleSDMDatasets.jl` | ||
|
||
An efficient way to download and store environmental raster data for consumption | ||
by other packages. | ||
|
||
[Read the documentation](https://poisotlab.github.io/SpeciesDistributionToolkit.jl/SimpleSDMDatasets/) | ||
|
||
![GitHub Release](https://img.shields.io/github/v/release/poisotlab/speciesdistributiontoolkit.jl?filter=SimpleSDMDatasets-*&style=flat-square&label=SimpleSDMDatasets.jl) ![Lifecycle:Stable](https://img.shields.io/badge/Lifecycle-Stable-97ca00?style=flat-square) | ||
|
||
::: | ||
|
||
|
||
::: details `SimpleSDMLayers.jl` | ||
|
||
A series of types and common operations on raster data. | ||
|
||
[Read the documentation](https://poisotlab.github.io/SpeciesDistributionToolkit.jl/SimpleSDMLayers/) | ||
|
||
![GitHub Release](https://img.shields.io/github/v/release/poisotlab/speciesdistributiontoolkit.jl?filter=SimpleSDMLayers-*&style=flat-square&label=SimpleSDMLayers.jl) ![Lifecycle:Maturing](https://img.shields.io/badge/Lifecycle-Maturing-007EC6?style=flat-square) | ||
|
||
::: | ||
|
||
::: details `Fauxcurrences.jl` | ||
|
||
A package to simulate realistic species occurrence data from a know series of | ||
occurrences, with additional statistical constraints. | ||
|
||
[Read the documentation](https://poisotlab.github.io/SpeciesDistributionToolkit.jl/Fauxcurrences/) | ||
|
||
![GitHub Release](https://img.shields.io/github/v/release/poisotlab/speciesdistributiontoolkit.jl?filter=Fauxcurrences-*&style=flat-square&label=Fauxcurrences.jl) ![Lifecycle:Maturing](https://img.shields.io/badge/Lifecycle-Maturing-007EC6?style=flat-square) | ||
|
||
::: | ||
|
||
|
||
::: details `Phylopic.jl` | ||
|
||
A wrapper around the Phylopic API. | ||
|
||
[Read the documentation](https://poisotlab.github.io/SpeciesDistributionToolkit.jl/Phylopic/) | ||
|
||
![GitHub Release](https://img.shields.io/github/v/release/poisotlab/speciesdistributiontoolkit.jl?filter=Phylopic-*&style=flat-square&label=Phylopic.jl) ![Lifecycle:Stable](https://img.shields.io/badge/Lifecycle-Stable-97ca00?style=flat-square) | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Working with polygons | ||
|
||
The package assumes that the polygons are read using [the `GeoJSON.jl` | ||
package](https://github.com/JuliaGeo/GeoJSON.jl). As per | ||
[RFC7946](https://datatracker.ietf.org/doc/html/rfc7946), the coordinates in the | ||
polygon are assumed to be WGS84. | ||
|
||
## Masking | ||
|
||
```@docs | ||
mask! | ||
mask | ||
``` | ||
|
||
## Trimming | ||
|
||
```@docs | ||
trim | ||
``` | ||
|
||
## Mosaic and zonal-like operations | ||
|
||
```@docs | ||
mosaic | ||
zone | ||
byzone | ||
``` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# # Zonal statistics | ||
|
||
# In this tutorial, we will | ||
|
||
using SpeciesDistributionToolkit | ||
using Statistics | ||
using CairoMakie | ||
CairoMakie.activate!(; type = "png", px_per_unit = 3.0) #hide | ||
|
||
#- | ||
|
||
spatial_extent = (left = 165.739746, bottom = -47.587547, right = 180.812988, top = -33.649514) | ||
|
||
#- | ||
|
||
dataprovider = RasterData(CHELSA2, BioClim) | ||
|
||
# precipitation of coldest quarter | ||
|
||
layer = SDMLayer(dataprovider; layer = "BIO19", spatial_extent...) | ||
|
||
#- | ||
|
||
mask!(layer, SpeciesDistributionToolkit.gadm("NZL")) | ||
layer = trim(layer) | ||
heatmap(layer; axis=(; aspect=DataAspect())) | ||
|
||
#- | ||
|
||
districts = SpeciesDistributionToolkit.gadm("NZL", 2); | ||
|
||
# We can start looking at how these map onto the landscape: | ||
|
||
heatmap(zone(layer, districts); colormap=:hokusai, axis=(; aspect=DataAspect())) | ||
|
||
# The layer resulting from the `zone` operation has integer values, and the | ||
# values correspond to the polygon to which each pixel belongs. Note that the | ||
# pixels that are not within a polygon are turned off. | ||
|
||
z = mosaic(median, layer, districts) | ||
nodata!(z, 0.0) | ||
|
||
#- | ||
|
||
heatmap(z; axis=(; aspect=DataAspect())) | ||
|
||
#- | ||
|
||
districtnames = SpeciesDistributionToolkit.gadmlist("NZL", 2) | ||
districtnames[1:10] | ||
|
||
#- | ||
|
||
top5 = first.(sort(byzone(median, layer, districts, districtnames); by=(x) -> x.second, rev=true)[1:5]) | ||
|
||
#- | ||
|
||
f, ax, plt = heatmap(layer; axis=(; aspect=DataAspect()), colormap=[:lightgrey, :black]) | ||
[lines!(ax, districts[i], label=districtnames[i], linewidth=3) for i in indexin(top5, districtnames)] | ||
axislegend(position=(0, 0.7), nbanks=1) | ||
hidedecorations!(ax) #hide | ||
hidespines!(ax) #hide | ||
current_figure() #hide | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.