Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dg
dg
Commits
adfd491b
Commit
adfd491b
authored
Dec 16, 2016
by
David Vincent
Browse files
The transformation matrix is now also used in 2D (instead of computing the angle)
parent
d45d4bed
Changes
1
Hide whitespace changes
Inline
Side-by-side
dgpy/scripts/slimPre.py
View file @
adfd491b
...
...
@@ -230,14 +230,6 @@ class Coordinate_system :
xyz
=
region
.
coordinates
if
mesh_proj
:
self
.
coordinates
=
dgpy
.
pjTransform
(
_mesh_proj
,
_data_proj
,
xyz
)
epsVect
=
np
.
zeros
(
xyz
.
shape
)
coord
=
self
.
coordinates
.
copy
()
epsVect
[:,
0
]
=
np
.
hypot
(
coord
[
1
,
0
]
-
coord
[
0
,
0
],
coord
[
1
,
1
]
-
coord
[
0
,
1
])
/
1000.
xyz0
=
dgpy
.
pjTransform
(
_data_proj
,
_mesh_proj
,
coord
-
epsVect
)
xyz1
=
dgpy
.
pjTransform
(
_data_proj
,
_mesh_proj
,
coord
+
epsVect
)
if
dgpy
.
pj_is_latlong
(
_data_proj
)
:
xyz1
[:,
0
]
=
np
.
where
(
xyz1
[:,
0
]
<
xyz0
[:,
0
],
xyz1
[:,
0
]
+
2
*
np
.
pi
,
xyz1
[:,
0
])
self
.
_angle
=
np
.
arctan2
(
xyz1
[:,
1
]
-
xyz0
[:,
1
],
xyz1
[:,
0
]
-
xyz0
[:,
0
])
else
:
lonlat
=
np
.
zeros
(
xyz
.
shape
)
lonlat
[:,
0
]
=
np
.
arctan2
(
xyz
[:,
1
],
xyz
[:,
0
])
...
...
@@ -290,14 +282,12 @@ class Coordinate_system :
* v
second component of the vector (in the data coordinate system)
"""
#u2 = u * np.cos(self._angle) - v * np.sin(self._angle)
#v2 = u * np.sin(self._angle) + v * np.cos(self._angle)
u2
=
self
.
_alpha
[:,
0
,
0
]
*
u
+
self
.
_alpha
[:,
0
,
1
]
*
v
v2
=
self
.
_alpha
[:,
1
,
0
]
*
u
+
self
.
_alpha
[:,
1
,
1
]
*
v
u2
=
self
.
_alpha
[:,
0
,
0
]
*
u
+
self
.
_alpha
[:,
0
,
1
]
*
v
v2
=
self
.
_alpha
[:,
1
,
0
]
*
u
+
self
.
_alpha
[:,
1
,
1
]
*
v
return
(
u2
,
v2
)
def
rotateSphere
(
self
,
F_lon
,
F_colat
,
F_r
):
"""Return the vector in the cart
h
esian field of coordinates
"""Return the vector in the cartesian field of coordinates
keyword arguments:
...
...
@@ -316,7 +306,7 @@ class Coordinate_system :
return
(
Fx
,
Fy
,
Fz
)
def
rotate3D
(
self
,
u
,
v
,
w
):
"""Return the rotated vector data array (u,v). Returned vector will be oriented in the cart
h
esian system
"""Return the rotated vector data array (u,v). Returned vector will be oriented in the cartesian system
keyword arguments:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment