jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1043069?usp=email )
Change subject: [doc] update some :math: roles in _wbtypes.py
......................................................................
[doc] update some :math: roles in _wbtypes.py
Change-Id: I9c6c1b05e0491ff633bab52b7f8837be5045df67
---
M pywikibot/_wbtypes.py
1 file changed, 25 insertions(+), 16 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/_wbtypes.py b/pywikibot/_wbtypes.py
index 868b7e6..cd24060 100644
--- a/pywikibot/_wbtypes.py
+++ b/pywikibot/_wbtypes.py
@@ -188,32 +188,34 @@
@property
def precision(self) -> float | None:
- """
- Return the precision of the geo coordinate.
+ """Return the precision of the geo coordinate.
The precision is calculated if the Coordinate does not have a
precision, and self._dim is set.
When no precision and no self._dim exists, None is returned.
- The biggest error (in degrees) will be given by the longitudinal error;
- the same error in meters becomes larger (in degrees) further up north.
- We can thus ignore the latitudinal error.
+ The biggest error (in degrees) will be given by the longitudinal
+ error; the same error in meters becomes larger (in degrees)
+ further up north. We can thus ignore the latitudinal error.
The longitudinal can be derived as follows:
In small angle approximation (and thus in radians):
- M{Δλ ≈ Δpos / r_φ}, where r_φ is the radius of earth at the given
- latitude.
- Δλ is the error in longitude.
+ :math:`M{Δλ ≈ Δpos / r_φ}`, where :math:`r_φ` is the radius of
+ earth at the given latitude. :math:`Δλ` is the error in
+ longitude.
- M{r_φ = r cos φ}, where r is the radius of earth, φ the latitude
+ :math:`M{r_φ = r cos(φ)}`, where :math:`r` is the radius of
+ earth, :math:`φ` the latitude
- Therefore::
+ Therefore:
- precision = math.degrees(
- self._dim/(radius*math.cos(math.radians(self.lat))))
+ .. code-block:: python
+
+ precision = math.degrees(
+ self._dim / (radius * math.cos(math.radians(self.lat))))
"""
if self._dim is None and self._precision is None:
return None
@@ -236,11 +238,18 @@
is thrown.
Carrying on from the earlier derivation of precision, since
- precision = math.degrees(dim/(radius*math.cos(math.radians(self.lat))))
- we get::
- dim = math.radians(
- precision)*radius*math.cos(math.radians(self.lat))
+ .. code-block::
+
+ precision = math.degrees(
+ dim / (radius * math.cos(math.radians(self.lat))))
+
+ we get:
+
+ .. code-block:: python
+
+ dim = math.radians(
+ precision) * radius * math.cos(math.radians(self.lat))
But this is not valid, since it returns a float value for dim which is
an integer. We must round it off to the nearest integer.
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1043069?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I9c6c1b05e0491ff633bab52b7f8837be5045df67
Gerrit-Change-Number: 1043069
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]