AustralianAntarcticDivision / SOmap

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

Broken graticules #66

Closed Maschette closed 4 years ago

Maschette commented 4 years ago

The latest version of the graticules package breaks the border and the legends.

library(SOmap)
#> Loading required package: raster
#> Loading required package: sp
SOmap()
#> Warning in .pointsToMatrix(p2): longitude > 180 (times about 300)

Created on 2019-10-08 by the reprex package (v0.3.0)

mdsumner commented 4 years ago

good one thanks! Please re-install from github

remotes::install_github("mdsumner/graticule")
Maschette commented 4 years ago

Thanks Mike, I wasn't sure where best to report it. That fixed it.

mdsumner commented 4 years ago

Definitely a good one! A classic off-by-one 2x ...

Maschette commented 4 years ago

just as a note, you still get the > Warning in .pointsToMatrix(p2): longitude > 180 (times about 300) warnings for SOmap() internally caused by bticks. For the minute I have thrown a suppressWarnings() around it atm but could be worth putting in the graticule function :)

Maschette commented 4 years ago

argh i didn't actually fix it, I will try and find in graticule which bit it is.

mdsumner commented 4 years ago

You could make SOmap create the lines in -180/180:

xx <- c(-180, -135,  -90,  -45, 0, 45, 90, 135, 180)
yy <- c(seq(from = -90, to = -45, by = 15), -45)
library(SOmap)
grat <- graticule::graticule(xx, yy, proj = raster::projection(Bathy))

I think the warning is ok, I'm a bit reluctant to suppress it.

Maschette commented 4 years ago

Working 0 - 360 is kind of how we do most things internally, I think I will just have to suppress them all at the moment. My suggestion for the graticules package would be to suppress the warnings but put an if statement that gives a single warning if the graticule is greater than 180 as in some instances you end up with about 120 warnings.

mdsumner commented 4 years ago

I changed my mind and will zap the warnings in graticule. They come from geosphere::distRhumb

Maschette commented 4 years ago

I'm pretty sure this has been fixed now yes?

mdsumner commented 4 years ago

yep