I’m working on a dynamic analysis project and developing Python scripts to verify certain modelling assumptions.
One key step is comparing the source outcrop ground motion to the surface response of my FLAC2D model to evaluate the success of the deconvolution and ensure damping and boundary conditions are correctly applied. Both signals are stored in FLAC2D tables (not histories).
While itasca.history.get() allows access to history data via the API, I haven’t found a way to access table data directly from memory in the same way. Is there any method to retrieve table data in Python without exporting and re-reading from CSV files?
You can access your FLAC2D table from Fish then access the Fish variable from Python. Table cannot be passed to Python. Lists can however and - luckily for us - a table.as.list exists.
Testing scripts below on 3DEC700 did the trick, hopefully the same will go for FLAC2D.
A silly 3DEC/FLAC2D command file:
model new
table 'demo' add 1 2
table 'demo' insert 3 4
table 'demo' insert 5 6
[demo=table.as.list(table.find('demo'))]
Now, running this from the interactive IPython console:
>>> import itasca as it
>>> it.fish.get('demo')
(vec2(1.000000e+00, 2.000000e+00),
vec2(3.000000e+00, 4.000000e+00),
vec2(5.000000e+00, 6.000000e+00))
And you can seamlessly convert to a numpy array to ease post-processing:
It’s so obvious now that you’ve shown me how. I even recently learned to use table.as.list to sort and reverse the order of tables for unsaturated table and saturation-permeability table commands.
Sometimes you just some external help to clear the mental block. Thank you so much!