Skip to content

Commit

Permalink
handle sf version dependency; #659
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Jan 4, 2024
1 parent 065d57b commit 35e416d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ LazyData: true
Depends:
R (>= 3.3.0),
abind,
sf (>= 1.0-10)
sf (>= 1.0-15)
Imports:
methods,
parallel,
Expand Down
5 changes: 4 additions & 1 deletion R/mdim.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ read_mdim = function(filename, variable = character(0), ..., groups = character(
stop("proxy not yet implemented in read_mdim()")

stopifnot(is.character(filename), is.character(variable), is.character(options))
ret = gdal_read_mdim(filename, variable, groups, options, rev(offset), rev(count), rev(step), proxy, debug)
ret = if (packageVersion("sf") <= "1.0.15")
gdal_read_mdim(filename, variable, options, rev(offset), rev(count), rev(step), proxy, debug)
else
gdal_read_mdim(filename, variable, groups, options, rev(offset), rev(count), rev(step), proxy, debug)
ret = recreate_geometry(ret)
if (isTRUE(bounds) || is.character(bounds))
ret$dimensions = mdim_use_bounds(ret$dimensions, filename, bounds)
Expand Down
6 changes: 1 addition & 5 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,7 @@ plot.stars = function(x, y, ..., join_zlim = TRUE, main = make_label(x, 1), axes
draw.key = !is.null(key.pos) && join_zlim
if (! draw.key)
key.pos = NULL
lt = if (packageVersion("sf") <= "1.0.14")
sf::.get_layout(st_bbox(x), dims[3], par("din"),
if (join_zlim && key.pos.missing) -1 else key.pos[1], key.width, mfrow = mfrow)
else
sf::.get_layout(st_bbox(x), dims[3], par("din"),
lt = sf::.get_layout(st_bbox(x), dims[3], par("din"),
if (join_zlim && key.pos.missing) -1 else key.pos[1], key.width, mfrow = mfrow, main = main)
if (key.pos.missing)
key.pos = lt$key.pos
Expand Down

0 comments on commit 35e416d

Please sign in to comment.