wesleybowman / UTide

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

All results empty #112

Closed HVEC-lab closed 1 year ago

HVEC-lab commented 1 year ago

Version 0.3.0 in some cases returns empty results. As yet I have not figured out what triggers this. Will return to version 0.2.6 for now and will let you know if I find out more.

datpthus commented 1 year ago

Hello, I also got empty results on Windows but OK on MacOS. Have you figured out yet? @HVEC-lab

ocefpaf commented 1 year ago

As yet I have not figured out what triggers this.

Can you provide a reproducible example that we can use to debug this?

datpthus commented 1 year ago

z4019264181479_a867417ff43f3a992ddc53d28b57c798

@ocefpaf my students install 0.3.0 and this is what they got.

ocefpaf commented 1 year ago

@datpthus it is virtually impossible for me to reproduce that from a cropped screenshot. Can you send code, in text, with a minimal example that reproduces the problem?

datpthus commented 1 year ago

@ocefpaf sorry I misunderstood. Here is the code.

import numpy as np import matplotlib.pyplot as plt import pandas as pd from scipy import signal import utide from datetime import datetime as dt import matplotlib.dates as mdates import scipy.interpolate as sc

KLM = pd.read_excel('data.xlsx', dtype={'Y':str,'M':str,'D':str, 'H': str}) dt=KLM['Y']+'/'+KLM['M']+'/'+KLM['D']+' '+KLM['H']+ ':00:00' KLM ['datetime']=pd.to_datetime(dt) KLM=KLM.set_index('datetime')

time=mdates.date2num(KLM_jul.index.to_pydatetime())

coef = utide.solve(time,KLM_jul['sealevel'].values, lat = 20.68, method='ols', conf_int='MC')

and then it says "solve: matrix prep ... solution ... done." but nothing is produced Thanks a lot. And I attached here the data file data.xlsx

ocefpaf commented 1 year ago

This works: https://nbviewer.org/urls/gist.githubusercontent.com/ocefpaf/db8d637d24ea63a9be3878eb7167911f/raw/d9acf296b010be7fa0f05eec89b561c1b6070bd6/demo.ipynb

You are passing the wrong input as dates. Latest version takes the pandas datetime index directly now.

datpthus commented 1 year ago

Many thanks for this.

Dat Pham

Pham Tien Dat, Ph.D Department of Marine Science and Technology, VNU-Hanoi University of Science R.203-T3, 334 Nguyen Trai, Thanh Xuan, Ha Noi Tel: (+84) 1688147491 Email: @.***

Vào CN, 8 thg 1, 2023 vào lúc 00:38 Filipe @.***> đã viết:

Closed #112 https://github.com/wesleybowman/UTide/issues/112 as completed.

— Reply to this email directly, view it on GitHub https://github.com/wesleybowman/UTide/issues/112#event-8175110766, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANX3LS2QHB3NUS4S7QIYSNLWRGSYNANCNFSM6AAAAAAR5NTHEM . You are receiving this because you were mentioned.Message ID: @.***>

HVEC-lab commented 1 year ago

Ah thanks! So no need to calculate time with respect to epoch anymore?