Skip to content

Commit

Permalink
Re-introduced 'sl.init.device' as deprecated argument in 'sl.plot.ini…
Browse files Browse the repository at this point in the history
…t' to re-enable backwards compatibility
  • Loading branch information
helgegoessling committed Aug 8, 2023
1 parent 8c167f4 commit 26dbf2a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions R/sl.plot.init.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sl.plot.init <-
function (projection="lonlat",lonrange=c(-180,180),latrange=c(-89,89),lonlatrot=NULL,polar.latbound=0,regpoly.N=3,regpoly.lat0=60,regpoly.rotfrac=0,col.background=NULL,precision=1,main="",xshift=0,yshift=0,device="pdf",do.init=TRUE,file.name=NULL,width=12,transform.function=NULL,mar=rep(0,4),lonlat.lonrange=c(-180,180),lonlat.latrange=c(-85,85),lonlat.lonlatrot=NULL,polar.lonlatrot=c(0,90,0),regpoly.lonlatrot=c(0,90,0)) {
function (projection="lonlat",lonrange=c(-180,180),latrange=c(-89,89),lonlatrot=NULL,polar.latbound=0,regpoly.N=3,regpoly.lat0=60,regpoly.rotfrac=0,col.background=NULL,precision=1,main="",xshift=0,yshift=0,device="pdf",do.init=TRUE,file.name=NULL,width=12,transform.function=NULL,mar=rep(0,4),lonlat.lonrange=c(-180,180),lonlat.latrange=c(-85,85),lonlat.lonlatrot=NULL,polar.lonlatrot=c(0,90,0),regpoly.lonlatrot=c(0,90,0),do.init.device=NULL) {

# handling of deprecated arguments for backward compatibility
if (missing(lonlatrot)) {
Expand All @@ -10,7 +10,15 @@ function (projection="lonlat",lonrange=c(-180,180),latrange=c(-89,89),lonlatrot=
if (projection=="lonlat" && missing(lonrange)) {lonrange = lonlat.lonrange}
if (projection=="lonlat" && missing(latrange)) {latrange = lonlat.latrange}

do.init.device = !is.null(file.name)
if (!is.null(do.init.device)) {
warning("Argument 'do.init.device' is deprecated. Specifying or not specifying 'file.name' is sufficient to determine if a (non-standard) device is initiated.")
if (is.null(file.name)) {
file.name = paste0("~/sl.plot.",device)
warning(paste0("'file.name' is set to ",file.name))
}
} else {
do.init.device = !is.null(file.name)
}

pir = list(projection=projection)

Expand Down
2 changes: 1 addition & 1 deletion man/sl.grid2path.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ New data from the gridded field is read only if the time (for temporal data) of
Helge Goessling
}
\note{
To extensions would be nice:
Two extensions would be nice:
(i) Complement the function such that not only nearest-neighbour but more sophisticated spatial interpolation (e.g., bilinear) is supported.
(ii) Support of unstructured grids.
}
Expand Down

0 comments on commit 26dbf2a

Please sign in to comment.