oceanmodeling / xarray-selafin

An xarray engine for opening Selafin files (TELEMAC)
https://pypi.org/project/xarray-selafin/
The Unlicense
4 stars 2 forks source link

Time stamp error #20

Closed sebourban closed 1 month ago

sebourban commented 8 months ago

Hello,

I tried loading a geometry file using

import xarray as xr
ds = xr.open_dataset("geo.slf", engine="selafin")

and I get the following error message:

Traceback (most recent call last):
  File "/home/sebourban/opentelemac/test.py", line 2, in <module>
    ds = xr.open_dataset("geom_world06_stb.slf", engine="selafin")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sebourban/opentelemac/bin/miniforge/envs/otm-env/lib/python3.12/site-packages/xarray/backends/api.py", line 573, in open_dataset
    backend_ds = backend.open_dataset(
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/home/sebourban/opentelemac/bin/miniforge/envs/otm-env/lib/python3.12/site-packages/xarray_selafin/xarray_backend.py", line 272, in open_dataset
    times = [datetime(*slf.header.date) + timedelta(seconds=t) for t in slf.time]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: datetime.datetime() argument after * must be an iterable, not NoneType

When I try on a time varying file I get : Format "" is unknown and is forced to "SERAFIN " but maybe this is OK - just a little odd to confirm that I have a SERAFIN when I know I do ..

You probably know the answer already ? thanks for looking into it. Sébastien.

tomsail commented 8 months ago

@sebourban try to pip install xarray-selafin again and let us know if your problem was solved with the latest fix check maybe if you have the right version: it should be 0.1.4

so to be sure: pip install xarray-selafin==0.1.4