beat import KeyError: time__0
rzinke opened this issue · comments
Hi,
I completed a RectangularSource inversion for an earthquake in Tibet. The results of the inversion look great.
I used only geodetic data, and saved the files in csv format.
Now, I am trying to accomplish an ffi variable slip model. I initialize a new ffi project:
beat init Xizang --mode=ffi --datatypes=geodetic
Then, when I try to import my results from the RectangularSource...
beat import Xizang --results=Xizang --mode=geometry --datatypes=geodetic
I get the following error:
config - INFO All hierarchicals ok!
config - INFO All hyperparameters ok!
config - INFO All priors ok!
models - INFO ... Initialising Geometry Optimizer ...
models - INFO Analysing problem ...
models - INFO ---------------------
geodetic - INFO Number of geodetic datasets: 2
geodetic - INFO Number of geodetic data points: 233
geodetic - WARNING Covariance estimation not implemented (yet)! Using imported covariances!
models - INFO ... Building model ...
models - INFO Optimization for 1 hyperparameters in total!
geodetic - INFO Geodetic optimization on:
depth, dip, east_shift, length, north_shift, rake, slip, strike, width
geodetic - INFO Initialized 0 hierarchical parameters (ramps).
models - INFO Model building was successful!
backend - INFO Loading multitrace from /home/rzinke/Titan/Projects/Xizang/BeatTest1/Xizang/geometry/stage_-1
beat - INFO Importing non-linear source geometry results!
Traceback (most recent call last):
File "/home/rzinke/Miniconda/miniconda3/envs/pyrocko/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 4381, in get_value
return libindex.get_value_box(s, key)
File "pandas/_libs/index.pyx", line 52, in pandas._libs.index.get_value_box
File "pandas/_libs/index.pyx", line 48, in pandas._libs.index.get_value_at
File "pandas/_libs/util.pxd", line 113, in pandas._libs.util.get_value_at
File "pandas/_libs/util.pxd", line 98, in pandas._libs.util.validate_indexer
TypeError: 'str' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/rzinke/Miniconda/miniconda3/envs/pyrocko/bin/beat", line 33, in <module>
sys.exit(load_entry_point('beat==1.0', 'console_scripts', 'beat')())
File "/home/rzinke/Miniconda/miniconda3/envs/pyrocko/lib/python3.6/site-packages/beat-1.0-py3.6-linux-x86_64.egg/beat/apps/beat.py", line 1686, in main
globals()['command_' + command](args)
File "/home/rzinke/Miniconda/miniconda3/envs/pyrocko/lib/python3.6/site-packages/beat-1.0-py3.6-linux-x86_64.egg/beat/apps/beat.py", line 524, in command_import
summarydf, varname=param, shape=(n_sources,), roundto=0)
File "/home/rzinke/Miniconda/miniconda3/envs/pyrocko/lib/python3.6/site-packages/beat-1.0-py3.6-linux-x86_64.egg/beat/backend.py", line 1242, in extract_bounds_from_summary
values[i] = operation(summary[quant][idx] * adjust) / adjust
File "/home/rzinke/Miniconda/miniconda3/envs/pyrocko/lib/python3.6/site-packages/pandas/core/series.py", line 868, in __getitem__
result = self.index.get_value(self, key)
File "/home/rzinke/Miniconda/miniconda3/envs/pyrocko/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 4389, in get_value
raise e1
File "/home/rzinke/Miniconda/miniconda3/envs/pyrocko/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 4375, in get_value
tz=getattr(series.dtype, 'tz', None))
File "pandas/_libs/index.pyx", line 81, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 89, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1608, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'time__0'
From reading the error, I wonder if this means pandas is looking for a column in the csv of the RectangularSource that it cannot find... Have you encountered this error before?
Thanks,
Rob Zinke
What version of pandas do you have installed?
0.24.2
Ah I see, you only did geodetic estimation before, thus you did not re-estimate "time", but it tries to import it. Thats sloppy from my side. Will have to fix that in the code ... Thanks for reporting!
Should be fixed with ddf56a7 .
Please update! https://hvasbath.github.io/beat/updating.html
Please let me know if the issue persists.