From 66ef5d3fa7fbe6dff20ecbe0901cd07f7d951c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20M=C3=BChlbauer?= Date: Thu, 24 Nov 2022 21:53:22 +0100 Subject: [PATCH] FIX: use max_num_gates for calculation of data shape --- pyart/aux_io/gamicfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyart/aux_io/gamicfile.py b/pyart/aux_io/gamicfile.py index e8cf8c528e..8d943c35b9 100644 --- a/pyart/aux_io/gamicfile.py +++ b/pyart/aux_io/gamicfile.py @@ -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 @@ -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.