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

Python epoch and phase computation #102

Closed
Chtululu opened this issue Nov 10, 2021 · 1 comment
Closed

Python epoch and phase computation #102

Chtululu opened this issue Nov 10, 2021 · 1 comment

Comments

@Chtululu
Copy link

Hello,

Epoch question :
In the solve function the default epoch is defined as "The default corresponds to the Python standard library datetime proleptic Gregorian calendar, starting with 1 at 00:00 on January 1 of year 1"
On the other hand, in the notebook ["utide_real_data_example.ipynb"](url), time is defined as time = mdates.date2num(obs.index.to_pydatetime()) which epoch is correspond to calendar starting with 1 at 00:00 oon January 1 of year 1970.
Finally which epoch is used in the solve function?

Phase question :
I'm having hard time to recover the phase of my signal. I use real data (sea surface elevation in the Bay of biscay)
With t = mdates.date2num(obs.index.to_pydatetime())
and where obs.index=pd.date_range(start='2017-07-09 12:00:00',end='2017-07-30 12:30:00',freq='1min')

I recover the main correct component and their corresponding amplitude, but the phase is different then expected. May this be related to my first question?

I don't know if it's related but I then started by constructing a simple signal with a semi diurnal frequency such as : Acos(wt-p).
I recover my amplitude and pulsation (w) but I couldn't recover the phase p. When I computed the phase of the signal with p= 0, meaning : A
cos(wt). The phase was around 114. I was then able to recover p when using a signal: Acos(wt-(p-114)). I thought I might use this trick for my real signal but I could'nt recover a correct phase, even with a signal made of sum of Aicos(wi*t), with i the indices of the main constituent of my signal.

@Chtululu Chtululu changed the title Struggling with epoch and phase. Python epoch and phase computation Nov 16, 2021
@Chtululu
Copy link
Author

The phase given by the code consider the epoch starting with 1 at 00:00 on January 1 of year 1 when python date2num starts with 0 at 00:00 on January 1 of year 1970.

As I use date2num I also need to use the keyword 'epoch='1970-01-01'' in coeff calculation to recover the correct phase. (This should also be the case in the notebook example)

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

No branches or pull requests

1 participant