Skip to content

Commit

Permalink
heart: GNSSComponent.get_data_mask invert masking scheme (boolean array)
Browse files Browse the repository at this point in the history
plotting.geodetic.gnss_fits: with n_ensmeble > 1 fix variance reductions input, i.e. take transpose due to changed atleast2d syntax in numpy
  • Loading branch information
hvasbath committed Apr 19, 2024
1 parent 3b3f50f commit 8150ba5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions beat/heart.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,8 +1239,10 @@ def to_kite_scene(self, bins=(600, 600)):
return scene

def get_data_mask(self, corr_config):
"""
Return dataset mask, i.e. boolean numpy array, 0/1 indicating false/true masking,
"""
s2idx = self.station_name_index_mapping()

if (
len(corr_config.station_whitelist) > 0
and len(corr_config.station_blacklist) > 0
Expand All @@ -1266,8 +1268,8 @@ def get_data_mask(self, corr_config):
"Stations with idxs %s got blacklisted!"
% utility.list2string(station_blacklist_idxs)
)
mask = num.ones_like(self.lats, dtype=num.bool_)
mask[num.array(station_blacklist_idxs)] = False
mask = num.zeros_like(self.lats, dtype=num.bool_)
mask[num.array(station_blacklist_idxs)] = True
return mask

def station_name_index_mapping(self):
Expand Down
2 changes: 1 addition & 1 deletion beat/plotting/geodetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def gnss_fits(problem, stage, plot_options):

out_filename = "/tmp/histbounds.txt"
m.gmt.pshistogram(
in_rows=num.atleast_2d(all_var_reductions[dataset.component]),
in_rows=num.atleast_2d(all_var_reductions[dataset.component]).T,
W=(imax - imin) / nbins,
out_filename=out_filename,
Z=Z,
Expand Down
2 changes: 1 addition & 1 deletion beat/pytensorf.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def perform(self, node, inputs, output):
num.array(self.lats), num.array(self.lons), pole_lat, pole_lon, omega
)

if self.data_mask:
if len(self.data_mask) > 0:
velocities[num.array(self.data_mask), :] = 0.0

z[0] = velocities
Expand Down

0 comments on commit 8150ba5

Please sign in to comment.