-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mapContour() should compensate for longitude cut points #2218
Comments
I'm not sure of an easy way to make it compensate. The problem is that (at present) the hidden variable that defines the projection that was set up with The other thing is that this code is really quite old and fairly complicated, and I worry that a change might cause problems for some use-cases that I am not imagining right now. All this argues against making Given all of this, my decision is to document the need to be careful. So, tomorrow, I am likely to add the following to the docs. I'll mention the first block in the docs for the The second part would be a numbered example. If the examples are not already numbered, then I'll do that, and set So this is just a heads-up. Most likely, when I read the text below, I'll want to reword for clarity and brevity. (Obviously, I'm writing roxygen2 here.) #' Importantly, the `longitude` system must match that
#' used in the [mapPlot()] call that created the plot to which
#' contours are to be added. Otherwise, contours can have spurious
#' lines that run from one side of the plot to the other. See Example
#' X.
#' # Example X: deal with z(lon,lat) defined with longitude expressed
#' # in the 0 to 360 system. This solution was suggested by Clark
#' # Richards at the discussion of issue 2217 on the oce github website.
#' #
#' # Create base plot for a dataset with -180 < longitude < 180.
#' data(coastlineWorld)
#' mapPlot(coastlineWorld)
#' #
#' # Assume that z(lon, lat) has 0 < lon < 360.
#' shiftLeft <- lon > 180
#' lonNew <- lon + 180
#' zNew <- rbind(z[shiftLeft, ], z[!shiftLeft, ])
#' mapContour(lonNew, lat, zNew) |
Commit 829b0bf of the "develop" branch handles this by improving on the documentation, as shown in the two snapshots below. I will check the remote builds in about an hour, and if they have not failed, I will close this issue and ask the reporter of issue #2217 to consider whether that issue has been addressed. |
The remote checks worked, so I am closing this issue now. My next step is to put a comment at #2217, noting this. |
This came up in #2217. Maybe
mapContour()
ought to compensate for the cut point of longitude, i.e. whether data go from 0 to 360 or from -180 to 180. It might be a bit tricky, though, because we might also have to consider the view used in the present projection ... the case of #2217 is thus a sample case, but fixing it as @richardsc has done there might not be a general fix.The text was updated successfully, but these errors were encountered: