apsg 2.0.4__tar.gz → 2.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {apsg-2.0.4/src/apsg.egg-info → apsg-2.0.5}/PKG-INFO +1 -1
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/__init__.py +1 -1
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/feature/_geodata.py +2 -1
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/helpers/_notation.py +16 -8
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/math/_vector.py +5 -3
- {apsg-2.0.4 → apsg-2.0.5/src/apsg.egg-info}/PKG-INFO +1 -1
- {apsg-2.0.4 → apsg-2.0.5}/tests/test_apsg.py +23 -0
- {apsg-2.0.4 → apsg-2.0.5}/LICENSE +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/README.md +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/pyproject.toml +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/setup.cfg +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/config.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/database/__init__.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/database/_sdbmodels.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/database/_sdbsession.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/database/_websdbsession.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/database/_webtransport.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/feature/__init__.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/feature/_container.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/feature/_paleomag.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/feature/_statistics.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/feature/_tensor2.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/feature/_tensor3.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/helpers/__init__.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/helpers/_helper.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/helpers/_math.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/math/__init__.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/math/_matrix.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/pandas/__init__.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/pandas/_accessors.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/pandas/_gbfunctions.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/pandas/_pandas_api.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/plotting/__init__.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/plotting/_fabricplot.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/plotting/_paleomagplots.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/plotting/_plot_artists.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/plotting/_roseplot.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/plotting/_stereo_engine/__init__.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/plotting/_stereo_engine/_axes.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/plotting/_stereo_engine/_stereogrid.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/plotting/_stereo_engine/_transforms.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/plotting/_stereo_engine/_utils.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/plotting/_stereogrid.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/plotting/_stereonet.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/plotting/_styles.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg/shell.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg.egg-info/SOURCES.txt +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg.egg-info/dependency_links.txt +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg.egg-info/entry_points.txt +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg.egg-info/requires.txt +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/src/apsg.egg-info/top_level.txt +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/tests/test_containers.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/tests/test_pandas.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/tests/test_plotting.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/tests/test_tensors.py +0 -0
- {apsg-2.0.4 → apsg-2.0.5}/tests/test_websdb.py +0 -0
|
@@ -5,6 +5,7 @@ import numpy as np
|
|
|
5
5
|
from apsg.helpers._helper import is_jsonable
|
|
6
6
|
from apsg.helpers._math import atan2d
|
|
7
7
|
from apsg.helpers._notation import (
|
|
8
|
+
_fmt_deg,
|
|
8
9
|
fol2vec_rhr,
|
|
9
10
|
format_linear,
|
|
10
11
|
format_planar,
|
|
@@ -45,7 +46,7 @@ class Direction(Axial2):
|
|
|
45
46
|
"""
|
|
46
47
|
|
|
47
48
|
def __repr__(self):
|
|
48
|
-
return f"D:{self.direction
|
|
49
|
+
return f"D:{_fmt_deg(self.direction, azimuth=True)}"
|
|
49
50
|
|
|
50
51
|
|
|
51
52
|
class Lineation(Axial3):
|
|
@@ -171,16 +171,24 @@ _LINEAR_QUADRANT_RE = re.compile(
|
|
|
171
171
|
)
|
|
172
172
|
|
|
173
173
|
|
|
174
|
+
def _fmt_deg(value, azimuth=False):
|
|
175
|
+
"""Format angle rounded to whole degrees, without '-0' (and '360' for azimuths)."""
|
|
176
|
+
v = round(value) # int, so no negative zero; same round-half-even as :.0f
|
|
177
|
+
if azimuth:
|
|
178
|
+
v %= 360
|
|
179
|
+
return str(v)
|
|
180
|
+
|
|
181
|
+
|
|
174
182
|
def azi2bearing(azi):
|
|
175
183
|
"""Format azimuth (0-360 degrees) as quadrant bearing string, e.g. 45 -> 'N45E'."""
|
|
176
184
|
azi = azi % 360
|
|
177
185
|
if azi <= 90:
|
|
178
|
-
return f"N{azi
|
|
186
|
+
return f"N{_fmt_deg(azi)}E"
|
|
179
187
|
if azi <= 180:
|
|
180
|
-
return f"S{180 - azi
|
|
188
|
+
return f"S{_fmt_deg(180 - azi)}E"
|
|
181
189
|
if azi <= 270:
|
|
182
|
-
return f"S{azi - 180
|
|
183
|
-
return f"N{360 - azi
|
|
190
|
+
return f"S{_fmt_deg(azi - 180)}W"
|
|
191
|
+
return f"N{_fmt_deg(360 - azi)}W"
|
|
184
192
|
|
|
185
193
|
|
|
186
194
|
def bearing2azi(s):
|
|
@@ -228,7 +236,7 @@ def format_quadrant_planar(strike, dip):
|
|
|
228
236
|
"""
|
|
229
237
|
dip_azi = (strike + 90) % 360
|
|
230
238
|
display_strike = strike if (strike <= 90 or strike > 270) else strike - 180
|
|
231
|
-
return f"{azi2bearing(display_strike)},{dip
|
|
239
|
+
return f"{azi2bearing(display_strike)},{_fmt_deg(dip)}{_dip_qualifier(dip_azi)}"
|
|
232
240
|
|
|
233
241
|
|
|
234
242
|
def parse_quadrant_linear(s):
|
|
@@ -242,18 +250,18 @@ def parse_quadrant_linear(s):
|
|
|
242
250
|
|
|
243
251
|
def format_quadrant_linear(azi, inc):
|
|
244
252
|
"""Format (trend, plunge) as quadrant linear measurement string."""
|
|
245
|
-
return f"{azi2bearing(azi)},{inc
|
|
253
|
+
return f"{azi2bearing(azi)},{_fmt_deg(inc)}"
|
|
246
254
|
|
|
247
255
|
|
|
248
256
|
def format_planar(azi, inc):
|
|
249
257
|
"""Format a planar geo-tuple according to the active `apsg_conf.notation`."""
|
|
250
258
|
if apsg_conf.notation == "quadrant":
|
|
251
259
|
return format_quadrant_planar(azi, inc)
|
|
252
|
-
return f"{azi
|
|
260
|
+
return f"{_fmt_deg(azi, azimuth=True)}/{_fmt_deg(inc)}"
|
|
253
261
|
|
|
254
262
|
|
|
255
263
|
def format_linear(azi, inc):
|
|
256
264
|
"""Format a linear geo-tuple according to the active `apsg_conf.notation`."""
|
|
257
265
|
if apsg_conf.notation == "quadrant":
|
|
258
266
|
return format_quadrant_linear(azi, inc)
|
|
259
|
-
return f"{azi
|
|
267
|
+
return f"{_fmt_deg(azi, azimuth=True)}/{_fmt_deg(inc)}"
|
|
@@ -7,6 +7,7 @@ from apsg.config import apsg_conf
|
|
|
7
7
|
from apsg.helpers._helper import is_jsonable
|
|
8
8
|
from apsg.helpers._math import acosd, atan2d, cosd, sind
|
|
9
9
|
from apsg.helpers._notation import (
|
|
10
|
+
_fmt_deg,
|
|
10
11
|
geo2vec_linear,
|
|
11
12
|
vec2geo_linear_signed,
|
|
12
13
|
)
|
|
@@ -213,7 +214,7 @@ class Vector2(Vector):
|
|
|
213
214
|
|
|
214
215
|
def __repr__(self):
|
|
215
216
|
n = apsg_conf.ndigits
|
|
216
|
-
return f"Vector2({round(self.x, n):g}, {round(self.y, n):g})"
|
|
217
|
+
return f"Vector2({round(self.x, n) + 0.0:g}, {round(self.y, n) + 0.0:g})"
|
|
217
218
|
|
|
218
219
|
def __len__(self):
|
|
219
220
|
return 2
|
|
@@ -427,10 +428,11 @@ class Vector3(Vector):
|
|
|
427
428
|
def __repr__(self):
|
|
428
429
|
if apsg_conf.vec2geo:
|
|
429
430
|
azi, inc = self.geo
|
|
430
|
-
return f"V:{azi
|
|
431
|
+
return f"V:{_fmt_deg(azi, azimuth=True)}/{_fmt_deg(inc)}"
|
|
431
432
|
else:
|
|
432
433
|
n = apsg_conf.ndigits
|
|
433
|
-
|
|
434
|
+
x, y, z = (round(c, n) + 0.0 for c in (self.x, self.y, self.z))
|
|
435
|
+
return f"Vector3({x:g}, {y:g}, {z:g})"
|
|
434
436
|
|
|
435
437
|
def __len__(self):
|
|
436
438
|
return 3
|
|
@@ -1274,3 +1274,26 @@ class TestJSONRoundtrip:
|
|
|
1274
1274
|
j = a.to_json()
|
|
1275
1275
|
a2 = feature_from_json(j)
|
|
1276
1276
|
assert a == a2
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
# Repr formatting: no "-0" and no "360"
|
|
1280
|
+
|
|
1281
|
+
|
|
1282
|
+
def test_repr_no_negative_zero():
|
|
1283
|
+
assert repr(-lin(219, 0)) == "L:39/0"
|
|
1284
|
+
assert repr(lin(Vector3(1, 1, -0.0))) == "L:45/0"
|
|
1285
|
+
assert repr(Vector3(1, 0, -0.0)) == "Vector3(1, 0, 0)"
|
|
1286
|
+
assert repr(Vector2(-0.0, 1)) == "Vector2(0, 1)"
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
def test_repr_azimuth_wraps_to_zero():
|
|
1290
|
+
assert repr(lin(359.8, 10)) == "L:0/10"
|
|
1291
|
+
assert repr(fol(359.7, 30)) == "S:0/30"
|
|
1292
|
+
assert repr(dir2(359.7)) == "D:0"
|
|
1293
|
+
with apsg_conf_context(notation="rhr"):
|
|
1294
|
+
assert repr(fol(359.7, 30)) == "S:0/30"
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
def test_repr_quadrant_no_negative_zero():
|
|
1298
|
+
with apsg_conf_context(notation="quadrant"):
|
|
1299
|
+
assert repr(-lin(219, 0)) == "L:N39E,0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|