Skip to content

Commit a95988a

Browse files
committed
stereo: adjusted parametric law and initial point distribution
1 parent bc3cbf4 commit a95988a

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

oceanmesh/mesh_generator.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,21 +698,37 @@ def _stereo_distortion_dist(lat):
698698

699699
def _parametric(lat):
700700
ones = np.ones(lat.shape)
701-
res = ((90 - lat) * 2 + 18) / 180 * np.pi
702-
return np.minimum(res, ones)
701+
y1 = ((90 - lat) * 2 + 16) / 180 * np.pi
702+
y2 = ((90 - lat) * 4 + 8) / 180 * np.pi
703+
y3 = ((90 - lat) * 8 + 4) / 180 * np.pi
704+
y4 = ((90 - lat) * 16 + 2) / 180 * np.pi
705+
y5 = ((90 - lat) * 32 + 1) / 180 * np.pi
706+
y6 = ((90 - lat) * 64 +.5) / 180 * np.pi
707+
y7 = ((90 - lat) * 128+.25) / 180 * np.pi
708+
y8 = ((90 - lat) * 252+.125) / 180 * np.pi
709+
y = np.minimum(y1,ones)
710+
y = np.minimum(y2,y)
711+
y = np.minimum(y3,y)
712+
y = np.minimum(y4,y)
713+
y = np.minimum(y5,y)
714+
y = np.minimum(y6,y)
715+
y = np.minimum(y7,y)
716+
y = np.minimum(y8,y)
717+
return y
703718

704719

705720
def _generate_initial_points(min_edge_length, geps, bbox, fh, fd, pfix, stereo=False):
706721
"""Create initial distribution in bounding box (equilateral triangles)"""
707722
if stereo:
708-
bbox = np.array([[-180, 180], [-89, 89]])
723+
bbox = np.array([[-180, 180], [-89, 90]])
709724
p = np.mgrid[
710-
tuple(slice(min, max + min_edge_length, min_edge_length) for min, max in bbox)
725+
tuple(slice(min, max, min_edge_length) for min, max in bbox)
711726
].astype(float)
712727
if stereo:
713728
# for global meshes in stereographic projections,
714729
# we need to reproject the points from lon/lat to stereo projection
715730
# then, we need to rectify their coordinates to lat/lon for the sizing function
731+
p += np.random.rand(*p.shape) * min_edge_length / 2 # randomise the distribution
716732
p0 = p.reshape(2, -1).T
717733
x, y = to_stereo(p0[:, 0], p0[:, 1])
718734
p = np.asarray([x, y]).T

0 commit comments

Comments
 (0)