Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Nov 25, 2023
1 parent a8b7fdf commit 64d2750
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ext/RastersArchGDALExt/gdal_source.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function Base.write(
RA.check_can_write(filename, force)
A1 = _maybe_correct_to_write(A)
_create_with_driver(filename, dims(A1), eltype(A1), missingval(A1); _block_template=A1, kw...) do dataset
_maybe_warn_south_up(A, verbose, "Writing South-up. Use `reverse(raster; dims=Y)` first to write conventional North-up")
verbose && _maybe_warn_south_up(A, verbose, "Writing South-up. Use `reverse(x; dims=Y)` first to write conventional North-up")
open(A1; write=true) do O
AG.RasterDataset(dataset) .= parent(O)
end
Expand All @@ -78,15 +78,15 @@ function RA.create(filename, ::Type{GDALsource}, T::Type, dims::DD.DimTuple;
T = Missings.nonmissingtype(T)
missingval = ismissing(missingval) ? RA._writeable_missing(T) : missingval
_create_with_driver(filename, dims, T, missingval; kw...) do A
_maybe_warn_south_up(A, verbose, "Creating South-up. Use `reverse(ydim)` first to write conventional North-up")
verbose && _maybe_warn_south_up(dims, verbose, "Creating South-up. Use `reverse(x; dims=Y)` first to write conventional North-up")
nothing
end

return Raster(filename; source=GDALsource, name, lazy, dropband=!hasdim(dims, Band))
end

_maybe_warn_south_up(A, verbose, msg) =
verbose && lookup(A, Y, msg) isa AbstractProjected && order(A, Y, msg) isa ForwardOrdered && @warn msg
verbose && lookup(A, Y) isa AbstractProjected && order(A, Y) isa ForwardOrdered && @warn msg

function RA._open(f, ::Type{GDALsource}, filename::AbstractString; write=false, kw...)
# Check the file actually exists because the GDAL error is unhelpful
Expand Down

0 comments on commit 64d2750

Please sign in to comment.