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

Fix rds ambiguity #874

Merged
merged 3 commits into from
Jan 28, 2025
Merged
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "ArchGDAL", "CFTime", "CoordinateTransformations", "DataFrames", "GeoDataFrames", "GeometryBasics", "GRIBDatasets", "NCDatasets", "Plots", "Proj", "RasterDataSources", "SafeTestsets", "Shapefile", "StableRNGs", "StatsBase", "Test", "ZarrDatasets"]
test = ["Aqua", "ArchGDAL", "CFTime", "CoordinateTransformations", "DataFrames", "GeoDataFrames", "GeometryBasics", "GRIBDatasets", "Makie", "NCDatasets", "Plots", "Proj", "RasterDataSources", "SafeTestsets", "Shapefile", "StableRNGs", "StatsBase", "Test", "ZarrDatasets"]
12 changes: 9 additions & 3 deletions ext/RastersRasterDataSourcesExt/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,23 @@ See the docs for
[`RasterDatasources.getraster`](http://docs.ecojulia.org/RasterDataSources.jl/stable/#getraster)
for more specific details about data sources, layers and keyword arguments.
"""
function RA.Raster(T::Type{<:RDS.RasterDataSource}, layer; crs=_source_crs(T), kw...)
function RA.Raster(T::Type{<:RDS.RasterDataSource}, layer::Union{Symbol,Int};
crs=_source_crs(T), kw...
)
rds_kw, ra_kw = _filterkw(T, kw)
filename = getraster(T, layer; rds_kw...)
Raster(filename; name=RDS.layerkeys(T, layer), crs, ra_kw...)
end
function RA.Raster(T::Type{<:WorldClim{<:Future{BioClim, CMIP6}}}; crs=_source_crs(T), kw...)
function RA.Raster(T::Type{<:WorldClim{<:Future{BioClim, CMIP6}}};
crs=_source_crs(T), kw...
)
rds_kw, ra_kw = _filterkw(T, kw)
filename = getraster(T; rds_kw...)
Raster(filename; crs, ra_kw...)
end
function RA.Raster(T::Type{<:WorldClim{<:Future{BioClim, CMIP6}}}, layer; crs=_source_crs(T), lazy = false, kw...)
function RA.Raster(T::Type{<:WorldClim{<:Future{BioClim, CMIP6}}}, layer::Union{Symbol,Int};
crs=_source_crs(T), lazy = false, kw...
)
rds_kw, ra_kw = _filterkw(T, kw)
filename = getraster(T, layer; rds_kw...)
ras_all = Raster(filename; name=RDS.bioclim_key(layer), crs, ra_kw...)
Expand Down
31 changes: 30 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,33 @@ if !haskey(ENV, "CI")
@time @safetestset "rasterdatasources" begin include("sources/rasterdatasources.jl") end
end
@time @safetestset "plot recipes" begin include("plotrecipes.jl") end
@time @safetestset "resample" begin include("resample.jl") end
@time @safetestset "resample" begin include("resample.jl") end

using ArchGDAL
using CoordinateTransformations
using GRIBDatasets
using Makie
using NCDatasets
using Proj
using RasterDataSources
using StatsBase
using ZarrDatasets

@testset "extensions Aqua" begin
for name in [
:RastersArchGDALExt,
:RastersCoordinateTransformationsExt,
:RastersGRIBDatasetsExt,
# :RastersMakieExt, TODO lots of ambiguities
:RastersNCDatasetsExt,
:RastersProjExt,
:RastersRasterDataSourcesExt,
:RastersStatsBaseExt,
:RastersZarrDatasetsExt,
]
ext = Base.get_extension(Rasters, name)
Aqua.test_ambiguities(ext)
Aqua.test_unbound_args(ext)
Aqua.test_undefined_exports(ext)
end
end
Loading