You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The normal way to parse the contents of a list of one or more Socet Set IPF files is with plio is via read_ipf(). plio does some magic with singledispatch to parse the input list before passing the name of each IPF file to read_ipf_str() which does the actual parsing. However, read_ipf() balks at any known valid input and emits a ValueError that traces back to read_ipf_str().
How to reproduce
from plio.io.io_bae import read_ipf,
input_data = ['example.ipf']
read_ipf(input_data)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usgs/cpkgs/appl/miniconda3_linux/envs/APPL-Tools/lib/python3.9/functools.py", line 888, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/usgs/cpkgs/appl/miniconda3_linux/envs/APPL-Tools/lib/python3.9/site-packages/plio/io/io_bae.py", line 103, in read_ipf_str
d = np.hstack(np.array(d[3:]))
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3299,) + inhomogeneous part.
Possible Solution
Change this line to d = np.hstack(np.array(d[3:], dtype=object))
I've tested this by writing a custom function that is equivalent to plio's read_ipf_str() but with the above change, and then passing the path of a single IPF to it.
Additional context
It's been a couple years since I've called read_ipf() so I'm not sure why this function suddenly stopped working. Perhaps NumPy got more strict about converting lists to arrays?
plio version(s) affected: 1.5.3 - 1.5.4
Description
The normal way to parse the contents of a list of one or more Socet Set IPF files is with plio is via
read_ipf()
. plio does some magic with singledispatch to parse the input list before passing the name of each IPF file toread_ipf_str()
which does the actual parsing. However,read_ipf()
balks at any known valid input and emits a ValueError that traces back toread_ipf_str()
.How to reproduce
Possible Solution
Change this line to
d = np.hstack(np.array(d[3:], dtype=object))
I've tested this by writing a custom function that is equivalent to plio's
read_ipf_str()
but with the above change, and then passing the path of a single IPF to it.Additional context
It's been a couple years since I've called
read_ipf()
so I'm not sure why this function suddenly stopped working. Perhaps NumPy got more strict about converting lists to arrays?Any of the IPFs in https://github.com/DOI-USGS/plio/tree/main/plio/examples/SocetSet should be suitable for testing. I discovered the issue using IPFs associated with a particular project, and reproduced the issue with https://github.com/DOI-USGS/plio/blob/cd781053658934adcf3972b762f314e36a964131/plio/examples/SocetSet/P01_001540_1889_XI_08N204W.ipf
The text was updated successfully, but these errors were encountered: