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

issue with datetime #101

Open
ddlenz opened this issue May 4, 2021 · 0 comments
Open

issue with datetime #101

ddlenz opened this issue May 4, 2021 · 0 comments

Comments

@ddlenz
Copy link

ddlenz commented May 4, 2021

Thank you for creating this valuable library.

I'm seeing what appears to be an issue triggered by datetime values.

Reproduce:
test file: https://www.unidata.ucar.edu/software/netcdf/examples/tos_O1_2001-2002.nc

python nc2rdf.py /Users/dlenz/Downloads/tos_O1_2001-2002.nc
Traceback (most recent call last):
  File "/Users/dlenz/git/bald/nc2rdf/nc2rdf.py", line 155, in <module>
    nc2rdf(args.ncfile, args.format, baseuri=args.baseuri)
  File "/Users/dlenz/git/bald/nc2rdf/nc2rdf.py", line 111, in nc2rdf
    ttl = root_container.rdfgraph().serialize(format=outformat).decode("utf-8")
  File "/Users/dlenz/git/bald/venv/lib/python3.9/site-packages/bald/__init__.py", line 674, in rdfgraph
    self.rdfnode(graph)
  File "/Users/dlenz/git/bald/venv/lib/python3.9/site-packages/bald/__init__.py", line 635, in rdfnode
    node = obj.rdfnode(graph)
  File "/Users/dlenz/git/bald/venv/lib/python3.9/site-packages/bald/__init__.py", line 616, in rdfnode
    rdfobj = rdflib.Literal(str(rdfobj), datatype=rdflib.XSD.dateTime)
  File "/Users/dlenz/git/bald/venv/lib/python3.9/site-packages/bald/datetime.py", line 871, in __str__
    result = str(dts[0])
  File "/Users/dlenz/git/bald/venv/lib/python3.9/site-packages/numpy/ma/core.py", line 3220, in __getitem__
    dout = self.data[indx]
IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed

Versions:

Python 3.9.4
bald       0.3.1
certifi    2020.12.5
cftime     1.4.1
chardet    4.0.0
h5py       3.2.1
idna       2.10
isodate    0.6.0
Jinja2     2.11.3
MarkupSafe 1.1.1
netCDF4    1.5.6
numpy      1.20.2
pip        21.0.1
pyparsing  2.4.7
rdflib     5.0.0
requests   2.25.1
setuptools 54.2.0
six        1.15.0
urllib3    1.26.4
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