Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: use max_num_gates for calculation of data shape #1337

Merged
merged 1 commit into from
Nov 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pyart/aux_io/gamicfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def __init__(self, filename):
self._scans = ['scan%i' % (i) for i in range(self.nsweeps)]
self.rays_per_sweep = self.how_attrs('ray_count', 'int32')
self.total_rays = sum(self.rays_per_sweep)
self.gates_per_sweep = self.how_attrs('bin_count', 'int32')
self.max_num_gates = max(self.gates_per_sweep)
# starting and ending ray for each sweep
self.start_ray = np.cumsum(np.append([0], self.rays_per_sweep[:-1]))
self.end_ray = np.cumsum(self.rays_per_sweep) - 1
Expand Down Expand Up @@ -132,8 +134,7 @@ def ray_header(self, field, dtype):

def moment_data(self, group, dtype):
""" Read in moment data from all sweeps. """
ngates = int(self._hfile['/scan0/how'].attrs['bin_count'])
data = np.ma.zeros((self.total_rays, ngates), dtype=dtype)
data = np.ma.zeros((self.total_rays, self.max_num_gates), dtype=dtype)
data[:] = np.ma.masked # volume data initially all masked
for scan, start, end in zip(self._scans, self.start_ray, self.end_ray):
# read in sweep data if field exists in scan.
Expand Down