Lines 515-520
Link Here
|
515 |
m1_ray.vol_cpat = vcp_data.vcp; |
515 |
m1_ray.vol_cpat = vcp_data.vcp; |
516 |
m1_ray.elev_num = ray_hdr.elev_num; |
516 |
m1_ray.elev_num = ray_hdr.elev_num; |
517 |
m1_ray.unam_rng = wsr88d_ray.unamb_rng; |
517 |
m1_ray.unam_rng = wsr88d_ray.unamb_rng; |
|
|
518 |
m1_ray.nyq_vel = wsr88d_ray.nyq_vel; // TODO: is this correct? |
518 |
if (ray_hdr.azm_res != 1) |
519 |
if (ray_hdr.azm_res != 1) |
519 |
ray->h.beam_width = 1.0; |
520 |
ray->h.beam_width = 1.0; |
520 |
else ray->h.beam_width = 0.5; |
521 |
else ray->h.beam_width = 0.5; |
Lines 603-608
Link Here
|
603 |
radar->v[vol_index]->sweep[isweep]->ray[iray] = ray; |
604 |
radar->v[vol_index]->sweep[isweep]->ray[iray] = ray; |
604 |
radar->v[vol_index]->sweep[isweep]->h.nrays = iray+1; |
605 |
radar->v[vol_index]->sweep[isweep]->h.nrays = iray+1; |
605 |
} |
606 |
} |
|
|
607 |
free(wsr88d_ray.ref->data); |
608 |
free(wsr88d_ray.ref); |
606 |
} |
609 |
} |
607 |
|
610 |
|
608 |
if (wsr88d_ray.ray_hdr.dbptr_vel > 0) { |
611 |
if (wsr88d_ray.ray_hdr.dbptr_vel > 0) { |
Lines 628-633
Link Here
|
628 |
wsr88d_load_ray_hdr(wsr88d_ray, ray); |
631 |
wsr88d_load_ray_hdr(wsr88d_ray, ray); |
629 |
radar->v[vol_index]->sweep[isweep]->ray[iray] = ray; |
632 |
radar->v[vol_index]->sweep[isweep]->ray[iray] = ray; |
630 |
radar->v[vol_index]->sweep[isweep]->h.nrays = iray+1; |
633 |
radar->v[vol_index]->sweep[isweep]->h.nrays = iray+1; |
|
|
634 |
free(wsr88d_ray.vel->data); |
635 |
free(wsr88d_ray.vel); |
631 |
} |
636 |
} |
632 |
|
637 |
|
633 |
if (wsr88d_ray.ray_hdr.dbptr_sw > 0) { |
638 |
if (wsr88d_ray.ray_hdr.dbptr_sw > 0) { |
Lines 653-658
Link Here
|
653 |
wsr88d_load_ray_hdr(wsr88d_ray, ray); |
658 |
wsr88d_load_ray_hdr(wsr88d_ray, ray); |
654 |
radar->v[vol_index]->sweep[isweep]->ray[iray] = ray; |
659 |
radar->v[vol_index]->sweep[isweep]->ray[iray] = ray; |
655 |
radar->v[vol_index]->sweep[isweep]->h.nrays = iray+1; |
660 |
radar->v[vol_index]->sweep[isweep]->h.nrays = iray+1; |
|
|
661 |
free(wsr88d_ray.sw->data); |
662 |
free(wsr88d_ray.sw); |
656 |
} |
663 |
} |
657 |
|
664 |
|
658 |
} |
665 |
} |
Lines 706-720
Link Here
|
706 |
* at the WSR-88D Radar Operations Center web site. |
713 |
* at the WSR-88D Radar Operations Center web site. |
707 |
*/ |
714 |
*/ |
708 |
|
715 |
|
709 |
n = fread(&msghdr, sizeof(Wsr88d_msg_hdr), 1, wf->fptr); |
|
|
710 |
|
711 |
/* printf("msgtype = %d\n", msghdr.msg_type); */ |
712 |
msg_hdr_size = sizeof(Wsr88d_msg_hdr) - sizeof(msghdr.rpg); |
713 |
|
716 |
|
714 |
|
717 |
|
715 |
radar = RSL_new_radar(MAX_RADAR_VOLUMES); |
718 |
radar = RSL_new_radar(MAX_RADAR_VOLUMES); |
716 |
|
719 |
|
717 |
while (! end_of_vos) { |
720 |
while (! end_of_vos) { |
|
|
721 |
/* Read current header */ |
722 |
n = fread(&msghdr, sizeof(Wsr88d_msg_hdr), 1, wf->fptr); |
723 |
if (n < 1) { |
724 |
fprintf(stderr,"Warning: load_wsr88d_m31_into_radar: "); |
725 |
if (feof(wf->fptr) != 0) fprintf(stderr, |
726 |
"Unexpected end of file.\n"); |
727 |
else fprintf(stderr,"Failed reading msghdr.\n"); |
728 |
fprintf(stderr,"Current sweep number: %d\n" |
729 |
"Last ray read: %d\n", isweep+1, iray); |
730 |
wsr88d_load_sweep_header(radar, isweep, wsr88d_ray); |
731 |
return radar; |
732 |
} |
733 |
|
734 |
/* printf("msgtype = %d\n", msghdr.msg_type); */ |
735 |
msg_hdr_size = sizeof(Wsr88d_msg_hdr) - sizeof(msghdr.rpg); |
736 |
|
718 |
if (msghdr.msg_type == 31) { |
737 |
if (msghdr.msg_type == 31) { |
719 |
if (little_endian()) wsr88d_swap_m31_hdr(&msghdr); |
738 |
if (little_endian()) wsr88d_swap_m31_hdr(&msghdr); |
720 |
|
739 |
|
Lines 729-734
Link Here
|
729 |
/* Load this ray into radar structure ray. */ |
748 |
/* Load this ray into radar structure ray. */ |
730 |
wsr88d_load_ray_into_radar(wsr88d_ray, isweep, iray, radar); |
749 |
wsr88d_load_ray_into_radar(wsr88d_ray, isweep, iray, radar); |
731 |
iray++; |
750 |
iray++; |
|
|
751 |
|
752 |
/* Check for end of sweep */ |
753 |
if (wsr88d_ray.ray_hdr.radial_status == END_OF_ELEV) { |
754 |
wsr88d_load_sweep_header(radar, isweep, wsr88d_ray); |
755 |
isweep++; |
756 |
iray = 0; |
757 |
} |
758 |
|
759 |
if (wsr88d_ray.ray_hdr.radial_status == END_VOS) { |
760 |
//wsr88d_load_sweep_header(radar, isweep, wsr88d_ray); |
761 |
end_of_vos = 1; |
762 |
} |
732 |
} |
763 |
} |
733 |
else { /* msg_type not 31 */ |
764 |
else { /* msg_type not 31 */ |
734 |
n = fread(&non31_seg_remainder, sizeof(non31_seg_remainder), 1, |
765 |
n = fread(&non31_seg_remainder, sizeof(non31_seg_remainder), 1, |
Lines 748-780
Link Here
|
748 |
radar->h.vcp = vcp_data.vcp; |
779 |
radar->h.vcp = vcp_data.vcp; |
749 |
/* printf("VCP = %d\n", vcp_data.vcp); */ |
780 |
/* printf("VCP = %d\n", vcp_data.vcp); */ |
750 |
} |
781 |
} |
|
|
782 |
/* TODO: check for end of sweep/volume */ |
751 |
} |
783 |
} |
752 |
|
784 |
|
753 |
/* Check for end of sweep */ |
785 |
if (feof(wf->fptr) != 0) |
754 |
if (wsr88d_ray.ray_hdr.radial_status == END_OF_ELEV) { |
|
|
755 |
wsr88d_load_sweep_header(radar, isweep, wsr88d_ray); |
756 |
isweep++; |
757 |
iray = 0; |
758 |
} |
759 |
|
760 |
if (wsr88d_ray.ray_hdr.radial_status != END_VOS) { |
761 |
n = fread(&msghdr, sizeof(Wsr88d_msg_hdr), 1, wf->fptr); |
762 |
if (n < 1) { |
763 |
fprintf(stderr,"Warning: load_wsr88d_m31_into_radar: "); |
764 |
if (feof(wf->fptr) != 0) fprintf(stderr, |
765 |
"Unexpected end of file.\n"); |
766 |
else fprintf(stderr,"Failed reading msghdr.\n"); |
767 |
fprintf(stderr,"Current sweep number: %d\n" |
768 |
"Last ray read: %d\n", isweep+1, iray); |
769 |
wsr88d_load_sweep_header(radar, isweep, wsr88d_ray); |
770 |
return radar; |
771 |
} |
772 |
} |
773 |
else { |
774 |
end_of_vos = 1; |
786 |
end_of_vos = 1; |
775 |
wsr88d_load_sweep_header(radar, isweep, wsr88d_ray); |
|
|
776 |
} |
777 |
if (feof(wf->fptr) != 0) end_of_vos = 1; |
778 |
} |
787 |
} |
779 |
|
788 |
|
780 |
return radar; |
789 |
return radar; |