-
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
Issue with tidem function #1621
Comments
Hi @Pra713 Thanks for opening the issue, and nice job producing a clear and reproducible issue report! @dankelley is better in the weeds of the tidal fit stuff than I am, so I'll let him comment too, but a couple thoughts:
|
Hi Richard, Thanks for the detailed response.
|
Re I got the following error when I tried to exclude "Z0" as a contituent:
"Z0is not in the list of constituents currently under study" I'll fix that up sometime today or tomorrow, by checking specifically whether |
I got this data from the NOAA tides and currents website. I believe that the water level data can be positive or negative since it simply depends on the datum chosen. So while the data reported by a tide gauge may never be negative, it can be negative when adjusted for some datums (eg. MHW, MSL, etc). Screenshot (water level plot from NOAA Tides website with MSL as datum): |
Interesting, re the datum in the noaa dataset. Thanks. |
I'll look at this over the weekend. |
Thanks! |
And yes, the datum, |
See #1621 and note: 1. The renaming from T-TIDE was wrong (reversed) for "UPS1". 2. Now, we have a new user-visible function named tidemConstituentNameFix() that does renaming. This will make it easier for users to debug problems, and also submit patches (if more naming differences are uncovered). 3. The internal functioning of Z0 is changed. The tests in tests/testthat/test_tidem.R still work properly, which means that we are still reproducing the T_TIDE results (to the extent that we check them). Also, those tests require that amplitude and phase match values from previous versions of oce, so we know that this is okay also. Finally, there are tests that predict() works sensibly in that file. Given all of this, I am fairly confident that things are OK, at least for tidem() and predict(). (I have not checked into as.tidem() yet, though.) The only thing that might affect a user (well, at least a usr who is doing unrecommended investigation of the internals of a tidem object) is that the cos() terms are stored before the sin() terms, in building the columns of the regression matrix. However, the form of that matrix is not documented, and so any user that is looking that deep into the data object is working in unrecommended territory. Sticking to the interface, that is predict() and summary(), ought to be okay, according to the tests.
This may work now, in the "develop" branch. See the commit note, pasted below. However, I do not know whether the results are okay for the test contributed by @Pra713 ... all I know is that the fairly extensive tests in https://github.com/dankelley/oce/blob/develop/tests/testthat/test_tidem.R still pass, with this change. @Pra713 -- if you have T-TIDE installed, perhaps you can do a test to see whether Thanks for your patience on this. Last week was busy with teaching work. commit 57b9ec1
|
I am fairly busy today with my coursework and TA work, but I'll be sure to check it in a day or two. I can compare the results from T-TIDE and |
I'm sorry but I do not have much experience with Github, and installing packages from Github. I seem to be unable to install oce from github using the code provided. I tried uninstalling the previous version of oce, but still the
The error I get is: I do not have 'digest' package installed. Using the 'oce' package from CRAN still throws the same error messages. |
Also, I managed to go into the source code form |
Some other notes:
|
I also don't know what the https://stackoverflow.com/questions/36533880/cannot-install-flexdashboard-package/36533946#36533946 Maybe try some of what is in there and see if it helps? Particularly making sure that you try the install from a "fresh" R session (i.e. one that doesn't have other packages loaded). Failing that, Dan can provide you with a pre-compiled binary (for Windows or OSX) that you can install directly. It would help greatly if you could post both the data that you are doing the fit to, as well as the code that you are running, especially for the "very close, but slightly different" test that you did. |
Yes, I definitely want to add more details and post my codes and results, but I've just been so busy with Grad school this weekend, and probably until this Thursday. Regarding that 'digest' issue, I had have a few issues before that, which I fixed after Googling. I mainly had to uninstall a couple of previously installed packages. And I did start from a "fresh" R session each time. This 'digest' issue was the one where I got stuck. |
Here are my results for ################################################ Constituents:MATLAB (Note that x0 here corresponds to the z0 in
|
These do not look "very close" (to quote an early characterization). For the R case, you are not reporting the output of To repeat the request of @richardsc, can you please state the code you used for the matlab and R cases, and also whether you are using the latest commit of the "develop" branch of |
Further on the data, > load("~/Dropbox/df_data.RDS")
Error in load("~/Dropbox/df_data.RDS") :
bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘df_data.RDS’ has magic number 'X'
Use of save versions prior to 2 is deprecated so I cannot read your RDS (perhaps because I have a newer R installed). I can try your .csv file, but you'll need to tell me (by posting your code!) which of the two sea-level columns you are using. |
I'll have to do some cleanup to post my full code and everything else required. This was just a quick and dirty run with no formatting. I can upload everything this Friday as I do not have time right now. Regarding the data, |
And apologies for the "very close" quote, now that I look at it more closely, they are not that close. Although the top constituents (constituents with the highest amplitudes) do have comparable amplitudes. But beyond that, they are quite different, which is concerning. |
I wrote R code to read it (using CODE library(oce)
e <- read.csv("CO-OPS_8720218_wl.csv")
t <- as.POSIXct(paste(e$Date, e$Time..GMT.), tz="UTC")
e <- e$Verified..m.
sl <- as.sealevel(e, t)
summary(tidem(sl)) OUTPUT
|
This issue has been automatically marked as stale because no comments have been made in a month. Unless comments are made in the next week (or the 'pinned' label is applied), this issue will be closed automatically in a week. |
Pinning because I was in the middle of starting to look into this with Matlab (but which is only licensed to use on a specific network) but haven't finished yet. |
@richardsc still working on this? (I am wondering, because we are on a countdown to a CRAN release, so I'm looking to see if there are any issues that we need to fix beforehand.) |
I'm working on this! Agree would be good to sort out before CRAN submission |
It took me longer to do this evaluation than I planned, and I've learned a lot about The short answer, is that I think that there are no fundamental issues with
The notes that were used for this are contained in the pdf below: The following are a few summary plots showing the results of the comparison (which use the dataset that started this issue): Difference between
Note that the rms error between the two predictions and the original sealevel time series are:
So, in terms of how "good" the prediction is, they are essentially the same. I'm going to close this now, and will open another issue to discuss why there are differences in the fit coefficients. Thanks again @Pra713 for opening this, and I hope this is helpful for you in using |
Short summary of problem
Running tidem function with constituents gives me an error message when I include "UPS1" or exclude "Z0" constituents.
Details (optional)
Despite my using "UPS1" as a constituent, it gives me an error saying that "UPSI" is not a valid constituent. Despite my trying to exclude "Z0" as a constituent, it gives me an error saying that "Z0" is not a valid constituent. They are both valid constituents accepted by the function. In the case of "UPS1", the error makes it seem like I'm inputting "UPSI" which I am not, and actually suggest "UPS1" as a constituent among others.
What you did
I downloaded tide data from NOAA website, https://tidesandcurrents.noaa.gov/. After some preprocessing, I tried running tidem for selected constituents. I have attached a link to my Google drive folder with the code as well as the preprocessed data here:
https://drive.google.com/drive/folders/1YAMLGC3_J1wATueLmlQz4Wlk9Ja4NR9S?usp=sharing
The code (comments removed due to formatting issue, but the code in link is fully commented):
What you expected to happen
The code to run and give me a fitted tide model.
What happened
I instead got the following error when I tried to include "UPS1" as a constituent:
"'UPSI' is not a known tidal constituent"
I got the following error when I tried to exclude "Z0" as a contituent:
"Z0is not in the list of constituents currently under study"
How urgent is this?
Yes, this error can wait a few days.
Output from sessionInfo()
The text was updated successfully, but these errors were encountered: