Skip to content

Commit

Permalink
Update changelog, docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
evetion committed Mar 31, 2023
1 parent d3561f8 commit 723f909
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.8.0] - 2023-03-27
## [0.8.0] - 2023-03-31
- Added `warp` for warping GeoArrays.
- Added `ranges` for returning the x and y `StepRange` of coordinates.
- Replaced `equals` with `Base.isequal` and made sure to compare the AffineMap only approximately to account for floating point precision.
- `coords(ga)` now returns an iterator. Apply `collect` on it for the old behaviour.
- `indices` now returns a `CartesianIndex` instead of `i, j`. Call `.I` on it for the old behaviour.
- `write` takes a bandnames keyword, which can be used to set the band description
- `metadata`, used in both reading and writing, has been added to a GeoArrays.

## [0.7.13] - 2023-01-12
- Added convert, affine!
Expand Down
26 changes: 14 additions & 12 deletions src/operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,19 @@ function Base.coalesce(ga::GeoArray{T,A}, v) where {T,A}
end

"""
warp(ga::GeoArray, resolution::Real;
crs::GeoFormat=crs(A),
method::String="near")
`warp` uses `ArchGDAL.gdalwarp` to warp an `GeoArray`.
warp(ga::GeoArray, options::Dict{String,Any}; dest="/vsimem/$(gensym())")
warp(ga::GeoArray, like::GeoArray, options::Dict{String,Any}; dest="/vsimem/$(gensym())")
## Arguments
- `A`: The `GeoArray` to warp.
- `resolution`: A `Number` specifying the resolution for the output. If the keyword argument `crs` (described below) is specified, `resolution` must be in units of the `crs`.
`warp` uses `ArchGDAL.gdalwarp` to warp an `GeoArray`. The `options` are passed to GDAL's `gdalwarp` command. See the [gdalwarp docs](https://gdal.org/programs/gdalwarp.html) for a complete list of options.
Another GeoArray `like` can be passed as the second argument to `warp` to use the `like`'s `crs`, `extent` and `size` as the `ga` crs and resolution.
The keyword `dest` is used to control where the temporary raster is stored. By default it is stored in memory, but can be set to a file path to directly save the warped GeoArray to disk.
## Keyword Arguments
- `crs`: A `GeoFormatTypes.GeoFormat` specifying an output crs (`A` with be reprojected to `crs` in addition to being warpd). Defaults to `crs(A)`
- `method`: A `String` specifying the method to use for resampling. Defaults to `"near"` (nearest neighbor resampling). See [resampling method](https://gdal.org/programs/gdalwarp.html#cmdoption-gdalwarp-r) in the gdalwarp docs for a complete list of possible values.
# Examples
```julia-repl
julia> ga = GeoArray(rand(100,100))
julia> epsg!(ga, 4326)
julia> ga2 = GeoArrays.warp(ga, Dict("t_srs" => "EPSG:4326+3855"))
```
"""
function warp(ga::GeoArray, options::Dict{String}, dest="/vsimem/$(gensym())")
dataset = ArchGDAL.Dataset(ga)
Expand All @@ -74,8 +75,8 @@ function warp(ga::GeoArray, options::Dict{String}, dest="/vsimem/$(gensym())")
end
end

function warp(ga::GeoArray, gao::GeoArray, options::Dict{String}=Dict{String,Any}(), dest="/vsimem/$(gensym())")
noptions = warpoptions(gao)
function warp(ga::GeoArray, like::GeoArray, options::Dict{String}=Dict{String,Any}(), dest="/vsimem/$(gensym())")
noptions = warpoptions(like)
warpdefaults!(noptions)
merge!(noptions, options)
warp(ga, noptions, dest)
Expand All @@ -93,4 +94,5 @@ end

function warpdefaults!(d::Dict)
get!(d, "wo", Dict("NUM_THREADS" => string(Threads.nthreads)))
get!(d, "multi", "")
end

2 comments on commit 723f909

@evetion
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

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/80710

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:

git tag -a v0.8.0 -m "<description of version>" 723f9099ff6a232e3149123b1825f610d5693bb2
git push origin v0.8.0

Please sign in to comment.