Skip to content

Commit

Permalink
Fix rds ambiguity (#874)
Browse files Browse the repository at this point in the history
* fix ambiguity in rds Raster

* add Aqua for extensions

* add Makie to test targets
  • Loading branch information
rafaqz authored Jan 28, 2025
1 parent 4cff5f0 commit 180d676
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
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

0 comments on commit 180d676

Please sign in to comment.