From dbee0ef18f09bf7c3215b030607c0e3efe0c78a3 Mon Sep 17 00:00:00 2001 From: Maarten Pronk Date: Sat, 14 Oct 2023 14:42:18 +0200 Subject: [PATCH 1/3] Upgrade GeoStatsBase compat and fix interpolation. --- Project.toml | 6 +++--- src/interpolate.jl | 2 +- test/test_crs.jl | 2 +- test/test_interpolate.jl | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Project.toml b/Project.toml index c7186d2..5c9a2bf 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "GeoArrays" uuid = "2fb1d81b-e6a0-5fc5-82e6-8e06903437ab" authors = ["Maarten Pronk "] -version = "0.8.3" +version = "0.8.4" [deps] ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3" @@ -23,9 +23,9 @@ DataAPI = "1" Extents = "0.1" GeoFormatTypes = "0.4" GeoInterface = "1" -GeoStatsBase = "0.21 - 0.30, 0.33" +GeoStatsBase = "0.37, 0.38" IterTools = "1" PrecompileTools = "1" RecipesBase = "0.7, 0.8, 1.0" StaticArrays = "0.12, 1.0" -julia = "1.6 - 1" +julia = "1.6" diff --git a/src/interpolate.jl b/src/interpolate.jl index db31bb8..e74dfe4 100644 --- a/src/interpolate.jl +++ b/src/interpolate.jl @@ -6,7 +6,7 @@ function fill!(ga::GeoArray, solver::T, band=1) where {T<:EstimationSolver} m = ismissing.(data) sum(m) == 0 && return ga cds = collect(coords(ga)) - problemdata = georef( + problemdata = GeoStatsBase.georef( (; band=@view data[.!m]), @view cds[.!m] ) diff --git a/test/test_crs.jl b/test/test_crs.jl index 2a99a2a..147951a 100644 --- a/test/test_crs.jl +++ b/test/test_crs.jl @@ -10,7 +10,7 @@ const GFT = GeoFormatTypes merc_proj_string = "+proj=merc +lat_ts=56.5 +ellps=GRS80" epsg_nl_wkt = "PROJCS[\"Amersfoort / RD New\",GEOGCS[\"Amersfoort\",DATUM[\"Amersfoort\",SPHEROID[\"Bessel 1841\",6377397.155,299.1528128,AUTHORITY[\"EPSG\",\"7004\"]],AUTHORITY[\"EPSG\",\"6289\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4289\"]],PROJECTION[\"Oblique_Stereographic\"],PARAMETER[\"latitude_of_origin\",52.1561605555556],PARAMETER[\"central_meridian\",5.38763888888889],PARAMETER[\"scale_factor\",0.9999079],PARAMETER[\"false_easting\",155000],PARAMETER[\"false_northing\",463000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"28992\"]]" - merc_wkt = "PROJCS[\"unknown\",GEOGCS[\"unknown\",DATUM[\"Unknown based on GRS80 ellipsoid\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]]],PROJECTION[\"Mercator_2SP\"],PARAMETER[\"standard_parallel_1\",56.5],PARAMETER[\"central_meridian\",0],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH]]" + merc_wkt = "PROJCS[\"unknown\",GEOGCS[\"unknown\",DATUM[\"Unknown based on GRS 1980 ellipsoid\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]]],PROJECTION[\"Mercator_2SP\"],PARAMETER[\"standard_parallel_1\",56.5],PARAMETER[\"central_meridian\",0],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH]]" wgs84_wkt = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AXIS[\"Latitude\",NORTH],AXIS[\"Longitude\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]" @testset "Set CRS on GeoArray" begin diff --git a/test/test_interpolate.jl b/test/test_interpolate.jl index d36e166..b4a533f 100644 --- a/test/test_interpolate.jl +++ b/test/test_interpolate.jl @@ -6,21 +6,21 @@ using GeoStatsSolvers ga = GeoArray(Array{Union{Missing,Float64}}(rand(10, 10, 1)), GeoArrays.geotransform_to_affine(SVector(0.0, 1.0, 0.0, 0.0, 0.0, 1.0)), "") ga.A[2, 2, 1] = missing @test count(ismissing, ga.A) == 1 - GeoArrays.fill!(ga, Kriging()) + GeoArrays.fill!(ga, KrigingSolver()) @test count(ismissing, ga.A) == 0 end @testset "Regular Grid interpolation with negative spacing" begin ga = GeoArray(Array{Union{Missing,Float64}}(rand(10, 10, 1)), GeoArrays.geotransform_to_affine(SVector(0.0, 1.0, 0.0, 0.0, 0.0, -1.0)), "") ga.A[2, 2, 1] = missing @test count(ismissing, ga.A) == 1 - GeoArrays.fill!(ga, Kriging()) + GeoArrays.fill!(ga, KrigingSolver()) @test count(ismissing, ga.A) == 0 end @testset "Irregular Grid interpolation" begin ga = GeoArray(Array{Union{Missing,Float64}}(rand(10, 10, 1)), GeoArrays.geotransform_to_affine(SVector(0.0, 1.0, 1.0, 0.0, 0.0, 1.0)), "") ga.A[2, 2, 1] = missing @test count(ismissing, ga.A) == 1 - GeoArrays.fill!(ga, IDW()) + GeoArrays.fill!(ga, IDWSolver()) @test count(ismissing, ga.A) == 0 end end From 2de884ebf8bbcf7ea7d200c956ca4cf0a81221b8 Mon Sep 17 00:00:00 2001 From: Maarten Pronk Date: Sat, 14 Oct 2023 16:29:03 +0200 Subject: [PATCH 2/3] Drop Julia 1.6. Fix documentation. --- .github/workflows/CI.yml | 3 +-- CHANGELOG.md | 4 ++++ Project.toml | 2 +- docs/make.jl | 3 ++- docs/{ => src}/img/RGB.byte.png | Bin docs/{ => src}/img/RGB.byte.subset.png | Bin docs/src/index.md | 12 +++++++++--- src/interpolate.jl | 6 +++++- 8 files changed, 22 insertions(+), 8 deletions(-) rename docs/{ => src}/img/RGB.byte.png (100%) rename docs/{ => src}/img/RGB.byte.subset.png (100%) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9e352a4..4e5f682 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -12,8 +12,7 @@ jobs: fail-fast: false matrix: version: - - "1.6" - - "1" + - "1.9" - "nightly" os: - ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index f4b709c..ccaa290 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.3] - 2023-10-14 +- Update GeoStatsBase compat bounds and fix interpolation +- Drop Julia 1.6 (LTS), now requires 1.9 + ## [0.8.2] - 2023-05-10 - Fix backwards compatible constructors for metadata, so the old constructor `GeoArray(A, f, crs)` still works. diff --git a/Project.toml b/Project.toml index 5c9a2bf..102fba1 100644 --- a/Project.toml +++ b/Project.toml @@ -28,4 +28,4 @@ IterTools = "1" PrecompileTools = "1" RecipesBase = "0.7, 0.8, 1.0" StaticArrays = "0.12, 1.0" -julia = "1.6" +julia = "1.9" diff --git a/docs/make.jl b/docs/make.jl index b317d66..91ea75b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -12,7 +12,8 @@ makedocs( format=Documenter.HTML(; prettyurls=get(ENV, "CI", "false") == "true", canonical="https://evetion.github.io/GeoArrays.jl", - assets=String[] + assets=String[], + repolink="https://github.com/evetion/GeoArrays.jl" ), pages=[ "Home" => "index.md", diff --git a/docs/img/RGB.byte.png b/docs/src/img/RGB.byte.png similarity index 100% rename from docs/img/RGB.byte.png rename to docs/src/img/RGB.byte.png diff --git a/docs/img/RGB.byte.subset.png b/docs/src/img/RGB.byte.subset.png similarity index 100% rename from docs/img/RGB.byte.subset.png rename to docs/src/img/RGB.byte.subset.png diff --git a/docs/src/index.md b/docs/src/index.md index 31db47c..83d783e 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -184,7 +184,7 @@ julia> plot(ga) julia> plot(ga, band=2) ``` -![example plot](../img/RGB.byte.png) +![example plot](img/RGB.byte.png) Note that for larger GeoArrays, only a sample of the data is plotted for performance. By default the sample size is twice figure size. You can control this factor by calling `plot(ga, scalefactor=2)`, @@ -211,7 +211,7 @@ AffineMap([300.0379266750948 0.0; 0.0 -300.041782729805], [161692.54740834387, 2 julia> plot(ga_sub) ``` -![example plot](../img/RGB.byte.subset.png) +![example plot](img/RGB.byte.subset.png) ### Profile You can sample the values along a line in a GeoArray with `profile(ga, linestring)`. The linestring can be any geometry that supports [GeoInterface.jl](https://github.com/JuliaGeo/GeoInterface.jl/). @@ -220,6 +220,12 @@ You can sample the values along a line in a GeoArray with `profile(ga, linestrin ## Alternatives GeoArrays.jl was written to quickly save a geospatial Array to disk. Its functionality mimics `rasterio` in Python. If one requires more features---such as rasterization or zonal stats---which also work on NetCDF files, [Rasters.jl](https://github.com/rafaqz/Rasters.jl/) is a good alternative. Its functionality is more like `(rio)xarray` in Python. -## Index +# API +```@autodocs +Modules = [GeoArrays] +``` + +# Index ```@index ``` + diff --git a/src/interpolate.jl b/src/interpolate.jl index e74dfe4..cb3954b 100644 --- a/src/interpolate.jl +++ b/src/interpolate.jl @@ -1,6 +1,10 @@ using GeoStatsBase -"""Interpolate missing values in GeoArray.""" +""" + fill!(ga::GeoArray, solver::EstimationSolver, band=1) + +Replace missing values in GeoArray `ga` using `solver` from the GeoStats ecosystem. +""" function fill!(ga::GeoArray, solver::T, band=1) where {T<:EstimationSolver} data = @view ga.A[:, :, band] m = ismissing.(data) From 59f88e36209ffe513e91ba962f4b55b8b2b456ac Mon Sep 17 00:00:00 2001 From: Maarten Pronk Date: Sat, 14 Oct 2023 16:33:19 +0200 Subject: [PATCH 3/3] Up Julia version in docs CI. --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a9f2a9b..0288c92 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: - version: "1.6" + version: "1.9" - name: Install dependencies run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' - name: Build and deploy