wesleybowman / UTide

Python distribution of the MatLab package UTide
MIT License
126 stars 62 forks source link

Error in Finding coefficient #111

Closed Diljit123 closed 2 years ago

Diljit123 commented 2 years ago

image

I am getting this error while running thr utide code in Jupyter. The tidal heights are returned as zero values. How can it be solved.

efiring commented 2 years ago

What kind of object is DT_hour? What is in it? How does it relate to the date_rng_hourly that you are using for plotting?

Diljit123 commented 2 years ago

image

DT_hour is an array of python datenum values from the date_rng hourly.

efiring commented 2 years ago

What versions of utide and matplotlib are you running?

Diljit123 commented 2 years ago

I am using utide version 0.3.0 and matplotlib version 3.5.2.

efiring commented 2 years ago

Good, all up to date! Try using your date_rng_hourly as the time array for solve and reconstruct. With 0.3.0 that is supposed to work. Also with this version, use of a datenum array should work if you provide the correct "epoch" keyword argument. Matplotlib changed its default epoch some time back, so it no longer matches the utide default, hence the need to include the keyword argument. With the DT_hour you have, you would need epoch="1970-01-01". The epoch is needed only when time is input as a datenum array.

Diljit123 commented 2 years ago

Thank you for the solution. This worked.