-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Hi again,
Hit an error trying to read another CTD dataset with a non-standard instrument configuration (Woodgate et al 2020, profile #17020, obtained here).
Looks to me like the error is in reading the .xmlcon file when there is an auxiliary sensor ECO FLNTU.
I haven't looked into the details yet, and I don't know enough about the input format to know whether it is hard or easy to modify the parser function to handle this sort of thing. But if would definitely be useful!
If not (or in the meantime), it might be good to raise some more specific error for this type of issue to help the user/let them know that their dataset will not work.
hexfile = '../test_data/woodgate_bering_2017/Bstrait17020.hex'
d = ctdproc.io.CTDHex(hexfile)
Yields:
ValueError: could not convert string to float: 'FLNTURT'
Full output
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[6], line 1
----> 1 d = ctdproc.io.CTDHex(hexfile)
File ~/work/code/python/ctdproc/ctdproc/io.py:82, in CTDHex.__init__(self, filename)
73 self._mapunits_freq = dict(
74 t1="°C",
75 t2="°C",
(...)
78 p="dbar",
79 )
81 # extract all data and metadata and convert to physical units
---> 82 self._extract_physical_data()
File ~/work/code/python/ctdproc/ctdproc/io.py:85, in CTDHex._extract_physical_data(self)
84 def _extract_physical_data(self):
---> 85 self.read_xml_config()
86 self.parse_hex()
87 self.physicalunits()
File ~/work/code/python/ctdproc/ctdproc/io.py:461, in CTDHex.read_xml_config(self)
459 del cfg[kstr][k]
460 self.cfgp = pd.DataFrame(cfg)
--> 461 self._xml_coeffs_to_float()
File ~/work/code/python/ctdproc/ctdproc/io.py:475, in CTDHex._xml_coeffs_to_float(self)
473 if isinstance(self.cfgp[k]["cal"][ki], str):
474 if ki not in keep_strings:
--> 475 self.cfgp[k]["cal"][ki] = float(self.cfgp[k]["cal"][ki])
476 elif isinstance(self.cfgp[k]["cal"][ki], list):
477 for i, li in enumerate(self.cfgp[k]["cal"][ki]):
ValueError: could not convert string to float: 'FLNTURT'
<\details>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels