gimli-org / gimli

Geophysical Inversion and Modeling Library :earth_africa:
https://www.pygimli.org
Other
370 stars 134 forks source link

There is a requested electrode that does not match the given mesh #510

Closed Abby123455r closed 1 year ago

Abby123455r commented 1 year ago

I want to delineat the behaviour of spacific region (top 2m which is contaminated).i want to decouple both zones top 2m and buttom,to look in detail at the at contaminated zone and corelate it with available soil chemistry. For this purpose i creat a geometry and devided it in to two region.

world = mt.createWorld(start=[-160, 0], end=[50, -50], layers=[-2],
                       worldMarker=True)
#creat mesh and add the electrodes
for s in data.sensors():
    world.createNode(s)
    world.createNode(s - [0, 0.1])
mesh = mt.createMesh (world)
pg.show(mesh, markers=True, showMesh=True);
mgr.invert(data,mesh=mesh,lam=20)
but when i perform inversion it shows There is a requested electrode that does not match the given mesh.

Could you please guide me where i am doing wrong.

halbmy commented 1 year ago

I would need to see the data to check this. I guess the sensors are out of the modelling domain.

Abby123455r commented 1 year ago

Here is data file C:\SAS4000\nabeel\FIELDE~1\lr00034.s4k 2.0 7 418
0 0 0.00 12.00 6.000000 47.298479 4.00 12.00 6.000000 42.322980 0.00 8.00 8.000000 54.963475 4.00 8.00 8.000000 58.306760 8.00 8.00 8.000000 56.663793 12.00 8.00 8.000000 53.893469 16.00 8.00 8.000000 42.885257 20.00 8.00 8.000000 35.003286 24.00 8.00 8.000000 37.492477 0.00 8.00 7.000000 49.599139 4.00 8.00 7.000000 49.531404 8.00 8.00 7.000000 61.094701 12.00 8.00 7.000000 64.578000 16.00 8.00 7.000000 62.666886 20.00 8.00 7.000000 60.218747 24.00 8.00 7.000000 49.963042 28.00 8.00 7.000000 40.143788 32.00 8.00 7.000000 43.059874 36.00 8.00 7.000000 51.715841 40.00 8.00 7.000000 49.069151 0.00 8.00 6.000000 39.106673 4.00 8.00 6.000000 53.142175 8.00 8.00 6.000000 53.931172 12.00 8.00 6.000000 49.049141 16.00 8.00 6.000000 57.813461 20.00 8.00 6.000000 67.416129 24.00 8.00 6.000000 73.120924 28.00 8.00 6.000000 70.318868 32.00 8.00 6.000000 57.509740 36.00 8.00 6.000000 45.339866 40.00 8.00 6.000000 50.521509 44.00 8.00 6.000000 60.549253 48.00 8.00 6.000000 56.802913 52.00 8.00 6.000000 53.517071 56.00 8.00 6.000000 59.968052 0.00 8.00 5.000000 70.115889 4.00 8.00 5.000000 49.030825 8.00 8.00 5.000000 37.401809 12.00 8.00 5.000000 53.621111 16.00 8.00 5.000000 56.637125 20.00 8.00 5.000000 52.618604 24.00 8.00 5.000000 64.279714 28.00 8.00 5.000000 69.368068 32.00 8.00 5.000000 70.516750 36.00 8.00 5.000000 76.628907 40.00 8.00 5.000000 68.560234 44.00 8.00 5.000000 53.916288 48.00 8.00 5.000000 58.121167 52.00 8.00 5.000000 63.288937 56.00 8.00 5.000000 57.540385 60.00 8.00 5.000000 58.356528 64.00 8.00 5.000000 64.388561 68.00 8.00 5.000000 69.147369 72.00 8.00 5.000000 71.651417 0.00 8.00 4.000000 63.951719 4.00 8.00 4.000000 71.181630 8.00 8.00 4.000000 65.631825 12.00 8.00 4.000000 44.879518 16.00 8.00 4.000000 35.042990 20.00 8.00 4.000000 54.707766 24.00 8.00 4.000000 57.814713 28.00 8.00 4.000000 53.410631 32.00 8.00 4.000000 70.247632 36.00 8.00 4.000000 77.376508 40.00 8.00 4.000000 79.731692 44.00 8.00 4.000000 80.289708 48.00 8.00 4.000000 65.851114 52.00 8.00 4.000000 53.209460 56.00 8.00 4.000000 61.255145 60.00 8.00 4.000000 70.175636 64.00 8.00 4.000000 62.049984 68.00 8.00 4.000000 61.197156 72.00 8.00 4.000000 71.745368 76.00 8.00 4.000000 76.259758 80.00 8.00 4.000000 79.280704 84.00 8.00 4.000000 54.952824 88.00 8.00 4.000000 31.055836 0.00 8.00 3.000000 58.510021 4.00 8.00 3.000000 54.840669 8.00 8.00 3.000000 59.043338 12.00 8.00 3.000000 66.329701 16.00 8.00 3.000000 62.213353 20.00 8.00 3.000000 43.295343 24.00 8.00 3.000000 33.441288 28.00 8.00 3.000000 51.495816 32.00 8.00 3.000000 57.971311 36.00 8.00 3.000000 54.664909 40.00 8.00 3.000000 72.139986 44.00 8.00 3.000000 81.070082 48.00 8.00 3.000000 88.413290 52.00 8.00 3.000000 85.611947 56.00 8.00 3.000000 66.558958 60.00 8.00 3.000000 51.930102 64.00 8.00 3.000000 54.445063 68.00 8.00 3.000000 69.571751 72.00 8.00 3.000000 73.522011 76.00 8.00 3.000000 74.549039 80.00 8.00 3.000000 86.684487 84.00 8.00 3.000000 87.607186 88.00 8.00 3.000000 86.925020 92.00 8.00 3.000000 54.254078 96.00 8.00 3.000000 30.547217 100.00 8.00 3.000000 56.322310 104.00 8.00 3.000000 76.240262 0.00 8.00 2.000000 40.413449 4.00 8.00 2.000000 41.457474 8.00 8.00 2.000000 42.729084 12.00 8.00 2.000000 49.020987 16.00 8.00 2.000000 60.605855 20.00 8.00 2.000000 60.833238 24.00 8.00 2.000000 68.845287 28.00 8.00 2.000000 45.067289 32.00 8.00 2.000000 33.653427 36.00 8.00 2.000000 56.384535 40.00 8.00 2.000000 66.010248 44.00 8.00 2.000000 57.245965 48.00 8.00 2.000000 80.222147 52.00 8.00 2.000000 81.114133 56.00 8.00 2.000000 87.345945 60.00 8.00 2.000000 93.808878 64.00 8.00 2.000000 80.064297 68.00 8.00 2.000000 59.749467 72.00 8.00 2.000000 66.348491 76.00 8.00 2.000000 76.567665 80.00 8.00 2.000000 79.577147 84.00 8.00 2.000000 97.758235 88.00 8.00 2.000000 124.274708 92.00 8.00 2.000000 104.347227 96.00 8.00 2.000000 109.297992 100.00 8.00 2.000000 63.498765 104.00 8.00 2.000000 33.850735 108.00 8.00 2.000000 65.259430 112.00 8.00 2.000000 96.209825 116.00 8.00 2.000000 86.972181 120.00 8.00 2.000000 87.947550 0.00 8.00 1.000000 28.061746 4.00 8.00 1.000000 27.254345 8.00 8.00 1.000000 28.554082 12.00 8.00 1.000000 34.702612 16.00 8.00 1.000000 41.400470 20.00 8.00 1.000000 40.005530 24.00 8.00 1.000000 47.201359 28.00 8.00 1.000000 96.221102 32.00 8.00 1.000000 153.281017 36.00 8.00 1.000000 62.267642 40.00 8.00 1.000000 60.476198 44.00 8.00 1.000000 130.170170 48.00 8.00 1.000000 157.822894 52.00 8.00 1.000000 72.493883 56.00 8.00 1.000000 80.979439 60.00 8.00 1.000000 106.604570 64.00 8.00 1.000000 109.385689 68.00 8.00 1.000000 143.130558 72.00 8.00 1.000000 118.158118 76.00 8.00 1.000000 92.900669 80.00 8.00 1.000000 133.028971 84.00 8.00 1.000000 162.381681 88.00 8.00 1.000000 129.989796 92.00 8.00 1.000000 102.678442 96.00 8.00 1.000000 117.886903 100.00 8.00 1.000000 133.834491 104.00 8.00 1.000000 225.665927 108.00 8.00 1.000000 106.615847 112.00 8.00 1.000000 54.373393 116.00 8.00 1.000000 103.579165 120.00 8.00 1.000000 220.978729 124.00 8.00 1.000000 122.817740 128.00 8.00 1.000000 80.332387 132.00 8.00 1.000000 84.663791 136.00 8.00 1.000000 90.789773 0.00 4.00 8.000000 60.929072 4.00 4.00 8.000000 69.170949 8.00 4.00 8.000000 71.296149 12.00 4.00 8.000000 62.694189 16.00 4.00 8.000000 29.838515 20.00 4.00 8.000000 41.592771 24.00 4.00 8.000000 68.359169 28.00 4.00 8.000000 50.044414 32.00 4.00 8.000000 59.767765 36.00 4.00 8.000000 80.987233 40.00 4.00 8.000000 75.280431 44.00 4.00 8.000000 89.657286 48.00 4.00 8.000000 76.251531 52.00 4.00 8.000000 56.235906 56.00 4.00 8.000000 47.739933 60.00 4.00 8.000000 75.419878 64.00 4.00 8.000000 69.807250 68.00 4.00 8.000000 56.370008 72.00 4.00 8.000000 69.926366 76.00 4.00 8.000000 76.904005 80.00 4.00 8.000000 80.713975 84.00 4.00 8.000000 79.033331 88.00 4.00 8.000000 29.482313 92.00 4.00 8.000000 31.734504 0.00 4.00 7.000000 58.387453 4.00 4.00 7.000000 57.561655 8.00 4.00 7.000000 65.892487 12.00 4.00 7.000000 67.980609 16.00 4.00 7.000000 61.439760 20.00 4.00 7.000000 28.795867 24.00 4.00 7.000000 40.602761 28.00 4.00 7.000000 66.813269 32.00 4.00 7.000000 49.756626 36.00 4.00 7.000000 61.200323 40.00 4.00 7.000000 81.205522 44.00 4.00 7.000000 77.737978 48.00 4.00 7.000000 94.480402 52.00 4.00 7.000000 76.468267 56.00 4.00 7.000000 56.267076 60.00 4.00 7.000000 46.192866 64.00 4.00 7.000000 69.428810 68.00 4.00 7.000000 75.223021 72.00 4.00 7.000000 61.512791 76.00 4.00 7.000000 77.762689 80.00 4.00 7.000000 82.105322 84.00 4.00 7.000000 84.868125 88.00 4.00 7.000000 81.742777 92.00 4.00 7.000000 28.274798 96.00 4.00 7.000000 32.678222 100.00 4.00 7.000000 82.922899 0.00 4.00 6.000000 53.348158 4.00 4.00 6.000000 58.285124 8.00 4.00 6.000000 51.445074 12.00 4.00 6.000000 63.257315 16.00 4.00 6.000000 67.992733 20.00 4.00 6.000000 58.694451 24.00 4.00 6.000000 28.813713 28.00 4.00 6.000000 40.172148 32.00 4.00 6.000000 67.683621 36.00 4.00 6.000000 48.156507 40.00 4.00 6.000000 62.654643 44.00 4.00 6.000000 84.750591 48.00 4.00 6.000000 77.440920 52.00 4.00 6.000000 93.070727 56.00 4.00 6.000000 79.456393 60.00 4.00 6.000000 60.884956 64.00 4.00 6.000000 45.939436 68.00 4.00 6.000000 65.184460 72.00 4.00 6.000000 73.529272 76.00 4.00 6.000000 71.074244 80.00 4.00 6.000000 91.087428 84.00 4.00 6.000000 92.629811 88.00 4.00 6.000000 85.749330 92.00 4.00 6.000000 83.053887 96.00 4.00 6.000000 30.033225 100.00 4.00 6.000000 33.596382 104.00 4.00 6.000000 82.591076 108.00 4.00 6.000000 73.320505 0.00 4.00 5.000000 42.890316 4.00 4.00 5.000000 45.536133 8.00 4.00 5.000000 50.844688 12.00 4.00 5.000000 52.615773 16.00 4.00 5.000000 56.665314 20.00 4.00 5.000000 67.876397 24.00 4.00 5.000000 63.210807 28.00 4.00 5.000000 27.905812 32.00 4.00 5.000000 41.557068 36.00 4.00 5.000000 69.236717 40.00 4.00 5.000000 47.465704 44.00 4.00 5.000000 64.599951 48.00 4.00 5.000000 88.511530 52.00 4.00 5.000000 74.693395 56.00 4.00 5.000000 91.044082 60.00 4.00 5.000000 87.713314 64.00 4.00 5.000000 65.554675 68.00 4.00 5.000000 49.238632 72.00 4.00 5.000000 69.994302 76.00 4.00 5.000000 73.089383 80.00 4.00 5.000000 74.460989 84.00 4.00 5.000000 113.344717 88.00 4.00 5.000000 103.411341 92.00 4.00 5.000000 90.445751 96.00 4.00 5.000000 90.898973 100.00 4.00 5.000000 32.710448 104.00 4.00 5.000000 34.772708 108.00 4.00 5.000000 92.061003 112.00 4.00 5.000000 79.862339 116.00 4.00 5.000000 79.042113 0.00 4.00 4.000000 38.352055 4.00 4.00 4.000000 38.771417 8.00 4.00 4.000000 39.712381 12.00 4.00 4.000000 42.145864 16.00 4.00 4.000000 47.460680 20.00 4.00 4.000000 68.160032 24.00 4.00 4.000000 65.215373 28.00 4.00 4.000000 70.658601 32.00 4.00 4.000000 31.875664 36.00 4.00 4.000000 42.662624 40.00 4.00 4.000000 84.113207 44.00 4.00 4.000000 54.126827 48.00 4.00 4.000000 73.491963 52.00 4.00 4.000000 78.055833 56.00 4.00 4.000000 74.160908 60.00 4.00 4.000000 101.567242 64.00 4.00 4.000000 91.131776 68.00 4.00 4.000000 75.329902 72.00 4.00 4.000000 58.101095 76.00 4.00 4.000000 85.297384 80.00 4.00 4.000000 91.686122 84.00 4.00 4.000000 80.633468 88.00 4.00 4.000000 112.268908 92.00 4.00 4.000000 122.349177 96.00 4.00 4.000000 110.351020 100.00 4.00 4.000000 116.287136 104.00 4.00 4.000000 35.789802 108.00 4.00 4.000000 41.801767 112.00 4.00 4.000000 110.668520 116.00 4.00 4.000000 90.441567 120.00 4.00 4.000000 102.750700 124.00 4.00 4.000000 62.903234 0.00 4.00 3.000000 28.297892 4.00 4.00 3.000000 32.148385 8.00 4.00 3.000000 32.737461 12.00 4.00 3.000000 37.289552 16.00 4.00 3.000000 38.949753 20.00 4.00 3.000000 38.510991 24.00 4.00 3.000000 66.571123 28.00 4.00 3.000000 105.928714 32.00 4.00 3.000000 80.357446 36.00 4.00 3.000000 40.884074 40.00 4.00 3.000000 61.857363 44.00 4.00 3.000000 125.582576 48.00 4.00 3.000000 73.929337 52.00 4.00 3.000000 69.648034 56.00 4.00 3.000000 76.669762 60.00 4.00 3.000000 79.587645 64.00 4.00 3.000000 116.910377 68.00 4.00 3.000000 111.062504 72.00 4.00 3.000000 88.119601 76.00 4.00 3.000000 77.679277 80.00 4.00 3.000000 125.069576 84.00 4.00 3.000000 126.251565 88.00 4.00 3.000000 94.062327 92.00 4.00 3.000000 102.585726 96.00 4.00 3.000000 122.644631 100.00 4.00 3.000000 152.151665 104.00 4.00 3.000000 156.251942 108.00 4.00 3.000000 49.850662 112.00 4.00 3.000000 51.333108 116.00 4.00 3.000000 148.075828 120.00 4.00 3.000000 142.790596 124.00 4.00 3.000000 95.112657 128.00 4.00 3.000000 62.061260 132.00 4.00 3.000000 70.442386 0.00 4.00 2.000000 28.616266 4.00 4.00 2.000000 24.115877 8.00 4.00 2.000000 25.801464 12.00 4.00 2.000000 27.378982 16.00 4.00 2.000000 34.939695 20.00 4.00 2.000000 44.859635 24.00 4.00 2.000000 41.665119 28.00 4.00 2.000000 58.175634 32.00 4.00 2.000000 119.363590 36.00 4.00 2.000000 174.354581 40.00 4.00 2.000000 49.640168 44.00 4.00 2.000000 105.004173 48.00 4.00 2.000000 237.382658 52.00 4.00 2.000000 74.045432 56.00 4.00 2.000000 82.691332 60.00 4.00 2.000000 116.723405 64.00 4.00 2.000000 86.780319 68.00 4.00 2.000000 126.089014 72.00 4.00 2.000000 157.611493 76.00 4.00 2.000000 127.175145 80.00 4.00 2.000000 115.419276 84.00 4.00 2.000000 194.368303 88.00 4.00 2.000000 157.743025 92.00 4.00 2.000000 106.273527 96.00 4.00 2.000000 129.105021 100.00 4.00 2.000000 112.747372 104.00 4.00 2.000000 130.559478 108.00 4.00 2.000000 260.312807 112.00 4.00 2.000000 69.230592 116.00 4.00 2.000000 69.433805 120.00 4.00 2.000000 259.418322 124.00 4.00 2.000000 133.829167 128.00 4.00 2.000000 100.202990 132.00 4.00 2.000000 85.420778 136.00 4.00 2.000000 97.156908 140.00 4.00 2.000000 104.751434 0.00 4.00 1.000000 20.797324 4.00 4.00 1.000000 34.989179 8.00 4.00 1.000000 22.050081 12.00 4.00 1.000000 28.638328 16.00 4.00 1.000000 31.732325 20.00 4.00 1.000000 42.448400 24.00 4.00 1.000000 64.417684 28.00 4.00 1.000000 62.685747 32.00 4.00 1.000000 81.220286 36.00 4.00 1.000000 93.534257 40.00 4.00 1.000000 189.990867 44.00 4.00 1.000000 121.753529 48.00 4.00 1.000000 159.383840 52.00 4.00 1.000000 244.477637 56.00 4.00 1.000000 125.450099 60.00 4.00 1.000000 149.553144 64.00 4.00 1.000000 177.985394 68.00 4.00 1.000000 108.733628 72.00 4.00 1.000000 167.956144 76.00 4.00 1.000000 177.325495 80.00 4.00 1.000000 230.114783 84.00 4.00 1.000000 175.655577 88.00 4.00 1.000000 244.843755 92.00 4.00 1.000000 182.322425 96.00 4.00 1.000000 132.674753 100.00 4.00 1.000000 163.444958 104.00 4.00 1.000000 106.579523 108.00 4.00 1.000000 104.373419 112.00 4.00 1.000000 177.699774 116.00 4.00 1.000000 119.196970 120.00 4.00 1.000000 107.584233 124.00 4.00 1.000000 217.778270 128.00 4.00 1.000000 109.077515 132.00 4.00 1.000000 132.281371 136.00 4.00 1.000000 122.633591 140.00 4.00 1.000000 121.412470 144.00 4.00 1.000000 150.155088 148.00 4.00 1.000000 122.260270 0 0 0 0 0 0

halbmy commented 1 year ago

Your model goes from x=-160 to +50, whereas your electrodes go from 0 to 160, so they are outside.

halbmy commented 1 year ago

As you're having two regions, by default the first will be treated as background. So you will have to set them not to (inv.setRegularization(1, background=False)) or adding a background region (by mt.appendTriangleBoundary()) which is always a good idea.

Abby123455r commented 1 year ago

When i read the data file that i sent you before it shows the following statment.

17/03/23 - 09:58:49 - pyGIMLi - INFO - could not read unified data format for ERT ... try res2dinv

In the above data file First data point. For each data point, list the x-location, Then a' electrode spacing, then 'n' factor, and in forth colume apparent resistivity value.

halbmy commented 1 year ago

The info message is normal as pyGIMLi has to guess the format. The data are nicely read: image

But the electrodes are outside of the model as explained above (model goes from -160 to +50 and electrodes go from 0 to 160).

Abby123455r commented 1 year ago
world = mt.createWorld(start=[0, 0], end=[160, -40], layers=[-2],
                       worldMarker=True)
                        pg.show(world)
for s in data.sensors():
    world.createNode(s)
    world.createNode(s - [0, 0.1])

mesh = mt.createMesh (world)
pg.show(mesh, markers=True, showMesh=True)
data["k"] = pg.Vector(data.size(), 1.0)
out1 = ert.simulate(mesh=mesh, scheme=data, res=1.0, calcOnly=True)
print(out1)
data["err"] = ert.estimateError(data, relativeError=0.02, absoluteUError=0)
mgr = ert.ERTManager(data, sr=False)
mgr.inv.setRegularization(1, background=False)
mgr.invert()
mgr.showResult(**kw);

then i get the final section. Actully i want to decouple two zones as you did it in lake example and then want to see the top zone (2m) in more detail where i soil geochemistry data.as in lake example they delineate the water cells by extracting the water body to see the zone for more detail. image

halbmy commented 1 year ago

I have no idea what you want with out as it is never used. You should compute the geometric factors by data["k"]=ert.geometricFactors(data) instead. I even don't know what you want to do with the mesh as you don't use it. You should do use it in inversion by mgr.invert(mesh=mesh).

However, the mesh it not really suited for inversion as it is far too small (now the first and last electrodes are on the corners). You need some space around the electrodes and better also a background region.

Abby123455r commented 1 year ago

Thanks solved