Skip to content

Commit

Permalink
Remove unnecessary rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
verveerpj committed Jul 6, 2024
1 parent 0032df5 commit d31dc58
Show file tree
Hide file tree
Showing 8 changed files with 298 additions and 307 deletions.
26 changes: 8 additions & 18 deletions src/everest_models/jobs/fm_well_trajectory/read_trajectories.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
P3: Final = tuple(f"p3_{tag}" for tag in ("x", "y", "z"))
PLATFORMS: Final = tuple(f"platform_{tag}" for tag in ("x", "y", "k"))

ROUND = 3


class _Point(NamedTuple):
x: float
Expand Down Expand Up @@ -61,9 +59,6 @@ def _get_from_platform_file(platform_file: str, attr: str) -> Optional[float]:
# If necessary, get the value from the platform configuration:
value = getattr(platform_config, attr)

if value is not None:
value = round(value, ROUND)

return value

px = _get_from_platform_file("platform_x", "x")
Expand All @@ -86,25 +81,20 @@ def _get_rescaled_point(
) -> _Point:
px, py, pz = (input_files[item][well_name] for item in point_files)
return _Point(
x=round(_rescale(px, scales.x, references.x), ROUND),
y=round(_rescale(py, scales.y, references.y), ROUND),
z=round(_rescale(pz, scales.z, references.z), ROUND),
x=_rescale(px, scales.x, references.x),
y=_rescale(py, scales.y, references.y),
z=_rescale(pz, scales.z, references.z),
)


def _construct_midpoint(
well: str, input_files: Dict[str, Any], p1: _Point, p3: _Point
) -> Tuple[float, float, float]:
a, b, c = [round(input_files[key][well], ROUND) for key in P2]
return _Point._make(
numpy.round(
[
b * (p3.y - p1.y) + a * (p3.x - p1.x) + p1.x,
b * (p1.x - p3.x) + a * (p3.y - p1.y) + p1.y,
p3.z + c * (p1.z - p3.z),
],
ROUND,
)
a, b, c = [input_files[key][well] for key in P2]
return _Point(
x=b * (p3.y - p1.y) + a * (p3.x - p1.x) + p1.x,
y=b * (p1.x - p3.x) + a * (p3.y - p1.y) + p1.y,
z=p3.z + c * (p1.z - p3.z),
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def well_trajectory_arguments():
return ("-c config.yml -E SPE1CASE1").split()


@pytest.mark.slow
@pytest.mark.resinsight
def test_failing_start_resinsight(caplog):
caplog.set_level(logging.INFO)
Expand Down
100 changes: 50 additions & 50 deletions tests/testdata/well_trajectory/simple/expected/PATH_OP_4.txt
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
0.000000 461335.480000 5933608.040000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
200.000000 461335.480000 5933608.040000 200.000000 0.000000 0.000000 142.153555 0.537725 0.081949
230.532708 461335.655810 5933607.813726 230.531364 0.175810 -0.226274 142.153555 1.565567 1.026068
261.096805 461336.168146 5933607.154331 261.084052 0.688146 -0.885669 142.153555 2.522185 0.953985
291.697605 461336.994365 5933606.090957 291.655207 1.514365 -1.949043 142.153555 3.407687 0.882006
322.338549 461338.111823 5933604.652748 322.241974 2.631823 -3.387252 142.153555 4.222339 0.810373
353.021349 461339.497877 5933602.868845 352.841496 4.017877 -5.171155 142.153555 4.966520 0.739262
383.746128 461341.129886 5933600.768390 383.450917 5.649886 -7.271610 142.153555 5.640686 0.668795
414.511562 461342.985205 5933598.380526 414.067381 7.505205 -9.659474 142.153555 6.245335 0.599039
445.315025 461345.041192 5933595.734396 444.688031 9.561192 -12.305604 142.153555 6.780980 0.530020
476.152723 461347.275204 5933592.859140 475.310012 11.795204 -15.180860 142.153555 7.248119 0.461721
507.019833 461349.664598 5933589.783902 505.930466 14.184598 -18.256098 142.153555 7.647218 0.394094
537.910642 461352.186731 5933586.537825 536.546539 16.706731 -21.502175 142.153555 7.978688 0.327062
568.818673 461354.818961 5933583.150049 567.155372 19.338961 -24.889951 142.153555 8.242870 0.260524
599.736820 461357.538643 5933579.649718 597.754112 22.058643 -28.390282 142.153555 8.440024 0.194361
630.657478 461360.323136 5933576.065974 628.339900 24.843136 -31.974026 142.153555 8.570318 0.128437
661.572667 461363.149796 5933572.427959 658.909881 27.669796 -35.612041 142.153555 8.633819 0.062607
692.474162 461365.995981 5933568.764815 689.461199 30.515981 -39.275185 142.153555 8.630489 0.003285
723.353619 461368.839047 5933565.105685 719.990997 33.359047 -42.934315 142.153555 8.560182 0.069397
754.202698 461371.656352 5933561.479711 750.496419 36.176352 -46.560289 142.153555 8.422644 0.135893
785.013194 461374.425252 5933557.916035 780.974610 38.945252 -50.123965 142.153555 8.217513 0.202931
815.777162 461377.123105 5933554.443799 811.422711 41.643105 -53.596201 142.153555 7.944323 0.270668
846.487047 461379.727267 5933551.092146 841.837869 44.247267 -56.947854 142.153555 7.602515 0.339250
877.135814 461382.215097 5933547.890219 872.217225 46.735097 -60.149781 142.153555 7.191440 0.408812
907.717084 461384.563950 5933544.867158 902.557925 49.083950 -63.172842 142.153555 6.710375 0.479471
938.225266 461386.751185 5933542.052108 932.857111 51.271185 -65.987892 142.153555 6.158542 0.551324
968.655702 461388.754157 5933539.474209 963.111928 53.274157 -68.565791 142.153555 5.535121 0.624437
999.004803 461390.550224 5933537.162604 993.319519 55.070224 -70.877396 142.153555 4.839277 0.698845
1029.270200 461392.116744 5933535.146436 1023.477028 56.636744 -72.893564 142.153555 4.070190 0.774540
1059.450891 461393.431073 5933533.454847 1053.581598 57.951073 -74.585153 142.153555 3.227087 0.851465
1089.547392 461394.470568 5933532.116978 1083.630375 58.990568 -75.923022 142.153555 2.309275 0.929506
1119.561893 461395.212586 5933531.161973 1113.620500 59.732586 -76.878027 142.153555 1.316194 1.008483
1149.498411 461395.634485 5933530.618974 1143.549119 60.154485 -77.421026 129.594661 0.124577 1.216597
1179.372855 461395.684538 5933530.577575 1173.423493 60.204538 -77.462425 331.285855 3.348737 3.535029
1209.408928 461394.841604 5933532.116323 1203.408279 59.361604 -75.923677 331.294059 7.224221 3.932764
1239.747940 461393.009104 5933535.462630 1233.506449 57.529104 -72.577370 331.303628 10.588334 3.379746
1270.408362 461390.303890 5933540.404546 1263.644809 54.823890 -67.635454 331.314493 13.469195 2.863910
1301.365181 461386.842819 5933546.730120 1293.750170 51.362819 -61.309880 331.326860 15.899429 2.392803
1332.557647 461382.742745 5933554.227401 1323.749339 47.262745 -53.812599 331.341036 17.910844 1.965476
1363.896219 461378.120521 5933562.684439 1353.569125 42.640521 -45.355561 331.357438 19.531043 1.575820
1395.268581 461373.093003 5933571.889283 1383.136337 37.613003 -36.150717 331.376626 20.781318 1.214729
1426.544815 461367.777046 5933581.629982 1412.377783 32.297046 -26.410018 331.399373 21.675253 0.871214
1457.581867 461362.289503 5933591.694586 1441.220272 26.809503 -16.345414 331.426766 22.217596 0.532704
1488.227509 461356.747229 5933601.871144 1469.590614 21.267229 -6.168856 331.460388 22.403028 0.184866
1518.324018 461351.267079 5933611.947705 1497.415615 15.787079 3.907705 331.529556 24.059861 1.678172
1548.158336 461345.468827 5933622.639907 1524.657928 9.988827 14.599907 331.610287 27.914135 3.937854
1578.386652 461338.740351 5933635.089304 1551.369184 3.260351 27.049304 331.658818 31.056928 3.169051
1609.000353 461331.242947 5933648.989550 1577.594569 -4.237053 40.949550 331.687211 33.508027 2.440441
1639.923958 461323.146198 5933664.018806 1603.378933 -12.333802 55.978806 331.701482 35.315168 1.781235
1671.037528 461314.619688 5933679.855236 1628.767127 -20.860312 71.815236 331.704562 36.515225 1.175621
1702.189589 461305.833000 5933696.177000 1653.804000 -29.647000 88.137000 331.704562 36.515225 0.000000
200.000000 461335.480000 5933608.040000 200.000000 0.000000 0.000000 142.153577 0.537725 0.081949
230.532707 461335.655810 5933607.813726 230.531363 0.175810 -0.226274 142.153577 1.565567 1.026068
261.096803 461336.168146 5933607.154331 261.084049 0.688146 -0.885669 142.153577 2.522184 0.953985
291.697601 461336.994364 5933606.090957 291.655203 1.514364 -1.949043 142.153577 3.407686 0.882006
322.338543 461338.111821 5933604.652748 322.241968 2.631821 -3.387252 142.153577 4.222338 0.810373
353.021341 461339.497874 5933602.868844 352.841488 4.017874 -5.171156 142.153577 4.966519 0.739262
383.746117 461341.129882 5933600.768389 383.450907 5.649882 -7.271611 142.153577 5.640685 0.668795
414.511549 461342.985200 5933598.380525 414.067368 7.505200 -9.659475 142.153577 6.245335 0.599040
445.315009 461345.041186 5933595.734394 444.688015 9.561186 -12.305606 142.153577 6.780979 0.530020
476.152704 461347.275196 5933592.859138 475.309993 11.795196 -15.180862 142.153577 7.248119 0.461721
507.019812 461349.664589 5933589.783900 505.930445 14.184589 -18.256100 142.153577 7.647218 0.394094
537.910618 461352.186721 5933586.537822 536.546515 16.706721 -21.502178 142.153577 7.978688 0.327062
568.818646 461354.818949 5933583.150045 567.155346 19.338949 -24.889955 142.153577 8.242870 0.260524
599.736791 461357.538630 5933579.649713 597.754082 22.058630 -28.390287 142.153577 8.440025 0.194361
630.657446 461360.323121 5933576.065968 628.339868 24.843121 -31.974032 142.153577 8.570319 0.128437
661.572632 461363.149780 5933572.427952 658.909847 27.669780 -35.612048 142.153577 8.633821 0.062607
692.474125 461365.995964 5933568.764806 689.461162 30.515964 -39.275194 142.153577 8.630491 0.003284
723.353580 461368.839029 5933565.105675 719.990958 33.359029 -42.934325 142.153577 8.560185 0.069397
754.202657 461371.656333 5933561.479699 750.496379 36.176333 -46.560301 142.153577 8.422647 0.135892
785.013152 461374.425232 5933557.916021 780.974568 38.945232 -50.123979 142.153577 8.217516 0.202931
815.777119 461377.123085 5933554.443783 811.422668 41.643085 -53.596217 142.153577 7.944327 0.270667
846.487004 461379.727247 5933551.092128 841.837825 44.247247 -56.947872 142.153577 7.602519 0.339249
877.135771 461382.215077 5933547.890198 872.217181 46.735077 -60.149802 142.153577 7.191444 0.408811
907.717041 461384.563931 5933544.867134 902.557880 49.083931 -63.172866 142.153577 6.710381 0.479470
938.225224 461386.751166 5933542.052081 932.857067 51.271166 -65.987919 142.153577 6.158548 0.551323
968.655661 461388.754139 5933539.474178 963.111885 53.274139 -68.565822 142.153577 5.535127 0.624436
999.004764 461390.550208 5933537.162570 993.319477 55.070208 -70.877430 142.153577 4.839285 0.698844
1029.270163 461392.116729 5933535.146398 1023.476989 56.636729 -72.893602 142.153577 4.070199 0.774539
1059.450858 461393.431060 5933533.454805 1053.581562 57.951060 -74.585195 142.153577 3.227096 0.851464
1089.547363 461394.470558 5933532.116932 1083.630342 58.990558 -75.923068 142.153577 2.309286 0.929505
1119.561868 461395.212580 5933531.161922 1113.620472 59.732580 -76.878078 142.153577 1.316206 1.008482
1149.498390 461395.634482 5933530.618918 1143.549095 60.154482 -77.421082 129.598595 0.124601 1.216584
1179.372840 461395.684542 5933530.577507 1173.423474 60.204542 -77.462493 331.285659 3.348667 3.534983
1209.408917 461394.841620 5933532.116220 1203.408267 59.361620 -75.923780 331.293868 7.224135 3.932746
1239.747934 461393.009130 5933535.462482 1233.506447 57.529130 -72.577518 331.303443 10.588235 3.379733
1270.408360 461390.303925 5933540.404344 1263.644821 54.823925 -67.635656 331.314314 13.469089 2.863902
1301.365181 461386.842861 5933546.729859 1293.750197 51.362861 -61.310141 331.326688 15.899318 2.392800
1332.557648 461382.742791 5933554.227077 1323.749383 47.262791 -53.812923 331.340872 17.910734 1.965477
1363.896218 461378.120571 5933562.684051 1353.569186 42.640571 -45.355949 331.357283 19.530939 1.575825
1395.268576 461373.093055 5933571.888833 1383.136413 37.613055 -36.151167 331.376482 20.781222 1.214737
1426.544804 461367.777098 5933581.629474 1412.377872 32.297098 -26.410526 331.399242 21.675170 0.871227
1457.581849 461362.289553 5933591.694026 1441.220372 26.809553 -16.345974 331.426651 22.217530 0.532721
1488.227482 461356.747276 5933601.870540 1469.590718 21.267276 -6.169460 331.460291 22.402983 0.184888
1518.323981 461351.267121 5933611.947070 1497.415719 15.787121 3.907070 331.529499 24.059824 1.678180
1548.158283 461345.468870 5933622.639245 1524.658026 9.988870 14.599245 331.610276 27.914148 3.937907
1578.386590 461338.740391 5933635.088642 1551.369271 3.260391 27.048642 331.658835 31.056980 3.169093
1609.000290 461331.242980 5933648.988910 1577.594640 -4.237020 40.948910 331.687244 33.508107 2.440469
1639.923899 461323.146222 5933664.018206 1603.378984 -12.333778 55.978206 331.701524 35.315266 1.781252
1671.037477 461314.619700 5933679.854684 1628.767154 -20.860300 71.814684 331.704605 36.515330 1.175628
1702.189547 461305.833000 5933696.176500 1653.804000 -29.647000 88.136500 331.704605 36.515330 0.000000
Loading

0 comments on commit d31dc58

Please sign in to comment.