hydrogeoscience / pygtide

A Python module and wrapper for ETERNA PREDICT to compute gravitational tides on Earth
Mozilla Public License 2.0
50 stars 19 forks source link

Cannot initialize pygtide #20

Closed strawpants closed 2 years ago

strawpants commented 2 years ago

Thanks for this initiative! I can imagine it took a fair amount of effort to modify the original code.

I just tried it out but it somehow failed to properly initialize the module

Python 3.8.11 (default, Aug  5 2021, 09:13:46) 
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygtide
>>> pt=pygtide.pygtide()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/roelof/UTwente/Soft/pygtide/pygtide.py", line 135, in __init__
    self.etpolut1_end = dt.datetime.strptime(str(etpred.inout.etpol_end), "%Y%m%d")
  File "/usr/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/lib/python3.8/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '0' does not match format '%Y%m%d'
>>>

I suspect it's because etpred.inout.etpol_end is zero and is not properly initiated from the fortran part of the module?

Furthermore, I'm aware of issue https://github.com/hydrogeoscience/pygtide/issues/3 and can therefore understand that it's unclear whether you're allowed to share your modified code. Nevertheless, things would definitely be easier when access to the fortran code was there. So maybe we should gather some voices and make a plead to release eterna under a clearer license?

Thanks again, Roelof

hydrogeoscience commented 2 years ago

This error is related to the operating system which created the underlying database files and the EOL character they use. I have fixed this recently so it should work now.

hydrogeoscience commented 2 years ago

Please try our new version v0.6

strawpants commented 2 years ago

Just tried it, and it works with python 3.10. Thanks for packaging this.

hydrogeoscience commented 2 years ago

Thanks for the feedback, very happy to hear. Also sorry about the delay, academic duties come first unfortunately.