ttide_py icon indicating copy to clipboard operation
ttide_py copied to clipboard

Is this right?

Open iuryt opened this issue 1 year ago • 2 comments

I was following the example from README.md with the code snippet below:

import ttide as tt
import numpy as np
import matplotlib.pyplot as plt

t = np.arange(1001)
m2_freq = 2 * np.pi / 12.42

elev = 5 * np.cos(m2_freq * t)

tfit_e = tt.t_tide(elev)

elev_fit = tfit_e(t)

fig, ax = plt.subplots(1, 2)
ax[0].plot(t, elev)
ax[0].plot(t, elev_fit)
ax[0].set(xlim = [0, 200])
ax[1].scatter(elev, elev_fit)

which returns

-----------------------------------
nobs = 1001 
ngood = 1001 
record length (days) = 41.71
rayleigh criterion = 1.0

Phases at central time
x0= 3.66e-06  xtrend= 0
var(data)= 12.53    var(prediction)= 12.53    var(residual)= 0.00
var(prediction)/var(data) (%) = 100.0

        tidal amplitude and phase with 95 % CI estimates
 tide      freq        amp      amp_err   pha      pha_err    snr
  MM    0.0015122     0.0004     0.000     89.79     62.58       1.3
  MSF   0.0028219     0.0001     0.000    266.87    146.24      0.16
  ALP1  0.0343966     0.0004     0.000    269.34     65.68       1.7
* 2Q1   0.0357064     0.0004     0.000     88.36     49.59         2
  Q1    0.0372185     0.0003     0.000     89.82     79.73      0.79
  O1    0.0387307     0.0004     0.000    268.05     52.61       1.7
  NO1   0.0402686     0.0004     0.000    269.19     55.97       1.8
  K1    0.0417807     0.0004     0.000     87.64     54.23         1
* J1    0.0432929     0.0005     0.000     88.85     51.30       2.8
  OO1   0.0448308     0.0003     0.000    266.97    105.86      0.55
* UPS1  0.0463430     0.0006     0.000    268.43     38.52       3.5
  EPS2  0.0761773     0.0009     0.005    267.80    230.52     0.031
  MU2   0.0776895     0.0053     0.007     87.30     93.51      0.51
  N2    0.0789992     0.0017     0.005    267.09    175.44       0.1
* M2    0.0805114     4.9998     0.009    267.25      0.10   3.2e+05
  L2    0.0820236     0.0016     0.006     87.01    218.48     0.072
  S2    0.0833333     0.0057     0.007    267.14     79.64       0.6
  ETA2  0.0850736     0.0015     0.006    266.89    194.46     0.061
  MO3   0.1192421     0.0002     0.000    264.35     40.57       1.8
* M3    0.1207671     0.0003     0.000     87.16     23.69       5.4
* MK3   0.1222921     0.0003     0.000     85.64     25.06         6
  SK3   0.1251141     0.0001     0.000    263.45     61.83      0.83
* MN4   0.1595106     0.0002     0.000    264.90     25.92       3.7
  M4    0.1610228     0.0000     0.000    147.67    231.93     0.017
  SN4   0.1623326     0.0001     0.000     83.74     34.03       1.9
  MS4   0.1638447     0.0001     0.000    272.36     85.44      0.68
* S4    0.1666667     0.0001     0.000     87.31     33.52       2.8
* 2MK5  0.2028035     0.0001     0.000     89.11     36.20       2.6
* 2SK5  0.2084474     0.0001     0.000     84.70     22.29       5.6
  2MN6  0.2400221     0.0000     0.000    278.41    104.74      0.56
* M6    0.2415342     0.0001     0.000    266.15     32.15         4
* 2MS6  0.2443561     0.0001     0.000     83.27     34.68       2.6
  2SM6  0.2471781     0.0000     0.000    258.44     68.99      0.97
* 3MK7  0.2833149     0.0000     0.000    261.56     16.23        19
* M8    0.3220456     0.0000     0.000     28.15      5.34        83

image

It doesn't seem like a nice fit. What am I doing wrong?

iuryt avatar Oct 16 '23 15:10 iuryt

Is it the same issue as https://github.com/moflaher/ttide_py/issues/17 ?

mdunphy avatar Oct 16 '23 16:10 mdunphy

Hi, Sorry. I just noticed that. Is there a reason why the prediction doesn't do that automatically?

iuryt avatar Oct 16 '23 17:10 iuryt