diff --git a/pycwr/io/PAFile.py b/pycwr/io/PAFile.py index 8cdb7b8..b6923cf 100644 --- a/pycwr/io/PAFile.py +++ b/pycwr/io/PAFile.py @@ -30,6 +30,7 @@ def __init__(self, filename, station_lon=None, station_lat=None, station_alt=Non self.header = self._parse_BaseDataHeader() self.radial = self._parse_radial() self.nrays = len(self.radial) + print(self.nrays) self.nsweeps = self.header['TaskConfig']['CutNumber'] self.sweep_start_ray_index = np.arange(0, self.nrays, self.nrays // self.nsweeps) self.sweep_end_ray_index = self.sweep_start_ray_index + self.nrays // self.nsweeps - 1 @@ -74,7 +75,8 @@ def _parse_radial(self): self.MomentNum = RadialDict['MomentNumber'] self.LengthOfData = RadialDict['LengthOfData'] RadialDict['fields'] = self._parse_radial_single() - radial.append(RadialDict) + if RadialDict["fields"]: + radial.append(RadialDict) buf = self.fid.read(dtype_PA.RadialHeaderBlockSize) return radial diff --git a/test/plot_test.py b/test/plot_test.py index 2e9910e..e31d642 100644 --- a/test/plot_test.py +++ b/test/plot_test.py @@ -1,9 +1,10 @@ -from pycwr.io import read_PA, read_auto +from pycwr.io import read_PA, read_auto, PAFile from pycwr.draw.SingleRadarPlotMap import RadarGraphMap import matplotlib.pyplot as plt -file = "/Users/zhengyu/Downloads/Z_RADR_I_ZGZ01_20200820220246_O_DOR_DXK_CAR.bin.bz2" -x = read_auto(file) +file = "/Users/zhengyu/Downloads/Z_RADR_I_Z0001_20200521191950_O_DOR_DXK_CAR.bin" +x = read_PA(file) +y = PAFile.PABaseData(file) # PRD = read_auto(filename) # graph = RadarGraphMap(PRD)