Torque and Drag #114
jonnymaserati
announced in
Announcements
Replies: 2 comments
-
Hello! Step "hookload.figure().show()" works properly Trying in *.ipynb and at your original file "2022_05_22_torque_drag_examples.py" - same rusult
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi there!Thanks for the feedback! I know what the problem is… give me a week or so and I’ll push an update.Regards, JonnyOn 11 Mar 2024, at 04:56, Alex ***@***.***> wrote:
Hello!
Thanks for this library!
Have some trouble in T&D module - in step "t_and_d.figure().show()" appears error: "DimensionalityError: Cannot convert from 'number_meter' ([length] / [mass]) to 'ft_lbf' ([length] ** 2 * [mass] / [time] ** 2)" (full text below)
Step "hookload.figure().show()" works properly
Trying in *.ipynb and at your original file "2022_05_22_torque_drag_examples.py" - same rusult
Can`t find the point of problem
DimensionalityError Traceback (most recent call last)
Cell In[33], [line 1](vscode-notebook-cell:?execution_count=33&line=1)
----> [1](vscode-notebook-cell:?execution_count=33&line=1) t_and_d.figure().show()
File [d:\PythonProjects\Welleng\Lib\site-packages\welleng\torque_drag.py:250](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:250), in TorqueDrag.figure(self)
[249](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:249) def figure(self):
--> [250](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:250) return figure_string_tension_and_torque(self)
File [d:\PythonProjects\Welleng\Lib\site-packages\welleng\torque_drag.py:416](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:416), in figure_string_tension_and_torque(td, units)
[404](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:404) fig.add_trace(
[405](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:405) go.Scatter(
[406](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:406) x=((v * ureg('N')).to(units['tension'])).m,
(...)
[410](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:410) row=1, col=1
[411](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:411) )
[413](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:413) for k, v, in td.torque.items():
[414](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:414) fig.add_trace(
[415](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:415) go.Scatter(
--> [416](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:416) x=((v * ureg('Nm')).to(units['torque'])).m,
[417](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:417) y=((td.survey.md * ureg.meters).to(units['depth'])).m,
[418](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:418) name=f"torque: {k}",
[419](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:419) ),
[420](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:420) row=1, col=2
[421](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:421) )
[423](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:423) fig.update_layout(
[424](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:424) title_text=(
[425](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:425) f"<b>wellbore:</b> {td.wellbore.name}<br>"
(...)
[443](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:443) )
[444](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:444) )
[446](file:///D:/PythonProjects/Welleng/Lib/site-packages/welleng/torque_drag.py:446) return fig
File [d:\PythonProjects\Welleng\Lib\site-packages\pint\facets\plain\quantity.py:528](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/quantity.py:528), in PlainQuantity.to(self, other, *contexts, **ctx_kwargs)
[511](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/quantity.py:511) """Return PlainQuantity rescaled to different units.
[512](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/quantity.py:512)
[513](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/quantity.py:513) Parameters
(...)
[524](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/quantity.py:524) pint.PlainQuantity
[525](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/quantity.py:525) """
[526](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/quantity.py:526) other = to_units_container(other, self._REGISTRY)
--> [528](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/quantity.py:528) magnitude = self._convert_magnitude_not_inplace(other, *contexts, **ctx_kwargs)
[530](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/quantity.py:530) return self.__class__(magnitude, other)
File [d:\PythonProjects\Welleng\Lib\site-packages\pint\facets\plain\quantity.py:472](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/quantity.py:472), in PlainQuantity._convert_magnitude_not_inplace(self, other, *contexts, **ctx_kwargs)
[469](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/quantity.py:469) with self._REGISTRY.context(*contexts, **ctx_kwargs):
[470](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/quantity.py:470) return self._REGISTRY.convert(self._magnitude, self._units, other)
--> [472](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/quantity.py:472) return self._REGISTRY.convert(self._magnitude, self._units, other)
File [d:\PythonProjects\Welleng\Lib\site-packages\pint\facets\plain\registry.py:1028](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/registry.py:1028), in GenericPlainRegistry.convert(self, value, src, dst, inplace)
[1025](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/registry.py:1025) if src == dst:
[1026](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/registry.py:1026) return value
-> [1028](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/registry.py:1028) return self._convert(value, src, dst, inplace)
File [d:\PythonProjects\Welleng\Lib\site-packages\pint\facets\context\registry.py:404](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/context/registry.py:404), in GenericContextRegistry._convert(self, value, src, dst, inplace)
[400](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/context/registry.py:400) src = self._active_ctx.transform(a, b, self, src)
[402](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/context/registry.py:402) value, src = src._magnitude, src._units
--> [404](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/context/registry.py:404) return super()._convert(value, src, dst, inplace)
File [d:\PythonProjects\Welleng\Lib\site-packages\pint\facets\nonmultiplicative\registry.py:254](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/nonmultiplicative/registry.py:254), in GenericNonMultiplicativeRegistry._convert(self, value, src, dst, inplace)
[249](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/nonmultiplicative/registry.py:249) raise DimensionalityError(
[250](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/nonmultiplicative/registry.py:250) src, dst, extra_msg=f" - In destination units, {ex}"
[251](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/nonmultiplicative/registry.py:251) )
[253](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/nonmultiplicative/registry.py:253) if not (src_offset_unit or dst_offset_unit):
--> [254](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/nonmultiplicative/registry.py:254) return super()._convert(value, src, dst, inplace)
[256](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/nonmultiplicative/registry.py:256) src_dim = self._get_dimensionality(src)
[257](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/nonmultiplicative/registry.py:257) dst_dim = self._get_dimensionality(dst)
File [d:\PythonProjects\Welleng\Lib\site-packages\pint\facets\plain\registry.py:1063](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/registry.py:1063), in GenericPlainRegistry._convert(self, value, src, dst, inplace, check_dimensionality)
[1060](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/registry.py:1060) factor = self._get_conversion_factor(src, dst)
[1062](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/registry.py:1062) if isinstance(factor, DimensionalityError):
-> [1063](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/registry.py:1063) raise factor
[1065](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/registry.py:1065) # factor is type float and if our magnitude is type Decimal then
[1066](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/registry.py:1066) # must first convert to Decimal before we can '*' the values
[1067](file:///D:/PythonProjects/Welleng/Lib/site-packages/pint/facets/plain/registry.py:1067) if isinstance(value, Decimal):
DimensionalityError: Cannot convert from 'number_meter' ([length] / [mass]) to 'ft_lbf' ([length] ** 2 * [mass] / [time] ** 2)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Completely re-written
torque_drag
andarchitecture
modules and addedunits
module.For instructions on how to use the new features, have a read of this post. Expect to see the
units
module grow and some streamlining of thesurvey
module over the next weeks.This discussion was created from the release Torque and Drag.
Beta Was this translation helpful? Give feedback.
All reactions