Skip to content

issue with datetime #101

Open
Open
@ddlenz

Description

@ddlenz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions