Skip to content

Commit

Permalink
models.corrections.StrainRateCorrection: apply mask of stations corre…
Browse files Browse the repository at this point in the history
…ctly to coordinates
  • Loading branch information
hvasbath committed May 2, 2024
1 parent abf9c6e commit 8d28118
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions beat/models/corrections.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def get_displacements(self, hierarchicals, point=None):
kwargs = self.get_point_rvs(hierarchicals)

vels = velocities_from_pole(self.lats, self.lons, **kwargs)
if self.data_mask.size > 0:
if self.data_mask.any():
vels[self.data_mask] = 0.0
return (vels * self.los_vector).sum(axis=1)

Expand All @@ -162,14 +162,15 @@ def setup_correction(
)

def get_station_coordinates(self, mask=None):
"""Return masked coordinates of stations"""
if mask is None:
mask = self.data_mask

return array(self.lats)[mask], array(self.lons)[mask]
return array(self.lats)[~mask], array(self.lons)[~mask]

def get_displacements(self, hierarchicals, point=None):
"""
Get synthetic correction velocity due to Euler pole rotation.
Get synthetic correction velocity due to Strain Rate Tensor.
"""
if not self.correction_names:
raise ValueError("Requested correction, but is not setup or configured!")
Expand Down Expand Up @@ -198,7 +199,7 @@ def get_displacements(self, hierarchicals, point=None):
array(self.lats), array(self.lons), **kwargs
)

if self.data_mask.size > 0:
if self.data_mask.any():
v_xyz[self.data_mask, :] = 0.0

return (v_xyz * self.los_vector).sum(axis=1)

0 comments on commit 8d28118

Please sign in to comment.