- 积分
- 1778
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2022-10-5
- 最后登录
- 1970-1-1
|
GrADS
系统平台: |
purebasic |
问题截图: |
- |
问题概况: |
现有雷达数据,360方位、每个径向有256个像素,回波数值是dBZ,现源程序,处理和显示0-90方位的雷达数据,需要改动程序使实现0-360方位的雷达数据显示(真的没学过,把90直接改成360程序会报错)各位亲们帮忙看一下吧! |
我看过提问的智慧: |
看过 |
自己思考时长(天): |
3 |
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 WesleyMoob 于 2022-12-8 12:38 编辑
Global rgb_r.w
Global rgb_g.w
Global rgb_b.w
Global rainrate.f
LoadFont (0, "Bold", 16)
LoadFont (1, "Strikeout", 16)
Procedure DrawPPI(Parameter)
If StartDrawing(WindowOutput(0))
x1.f=0.0
x2.f=0.0
y1.f=0.0
y2.f=0.0
alpha1.f=0.0
alpha2.f=0.0
r1.f=0.0
r2.f=0.0
r.w=0
xx.w=0
yy.w=0
xy.f=0.0
alpha.w=0
a0.f=0.0
r0.f=0.0
rad.f=3.141593/180.0
Dim buffer.b(359,255)
z1.f=50.0
z2.f=150.0
z3.f=200.0
z4.f=250.0
z14.f=0.0
z23.f=0.0
z.f=0.0
If (OpenFile(2,"radar.dat"))
ReadData(2,@buffer(0,0),92160) ;Read radar data 256*360 to buffer(range, thita)
CloseFile(2)
EndIf
;Radar.dat: The size is 256*360, 256 bins in radial and 360 rays in azimuth.
; ----------------
; For alpha=0 To 90
alpha=0
Repeat
If(alpha<90)
For r=5 To 253 Step 1
alpha1=alpha
alpha2=alpha+1.0
r1=r
r2=r+5
z1=buffer(alpha,r)
z2=buffer(alpha+1,r)
z3=buffer(alpha+1,r+2)
z4=buffer(alpha,r+2)
x1=r*Sin(alpha1*rad)
x2=r2*Sin(alpha2*rad)
y1=r*Cos(alpha2*rad)
y2=r2*Cos(alpha1*rad)
For xx=Int(x1) To Int(x2)
For yy=Int(y1) To Int(y2)
xy=xx*xx+yy*yy
r0=Sqr(xy)
xy=xx/yy
a0=ATan(xy)/rad
;Debug a0
If (r0>=r1) And (r0<=r2)
If (a0>=alpha1) And (a0<=alpha2)
z14=z1+(r0-r1)*(z4-z1)/(r2-r1)
z23=z2+(r0-r1)*(z3-z2)/(r2-r1)
z=z14+(a0-alpha1)*(z23-z14)/(alpha2-alpha1)
If(z<2)
rgb_r=0
rgb_g=0
rgb_b=0
EndIf
If(z>=2) And (z<5)
rgb_r=192
rgb_g=192
rgb_b=254
EndIf
If(z >=5) And (z<10)
rgb_r=122
rgb_g=114
rgb_b=238
EndIf
If(z>=10) And (z<15)
rgb_r=30
rgb_g=38
rgb_b=208
EndIf
If(z>=15) And (z<20)
rgb_r=166
rgb_g=252
rgb_b=168
EndIf
If(z>=20) And (z<25)
rgb_r=0
rgb_g=234
rgb_b=0
EndIf
If(z>=25) And (z<30)
rgb_r=16
rgb_g=146
rgb_b=26
EndIf
If(z>=30) And (z<35)
rgb_r=252
rgb_g=244
rgb_b=100
EndIf
If(z>=35) And (z<40)
rgb_r=200
rgb_g=200
rgb_b=2
EndIf
If(z>=40) And (z<45)
rgb_r=140
rgb_g=140
rgb_b=0
EndIf
If(z>=45) And (z<50)
rgb_r=254
rgb_g=172
rgb_b=172
EndIf
If(z>=50) And (z<55)
rgb_r=254
rgb_g=100
rgb_b=92
EndIf
If(z>=55) And (z<60)
rgb_r=238
rgb_g=2
rgb_b=48
EndIf
If(z>=60) And (z<65)
rgb_r=212
rgb_g=142
rgb_b=254
EndIf
If(z>=65) And (z<75)
rgb_r=170
rgb_g=36
rgb_b=250
EndIf
If(z>=75)
rgb_r=0
rgb_g=0
rgb_b=162
EndIf
Plot(300+xx,300-yy,RGB(0,rgb_g,rgb_b))
EndIf
EndIf
Next yy
Next xx
;Delay(10)
Next
EndIf
alpha=alpha+1
Until (alpha=90)
DrawingMode(4) ;Not filling
For r=50 To 250 Step 50
Circle(300,300,r,RGB(200,0,200))
Next
Circle(300,300,255,RGB(200,0,200))
LineXY(44,300,556,300,RGB(255,0,0))
LineXY(300,556,300,44,RGB(255,0,0))
LineXY(119,119,481,481,RGB(255,0,0))
LineXY(119,481,481,119,RGB(255,0,0))
;LoadFont (0, "Bold", 16)
DrawingFont(FontID(0))
FrontColor(RGB(255,0,0))
BackColor(RGB(0,50,150))
DrawText(140,20,"Radar reflectivity factor, dBZ")
DrawingMode(0) ; Filling
Box(580,140,30,20,RGB(0,0,0))
Box(580,160,30,20,RGB(192,192,254))
Box(580,180,30,20,RGB(122,1114,238))
Box(580,200,30,20,RGB(30,38,208))
Box(580,220,30,20,RGB(166,252,168))
Box(580,240,30,20,RGB(0,234,0))
Box(580,260,30,20,RGB(16,146,26))
Box(580,280,30,20,RGB(252,244,100))
Box(580,300,30,20,RGB(200,200,2))
Box(580,320,30,20,RGB(140,140,0))
Box(580,340,30,20,RGB(254,172,172))
Box(580,360,30,20,RGB(254,100,92))
Box(580,380,30,20,RGB(238,2,48))
Box(580,400,30,20,RGB(212,142,254))
Box(580,420,30,20,RGB(170,36,250))
Box(580,440,30,20,RGB(0,0,162))
BackColor(RGB(220,220,220))
DrawText(525,105,"Reflectivity: dBZ")
DrawText(616,140,"<2")
DrawText(616,160," 5")
DrawText(616,180,"10")
DrawText(616,200,"15")
DrawText(616,220,"20")
DrawText(616,240,"25")
DrawText(616,260,"30")
DrawText(616,280,"35")
DrawText(616,300,"40")
DrawText(616,320,"45")
DrawText(616,340,"50")
DrawText(616,360,"55")
DrawText(616,380,"60")
DrawText(616,400,"65")
DrawText(616,420,"75")
DrawText(616,440,">>")
FrontColor(RGB(0,0,255))
DrawText(500,480,"Max Range: 256 km")
;LoadFont (0, "Strikeout", 22)
DrawingFont(FontID(1))
FrontColor(RGB(0,0,255))
DrawText(70,580,"Nanjing University of Information Science and Technology")
DrawText(240,610,FormatDate("%YYYY-%MM-%DD",Date()))
DrawText(440,610,FormatDate(" %hh:%ii:%ss", Date()))
; ----------------
StopDrawing()
EndIf
EndProcedure
If OpenWindow(0, 100, 100, 750, 650, "Radar data display, A demostration !")
CreateThread(@DrawPPI(), 0)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
|
|