AustralianAntarcticDivision / SOmap

Southern Ocean round maps
https://australianantarcticdivision.github.io/SOmap/
24 stars 6 forks source link

SOauto_map mask not working #43

Open Maschette opened 5 years ago

Maschette commented 5 years ago

It seems to be hating life, I think it is something to do with it hating on the trim_background

library(SOmap)
#> Loading required package: raster
#> Warning: package 'raster' was built under R version 3.5.3
#> Loading required package: sp
SOauto_map(x=c(10,60), y=c(-40,-70), mask=T) 
#> Loading required namespace: rgeos

SOauto_map(x=c(10,60), y=c(-40,-70), mask=T, trim_background = FALSE) 

Created on 2019-05-10 by the reprex package (v0.2.1)

mdsumner commented 5 years ago
library(SOmap)
#> Loading required package: raster
#> Loading required package: sp
#> Registered S3 methods overwritten by 'ggplot2':
#>   method         from 
#>   [.quosures     rlang
#>   c.quosures     rlang
#>   print.quosures rlang
SOauto_map(x=c(10,60), y=c(-40,-70), mask=T) 
#> Loading required namespace: rgeos


SOauto_map(x=c(10,60), y=c(-40,-70), mask=T, trim_background = FALSE)

Created on 2019-06-01 by the reprex package (v0.2.1)

See https://github.com/AustralianAntarcticDivision/SOmap/pull/48

mdsumner commented 5 years ago

Refactoring automap has convinced me that trim_background and mask don't belong in the function, they should be separate tools. The fundamental problem is that there isn't always a trivial input extent that's in longlat - if you input projected data it doesn't have a straightforward rectangular extent - so an independent function that creates one, and SOmask()s data is a better way forward.

Maschette commented 5 years ago

I have no objections to it being a seperate function. However, it would be good to either have it callable from SOauto_map, or if you want to be fancy have it be able to be called with a pipe.

mdsumner commented 5 years ago

Workin' on it!

Maschette commented 2 years ago

Here is an example of what a desired outcome may look like image