Skip to content

Commit 518e9fa

Browse files
committed
Fixed logical errors in tlat and tlon methods. Reverted dcrs to self.ds.traj.ccrs as this works with Matplotlib 3.11 on another machine
1 parent 194e2b5 commit 518e9fa

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

trajan/plot/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ def lines(self, *args, **kwargs):
166166
# using self.ds.traj.tlon/tlat
167167
x = self.ds.traj.tx.values.T
168168
y = self.ds.traj.ty.values.T
169-
#dcrs = self.ds.traj.ccrs
170-
dcrs = self.gcrs
169+
dcrs = self.ds.traj.ccrs
170+
#dcrs = self.gcrs
171171

172172
cartesian = self.__cartesian__
173173

trajan/traj.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def __init__(self, ds, trajectory_dim, obs_dim, time_varname):
119119
self.__plot__ = None
120120
self.__animate__ = None
121121
self.__gcrs__ = pyproj.CRS.from_epsg(4326)
122+
#self.__gcrs__ = pyproj.CRS.from_epsg(32662)
122123
self.trajectory_dim = trajectory_dim # name of trajectory dimension
123124
self.obs_dim = obs_dim # dimension along which time increases
124125
self.time_varname = time_varname
@@ -226,13 +227,10 @@ def tlon(self):
226227
--------
227228
tx, tlat
228229
"""
229-
if self.crs.is_geographic:
230+
if self.crs is None or self.crs.is_geographic:
230231
return self.tx
231232
else:
232-
if self.crs is None:
233-
return self.tx
234-
else:
235-
return self.transform(self.__gcrs__).traj.tlon
233+
return self.transform(self.__gcrs__).traj.tlon
236234

237235
@property
238236
def tlat(self) -> xr.DataArray:
@@ -243,13 +241,10 @@ def tlat(self) -> xr.DataArray:
243241
--------
244242
ty, tlon
245243
"""
246-
if self.crs.is_geographic:
244+
if self.crs is None or self.crs.is_geographic:
247245
return self.ty
248246
else:
249-
if self.crs is None:
250-
return self.ty
251-
else:
252-
return self.transform(self.__gcrs__).traj.tlat
247+
return self.transform(self.__gcrs__).traj.tlat
253248

254249
@cache
255250
def transform(self, to_crs):

0 commit comments

Comments
 (0)