Skip to content

Commit

Permalink
add io func of Phase array radar
Browse files Browse the repository at this point in the history
  • Loading branch information
YvZheng committed Sep 23, 2021
1 parent 6d7803d commit d32da85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pycwr/io/PAFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
7 changes: 4 additions & 3 deletions test/plot_test.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit d32da85

Please sign in to comment.