gimli-org / gimli

Geophysical Inversion and Modeling Library :earth_africa:

Home Page:https://www.pygimli.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Res2Dinv Format Error

shdlovezxm opened this issue · comments

Problem description

Excuse me Sir, I try to load a resisitivity data use format Res2Dinv. The following error occurred. Please help me. thank you very mush.

Your environment

Please provide the output of print(pygimli.Report()) here. If that does not
work, please give provide some additional information on your:

Operating system: Windows
Python version: 3.9
pyGIMLi version: 1.4.5
Way of installation: Conda package

Steps to reproduce

data = ert.load("RES2DC.txt")
print(data)
...

Actual behavior

05/12/23 - 09:57:26 - pyGIMLi - INFO - could not read unified data format for ERT ... try res2dinv
05/12/23 - 09:57:26 - pyGIMLi - INFO - could not read res2dinv ... try Ascii columns
05/12/23 - 09:57:26 - pyGIMLi - INFO - Failed importing Ascii column file. Consider using pybert.
05/12/23 - 09:57:26 - pyGIMLi - INFO - No electrode positions found!
05/12/23 - 09:57:26 - pyGIMLi - INFO - imported:  Data: Electrodes: 0 data: 0
85	25	3.8	686.649
Data: Electrodes: 0 data: 0

RES2DC.txt

A simple bug only occuring for Pole-Dipole that was corrected (eedac16)

There was an error during terrain import because the Sensors are 73, while the terrain data is only 30. How should I handle this?

print(data)
print(data.sensorCount())

Data: Sensors: 73 data: 358, nonzero entries: ['a', 'b', 'm', 'n', 'rhoa', 'valid']
73

0 1291.784
5 1289.801
10 1287.954
15 1286.057
20 1284.747
25 1282.701
30 1280.152
35 1278.045
40 1276.219
45 1274.407
50 1271.613
55 1270.119
60 1268.588
65 1266.813
70 1264.946
75 1264.023
80 1265.691
85 1265.998
90 1264.944
95 1263.731
100 1259.808
105 1256.49
110 1252.827
115 1249.332
120 1246.578
125 1243.499
130 1240.428
135 1238.206
140 1236.123
145 1234.132

Generally, topographic data are having a different discretization. However, it seems like the are not read from the res2dinv file. Try reading them with numpy and use the following function for interpolation:
https://www.pygimli.org/pygimliapi/_generated/pygimli.meshtools.html#pygimli.meshtools.interpolateAlongCurve

I understand. Thank you very much for your patient response. Good luck to you.

We enabled reading topography from res2dinv file format (48ce372).

Note that the points are read but not yet automatically applied to the electrode positions, which might make sense later in a script. One can use

data.setSensorPositions(pg.meshtools.tapeMeasureToCoordinates(data.additionalPoints(), pg.x(data)))

However, in your case there is something wrong as your electrodes go beyond zero. So either there is something wrong in your data file, or our import routine has a bug for pole-dipole in conjunction for midpoint (is it between M and N or between A and M or the mean of A,M,N?) positions specified. We will have to check but you should do so as well as independent on topography, your data are not correctly read.

Any reply to my last comment on the wrong data?

Note that we have released version v.1.4.6 supporting res2dinv topography information.

I've checked the code of the current version v1.4.6 with some other res2dinv files and the following procedure works well:

topo = data.additionalPoints()  # 
elec = pg.meshtools.tapeMeasureToCoordinates(topo, pg.x(data))
data.setSensorPositions(elec)

It assumes that the x coordinates in the data file are along the topography.
You can check the positions by

plt.plot(pg.x(topo), pg.y(topo), ".-", label="topo")
plt.plot(pg.x(elec), pg.y(elec), "+", markersize=4, label="electrodes")
plt.grid()
plt.legend()

In your case the electrodes start at -30m.

If you're sure that your format is correct and the import of Pole-Dipole data is wrong, please open a new issue.