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

improve cellsize and switch from Archgdal to Proj #768

Merged
merged 45 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
691c39d
optimize cellsize for lon-lat projections
tiemvanderdeure Sep 27, 2024
076819c
never reverse order of intervalbounds
tiemvanderdeure Sep 27, 2024
8b8fde8
add a test with a reverse order dimension
tiemvanderdeure Sep 27, 2024
62885bc
use approx so tests pass
tiemvanderdeure Sep 27, 2024
0e65df2
combine two broadcasts
tiemvanderdeure Sep 27, 2024
3a6972b
change cellsize to cellarea and default to m2
tiemvanderdeure Sep 28, 2024
4d30a81
fix a test
tiemvanderdeure Sep 28, 2024
51ce721
use mapped dims if those are lon-lat
tiemvanderdeure Sep 28, 2024
fe5eed4
fix typo in test
tiemvanderdeure Sep 28, 2024
82d8a38
remove some code scribbles
tiemvanderdeure Sep 28, 2024
d1300dc
radius not R
tiemvanderdeure Oct 2, 2024
deac9d7
better check if a crs is lon-lat
tiemvanderdeure Oct 2, 2024
2d3c1c5
even better check if projection is lon-lat
tiemvanderdeure Oct 2, 2024
dc83ae9
define AG = ArchGDAL in main file
tiemvanderdeure Oct 2, 2024
7fbfd5a
use sind and cosd instead of deg2rad
tiemvanderdeure Oct 2, 2024
2deb169
use isintervals(dims)
tiemvanderdeure Oct 2, 2024
c0c7b9c
consistently use AG instead of ArchGDAL
tiemvanderdeure Oct 2, 2024
98a60f5
add area_in_crs keyword
tiemvanderdeure Oct 2, 2024
497a452
make the example easier to read
tiemvanderdeure Oct 2, 2024
98724c2
use Eriksson's formula instead of Girard's theorem
tiemvanderdeure Oct 3, 2024
4906076
test on a 5x5m grid
tiemvanderdeure Oct 3, 2024
b110844
get rid of accidental line in test
tiemvanderdeure Oct 3, 2024
8c76b51
put back order = :trad
tiemvanderdeure Oct 3, 2024
ae793e6
optimizations
tiemvanderdeure Oct 4, 2024
7f444f3
depend on GeometryOpsCore, reexport common manifolds
asinghvi17 Oct 3, 2024
ff979f4
Refactor the toplevel `cellarea` to take a method as the first arg
asinghvi17 Oct 3, 2024
4e86b0a
Remove kwargs from cellarea
asinghvi17 Oct 3, 2024
0709a39
Fix dispatch and propagate kwargs
asinghvi17 Oct 5, 2024
89bd796
Update Project.toml
asinghvi17 Oct 6, 2024
de73bb8
fix typo
asinghvi17 Oct 6, 2024
6c9201a
Update extensions.jl
asinghvi17 Oct 6, 2024
df5b7d4
Update Rasters.jl
asinghvi17 Oct 6, 2024
90dfa27
fix tests
asinghvi17 Oct 6, 2024
89001d2
Merge pull request #1 from asinghvi17/as/geometryops_core
tiemvanderdeure Oct 7, 2024
99c2fd6
Switch `reproject` to use Proj instead of ArchGDAL
asinghvi17 Oct 8, 2024
520723b
Fix invocations to ArchGDAL GFT converts in tests
asinghvi17 Oct 8, 2024
11deb98
Add `+type=crs` to all Proj-strings
asinghvi17 Oct 8, 2024
c1632a1
Implement cellarea in Proj
asinghvi17 Oct 8, 2024
276144b
Add Proj to test project
asinghvi17 Oct 8, 2024
21e77e9
Switch cellarea tests to Proj
asinghvi17 Oct 8, 2024
ded1ec8
Bump Proj compat to 1.7.2 to get the WKT support
asinghvi17 Oct 8, 2024
c890a83
Merge pull request #2 from asinghvi17/as/proj
tiemvanderdeure Oct 8, 2024
8520a13
remove cellarea and reproject.jl from archgdal extension
tiemvanderdeure Oct 9, 2024
6c43aef
throw extension error with reproject
tiemvanderdeure Oct 9, 2024
599ce4e
Merge branch 'main' into better_cellsize
rafaqz Oct 9, 2024
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
12 changes: 9 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
Flatten = "4c728ea3-d9ee-5c9a-9642-b6f7d7dc04fa"
GeoFormatTypes = "68eda718-8dee-11e9-39e7-89f7f65f511f"
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
GeometryOpsCore = "05efe853-fabf-41c8-927e-7063c8b9f013"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Missings = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
Mmap = "a63ad114-7e13-5084-954f-fe012c677804"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
Expand All @@ -30,6 +32,7 @@ CoordinateTransformations = "150eb455-5306-5404-9cee-2592286d6298"
GRIBDatasets = "82be9cdb-ee19-4151-bdb3-b400788d9abc"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
Proj = "c94c279d-25a6-4763-9509-64d165bea63e"
RasterDataSources = "3cb90ccd-e1b6-4867-9617-4276c8b2ca36"
ZarrDatasets = "519a4cdf-1362-424a-9ea1-b1d782dbb24b"

Expand All @@ -39,6 +42,7 @@ RastersCoordinateTransformationsExt = "CoordinateTransformations"
RastersGRIBDatasetsExt = "GRIBDatasets"
RastersMakieExt = "Makie"
RastersNCDatasetsExt = "NCDatasets"
RastersProjExt = "Proj"
RastersRasterDataSourcesExt = "RasterDataSources"
RastersZarrDatasetsExt = "ZarrDatasets"

Expand All @@ -59,12 +63,13 @@ FillArrays = "0.12, 0.13, 1"
Flatten = "0.4"
GRIBDatasets = "0.2, 0.3"
GeoFormatTypes = "0.4"
GeoInterface = "1"
GeometryOpsCore = "0.1.1"
Makie = "0.20, 0.21"
Missings = "0.4, 1"
NCDatasets = "0.13, 0.14"
OffsetArrays = "1"
ProgressMeter = "1"
Proj = "1.7.2"
RasterDataSources = "0.5.7, 0.6"
RecipesBase = "0.7, 0.8, 1.0"
Reexport = "0.2, 1.0"
Expand All @@ -82,17 +87,18 @@ ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
CFTime = "179af706-886a-5703-950a-314cd64e0468"
CoordinateTransformations = "150eb455-5306-5404-9cee-2592286d6298"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
GeoDataFrames = "62cb38b5-d8d2-4862-a48e-6a340996859f"
GRIBDatasets = "82be9cdb-ee19-4151-bdb3-b400788d9abc"
GeoDataFrames = "62cb38b5-d8d2-4862-a48e-6a340996859f"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Proj = "c94c279d-25a6-4763-9509-64d165bea63e"
RasterDataSources = "3cb90ccd-e1b6-4867-9617-4276c8b2ca36"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Shapefile = "8e980c4a-a4fe-5da2-b3a7-4b4b0353a2f4"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "ArchGDAL", "CFTime", "CoordinateTransformations", "DataFrames", "GeoDataFrames", "GeometryBasics", "GRIBDatasets", "NCDatasets", "Plots", "RasterDataSources", "SafeTestsets", "Shapefile", "Statistics", "Test", "ZarrDatasets"]
test = ["Aqua", "ArchGDAL", "CFTime", "CoordinateTransformations", "DataFrames", "GeoDataFrames", "GeometryBasics", "GRIBDatasets", "NCDatasets", "Plots", "Proj", "RasterDataSources", "SafeTestsets", "Shapefile", "Statistics", "Test", "ZarrDatasets"]
7 changes: 4 additions & 3 deletions ext/RastersArchGDALExt/RastersArchGDALExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ using Rasters: GDALsource, AbstractProjected, RasterStackOrArray, FileArray, NoK
GDAL_EMPTY_TRANSFORM, GDAL_TOPLEFT_X, GDAL_WE_RES, GDAL_ROT1, GDAL_TOPLEFT_Y, GDAL_ROT2, GDAL_NS_RES,
_no_crs_error

import Rasters: reproject, resample, warp, cellsize, nokw
import Rasters: reproject, resample, warp, nokw

import LinearAlgebra: dot, cross

const RA = Rasters
const AG = ArchGDAL
const DD = DimensionalData
const DA = DiskArrays
const GI = GeoInterface
const LA = Lookups

include("cellsize.jl")
include("gdal_source.jl")
include("reproject.jl")
include("resample.jl")
include("warp.jl")

Expand Down
87 changes: 0 additions & 87 deletions ext/RastersArchGDALExt/cellsize.jl

This file was deleted.

2 changes: 0 additions & 2 deletions ext/RastersArchGDALExt/gdal_source.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const AG = ArchGDAL

const GDAL_LOCUS = Start()

const GDAL_DIM_ORDER = (X(), Y(), Band())
Expand Down
21 changes: 0 additions & 21 deletions ext/RastersArchGDALExt/reproject.jl

This file was deleted.

33 changes: 33 additions & 0 deletions ext/RastersProjExt/RastersProjExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module RastersProjExt

using Rasters, Proj

import DiskArrays,
Extents,
Missings

using DimensionalData,
GeoFormatTypes,
GeoInterface


using Rasters.Lookups
using Rasters.Dimensions
using Rasters: GDALsource, AbstractProjected, RasterStackOrArray, FileArray, NoKW,
RES_KEYWORD, SIZE_KEYWORD, CRS_KEYWORD, FILENAME_KEYWORD, SUFFIX_KEYWORD, EXPERIMENTAL,
GDAL_EMPTY_TRANSFORM, GDAL_TOPLEFT_X, GDAL_WE_RES, GDAL_ROT1, GDAL_TOPLEFT_Y, GDAL_ROT2, GDAL_NS_RES,
_no_crs_error

import Rasters: reproject, _spherical_cellarea, nokw

import LinearAlgebra: dot, cross

const RA = Rasters
const DD = DimensionalData
const DA = DiskArrays
const GI = GeoInterface
const LA = Lookups

include("cellarea.jl")
include("reproject.jl")
end
Loading
Loading