Skip to content
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

oce.plot.ts() fails with "need finite 'ylim' values" even though plot() works #2277

Open
dankelley opened this issue Jan 8, 2025 · 5 comments
Assignees
Labels

Comments

@dankelley
Copy link
Owner

The dataset is from a glider and so creating a regexp is a bit tricky. I plan to instrument the code and to see where the problem lies. Then I may be able to see how to make a regexp, and I'll insert that (possibly with a better titles).

@dankelley dankelley self-assigned this Jan 8, 2025
@dankelley
Copy link
Owner Author

The problem is that it is trying to simplify the vectors, which exceed the limit. I guess when it does that, it is not happening upon finite values. See below (not for others reading this -- just my notes to myself).

> table(is.finite(S))

FALSE  TRUE 
12028  2447 
> i <- 1:100; oce.plot.ts(t[i],is.finite(S[i]), type = "p")
Screenshot 2025-01-08 at 4 32 41 PM

@dankelley
Copy link
Owner Author

I'll look into this tomorrow. That bit of the code is a bit on the tricky side. But I like knowing about this issue, because it has not come up in my usual workflow (where there are normally more finite values than NA ones; here there are 6 NA values per non-NA value. Glider data are fun :-)

@dankelley
Copy link
Owner Author

It now checks for the condition. If ylim is given, then a plot is shown but there are no data, and a message about no non-NA y values is written in the plot region. But if ylim is not given, there is no way for it to proceed, so it says as in the example below. This is better than telling users that there are no non-NA values (which is what plot() does).

Tomorrow I'll look into seeing why simplification does this. There may be a way to retain some data. But I need to think through what makes most sense, in the "R way of thinking", i.e. what users would expect.

Error in oce.plot.ts(t, S, debug = 0) : 
  simplification eliminated all y data; try using simplify=NA

@dankelley
Copy link
Owner Author

The problem is that the data just happen to be sparser than I had thought could occur. The way simplification works for type="l" is that it splits the data up into subsets, and then computes the min and max of y in each of those, to draw a vertical line at that time value. But the code is doing that only if there is more than 1 value in the subset; otherwise it uses NA.

If there is only one value there, then the min will equal the max and so the vertical line will have zero extent. But maybe that's OK. At least it seems OK to me right now. I need to mess with some sample datasets and also to scratch my head for a while.

Maybe sometime if @richardsc and I are in a room together, we can chat about this, since simplification was very much a jointly -developed idea between the two of us.

@dankelley
Copy link
Owner Author

Here is what I get on my problematic case of (very sparse) glider data, with not-yet-push-to-GH code.

Screenshot 2025-01-09 at 6 27 37 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant