This repository has been archived by the owner on Dec 11, 2022. It is now read-only.
-
-
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.
Merge pull request #19 from EcoJulia/fix/syntax
Update the syntax internally to be more consistent
- Loading branch information
Showing
8 changed files
with
132 additions
and
105 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "SimpleSDMLayers" | ||
uuid = "2c645270-77db-11e9-22c3-0f302a89c64c" | ||
authors = ["Timothée Poisot <[email protected]>"] | ||
version = "0.2.1" | ||
version = "0.2.2" | ||
|
||
[deps] | ||
GDAL = "add2ef01-049f-52c4-9ee2-e494f65e021a" | ||
|
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 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 |
---|---|---|
@@ -1,29 +1,37 @@ | ||
""" | ||
latitudes(p::T) where {T <: SimpleSDMLayer} | ||
latitudes(layer::T) where {T <: SimpleSDMLayer} | ||
Returns an iterator with the latitudes of the SDM layer passed as its argument. | ||
This returns the latitude at the center of each cell in the grid. | ||
""" | ||
function latitudes(p::T) where {T <: SimpleSDMLayer} | ||
grid_size = stride(p; dims=2) | ||
centers = range(p.bottom+grid_size; stop=p.top-grid_size, length=size(p, 1)) | ||
function latitudes(layer::T) where {T <: SimpleSDMLayer} | ||
grid_size = stride(layer; dims=2) | ||
centers = range(layer.bottom+grid_size; stop=layer.top-grid_size, length=size(layer, 1)) | ||
return centers | ||
end | ||
|
||
""" | ||
longitudes(p::T) where {T <: SimpleSDMLayer} | ||
longitudes(layer::T) where {T <: SimpleSDMLayer} | ||
Returns an iterator with the longitudes of the SDM layer passed as its argument. | ||
This returns the longitudes at the center of each cell in the grid. | ||
""" | ||
function longitudes(p::T) where {T <: SimpleSDMLayer} | ||
grid_size = stride(p; dims=1) | ||
centers = range(p.left+grid_size; stop=p.right-grid_size, length=size(p, 2)) | ||
function longitudes(layer::T) where {T <: SimpleSDMLayer} | ||
grid_size = stride(layer; dims=1) | ||
centers = range(layer.left+grid_size; stop=layer.right-grid_size, length=size(layer, 2)) | ||
return centers | ||
end | ||
|
||
function are_compatible(l1::FT, l2::ST) where {FT <: SimpleSDMLayer, ST <: SimpleSDMLayer} | ||
@assert size(l1) == size(l2) | ||
@assert l1.top == l2.top | ||
@assert l1.left == l2.left | ||
@assert l1.bottom == l2.bottom | ||
@assert l1.right == l2.right | ||
""" | ||
_layers_are_compatible(l1::X, l2::Y) where {X <: SimpleSDMLayer, Y <: SimpleSDMLayer} | ||
This returns | ||
""" | ||
function _layers_are_compatible(l1::X, l2::Y) where {X <: SimpleSDMLayer, Y <: SimpleSDMLayer} | ||
size(l1) == size(l2) || throw(ArgumentError("The layers have different sizes")) | ||
l1.top == l2.top || throw(ArgumentError("The layers have different top coordinates")) | ||
l1.left == l2.left || throw(ArgumentError("The layers have different left coordinates")) | ||
l1.bottom == l2.bottom || throw(ArgumentError("The layers have different bottom coordinates")) | ||
l1.right == l2.right || throw(ArgumentError("The layers have different right coordinates")) | ||
end |
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.
4cf7818
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
4cf7818
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/12711
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: