cemsbv / pygef

Parse soil measurement data.
https://cemsbv.github.io/pygef
MIT License
31 stars 19 forks source link

exceptions.ComputeError: arithmetic on string and numeric not allowed, try an explicit cast first #329

Closed RDWimmers closed 1 year ago

RDWimmers commented 1 year ago

Cast dtype incorrect

image_480

import pygef
pygef.read_cpt("./CPT000000207291.xml")
Backend TkAgg is interactive backend. Turning interactive mode on.
/home/robin/Documents/Repositories/pygef/src/pygef/_version.py:4: UserWarning: Module pygef was already imported from /home/robin/Documents/Repositories/pygef/src/pygef/__init__.py, but /home/robin/Documents/Repositories/pygef/venv/lib/python3.9/site-packages/pygef-0.8.0a3-py3.9.egg is being added to sys.path
  __version__ = pkg_resources.get_distribution("pygef").version
Traceback (most recent call last):
  File "/home/robin/Documents/Repositories/pygef/venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3460, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-78a60a536ef3>", line 3, in <module>
    pygef.read_cpt("./CPT000000207291.xml")
  File "/home/robin/Documents/Repositories/pygef/src/pygef/shim.py", line 87, in read_cpt
    return read_cpt_xml(file)[index]
  File "/home/robin/Documents/Repositories/pygef/src/pygef/broxml/parse_cpt.py", line 202, in read_cpt
    return read_xml(root, CPTData, CPT_ATTRIBS, "dispatchDocument")
  File "/home/robin/Documents/Repositories/pygef/src/pygef/broxml/xml_parser.py", line 47, in read_xml
    out.append(constructor(**resolved))
  File "<string>", line 42, in __init__
  File "/home/robin/Documents/Repositories/pygef/src/pygef/cpt.py", line 157, in __post_init__
    self.data.lazy()
  File "/home/robin/Documents/Repositories/pygef/venv/lib/python3.9/site-packages/polars/lazyframe/frame.py", line 1443, in collect
    return pli.wrap_df(ldf.collect())
exceptions.ComputeError: arithmetic on string and numeric not allowed, try an explicit cast first
RDWimmers commented 1 year ago

https://www.bro-productomgeving.nl/bpo/latest/bodem-en-grondonderzoek/geotechnisch-sondeeronderzoek-cpt/koppelvlakbeschrijving-uitgifteservice-cpt

Parameters | onderdeel van Kenmerkenverzameling CPT
-- | --
correctedConeResistance | gecorrigeerde conusweerstand
depth | diepte
elapsedTime | verlopen tijd
electricalConductivity | elektrische geleidbaarheid
frictionRatio | wrijvingsgetal
inclinationEW | helling oost-west
inclinationNS | helling noord-zuid
inclinationResultant | hellingresultante
inclinationX | helling x
inclinationY | helling y
localFriction | plaatselijke wrijving
magneticDeclination | magnetische declinatie
magneticInclination | magnetische inclinatie
magneticFieldStrengthX | magnetische veldsterkte x
magneticFieldStrengthY | magnetische veldsterkte y
magneticFieldStrengthZ | magnetische veldsterkte z
magneticFieldStrengthTotal | totale magnetische veldsterkte
netConeResistance | netto conusweerstand
poreRatio | porienratio
porePressureU1 | waterspanning u1
porePressureU2 | waterspanning u2
porePressureU3 | waterspanning u3
temperature | temperatuur

Can only be floats in Parameters object