Skip to content

Commit 180d676

Browse files
authored
Fix rds ambiguity (#874)
* fix ambiguity in rds Raster * add Aqua for extensions * add Makie to test targets
1 parent 4cff5f0 commit 180d676

File tree

3 files changed

+40
-5
lines changed

3 files changed

+40
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,4 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
111111
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
112112

113113
[targets]
114-
test = ["Aqua", "ArchGDAL", "CFTime", "CoordinateTransformations", "DataFrames", "GeoDataFrames", "GeometryBasics", "GRIBDatasets", "NCDatasets", "Plots", "Proj", "RasterDataSources", "SafeTestsets", "Shapefile", "StableRNGs", "StatsBase", "Test", "ZarrDatasets"]
114+
test = ["Aqua", "ArchGDAL", "CFTime", "CoordinateTransformations", "DataFrames", "GeoDataFrames", "GeometryBasics", "GRIBDatasets", "Makie", "NCDatasets", "Plots", "Proj", "RasterDataSources", "SafeTestsets", "Shapefile", "StableRNGs", "StatsBase", "Test", "ZarrDatasets"]

ext/RastersRasterDataSourcesExt/constructors.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,23 @@ See the docs for
2121
[`RasterDatasources.getraster`](http://docs.ecojulia.org/RasterDataSources.jl/stable/#getraster)
2222
for more specific details about data sources, layers and keyword arguments.
2323
"""
24-
function RA.Raster(T::Type{<:RDS.RasterDataSource}, layer; crs=_source_crs(T), kw...)
24+
function RA.Raster(T::Type{<:RDS.RasterDataSource}, layer::Union{Symbol,Int};
25+
crs=_source_crs(T), kw...
26+
)
2527
rds_kw, ra_kw = _filterkw(T, kw)
2628
filename = getraster(T, layer; rds_kw...)
2729
Raster(filename; name=RDS.layerkeys(T, layer), crs, ra_kw...)
2830
end
29-
function RA.Raster(T::Type{<:WorldClim{<:Future{BioClim, CMIP6}}}; crs=_source_crs(T), kw...)
31+
function RA.Raster(T::Type{<:WorldClim{<:Future{BioClim, CMIP6}}};
32+
crs=_source_crs(T), kw...
33+
)
3034
rds_kw, ra_kw = _filterkw(T, kw)
3135
filename = getraster(T; rds_kw...)
3236
Raster(filename; crs, ra_kw...)
3337
end
34-
function RA.Raster(T::Type{<:WorldClim{<:Future{BioClim, CMIP6}}}, layer; crs=_source_crs(T), lazy = false, kw...)
38+
function RA.Raster(T::Type{<:WorldClim{<:Future{BioClim, CMIP6}}}, layer::Union{Symbol,Int};
39+
crs=_source_crs(T), lazy = false, kw...
40+
)
3541
rds_kw, ra_kw = _filterkw(T, kw)
3642
filename = getraster(T, layer; rds_kw...)
3743
ras_all = Raster(filename; name=RDS.bioclim_key(layer), crs, ra_kw...)

test/runtests.jl

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,33 @@ if !haskey(ENV, "CI")
4242
@time @safetestset "rasterdatasources" begin include("sources/rasterdatasources.jl") end
4343
end
4444
@time @safetestset "plot recipes" begin include("plotrecipes.jl") end
45-
@time @safetestset "resample" begin include("resample.jl") end
45+
@time @safetestset "resample" begin include("resample.jl") end
46+
47+
using ArchGDAL
48+
using CoordinateTransformations
49+
using GRIBDatasets
50+
using Makie
51+
using NCDatasets
52+
using Proj
53+
using RasterDataSources
54+
using StatsBase
55+
using ZarrDatasets
56+
57+
@testset "extensions Aqua" begin
58+
for name in [
59+
:RastersArchGDALExt,
60+
:RastersCoordinateTransformationsExt,
61+
:RastersGRIBDatasetsExt,
62+
# :RastersMakieExt, TODO lots of ambiguities
63+
:RastersNCDatasetsExt,
64+
:RastersProjExt,
65+
:RastersRasterDataSourcesExt,
66+
:RastersStatsBaseExt,
67+
:RastersZarrDatasetsExt,
68+
]
69+
ext = Base.get_extension(Rasters, name)
70+
Aqua.test_ambiguities(ext)
71+
Aqua.test_unbound_args(ext)
72+
Aqua.test_undefined_exports(ext)
73+
end
74+
end

0 commit comments

Comments
 (0)