SSAI
Lanham, Maryland
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
} Wsr88d_ray_m31;
-enum radial_status {START_OF_ELEV, INTERMED_RADIAL, END_OF_ELEV, BEGIN_VOS,
- END_VOS};
-
void wsr88d_swap_m31_hdr(Wsr88d_msg_hdr *msghdr)
{
return -1;
}
-
#define MAXRAYS_M31 800
#define MAXSWEEPS 20
int vol_index, waveform;
char *type_str;
- int keep_hi_prf_dz = 0; /* TODO: make this an argument. */
+ int keep_hi_prf_dz = 0; /* TODO: implement an interface for this. */
enum waveforms {surveillance=1, doppler_w_amb_res, doppler_no_amb_res,
batch};
waveform = vcp_data.waveform[isweep];
/* Ignore short-range reflectivity from velocity split cuts unless
- * merging of split cuts is suppressed. The indicators for this type of
- * reflectivity are surveillance mode is 0 and elevation angle is
+ * keep_hi_prf_dz is set. The indicators for this type of
+ * reflectivity are surveillance mode of 0 and elevation angle
* below 6 degrees.
*/
if (vol_index == DZ_INDEX && (vcp_data.surveil_prf_num[isweep] == 0 &&
short non31_seg_remainder[1202]; /* Remainder after message header */
int end_of_vos = 0, isweep = 0;
int msg_hdr_size, msg_size, n;
- int sweep_hdrs_written = 0, prev_elev_num = 1, prev_raynum = 0, raynum = 0;
+ int prev_elev_num = 1, prev_raynum = 0, raynum = 0;
Radar *radar = NULL;
+ enum radial_status {START_OF_ELEV, INTERMED_RADIAL, END_OF_ELEV, BEGIN_VOS,
+ END_VOS};
+
- /* Message type 31 is a variable length message. All other types are made
- * up of 1 or more segments, where each segment is 2432 bytes in length.
- * To handle these differences, read the message header and check its type.
- * If it is 31, use the size given in the message header to determine the
- * number of bytes to read. If not, simply read the remainder of the
- * 2432-byte segment.
+ /* Message type 31 is a variable length message. All other types consist of
+ * 1 or more segments of length 2432 bytes. To handle all types, we read
+ * the message header and check the type. If not 31, then simply read
+ * the remainder of the 2432-byte segment. If it is 31, use the size given
+ * in message header to determine how many bytes to read.
*/
n = fread(&msghdr, sizeof(Wsr88d_msg_hdr), 1, wf->fptr);
if (little_endian()) wsr88d_swap_m31_hdr(&msghdr);
/* Get size of the remainder of message. The given size is in
- * halfwords, but we want it in bytes, so double it.
+ * halfwords; convert it to bytes.
*/
msg_size = (int) msghdr.msg_size * 2 - msg_hdr_size;
n = read_wsr88d_ray_m31(wf, msg_size, &wsr88d_ray);
- /* Assume error message was issued from read routine */
if (n <= 0) return NULL;
raynum = wsr88d_ray.ray_hdr.azm_num;
if (raynum > MAXRAYS_M31) {
}
/* Check for an unexpected start of new elevation, and issue a
- * warning if this has occurred. This usually means less rays than
- * expected. It happens, but rarely.
+ * warning if this has occurred. This condition usually means
+ * less rays then expected in the sweep that just ended.
*/
if (wsr88d_ray.ray_hdr.radial_status == START_OF_ELEV &&
- sweep_hdrs_written != prev_elev_num) {
+ wsr88d_ray.ray_hdr.elev_num-1 > isweep) {
fprintf(stderr,"Warning: Radial status is Start-of-Elevation, "
"but End-of-Elevation was not\n"
"issued for elevation number %d. Number of rays = %d"
"\n", prev_elev_num, prev_raynum);
wsr88d_load_sweep_header(radar, isweep);
isweep++;
- sweep_hdrs_written++;
prev_elev_num = wsr88d_ray.ray_hdr.elev_num - 1;
}
/* Load ray into radar structure. */
wsr88d_load_ray_into_radar(&wsr88d_ray, isweep, radar);
prev_raynum = raynum;
+
+ /* Check for end of sweep */
+ if (wsr88d_ray.ray_hdr.radial_status == END_OF_ELEV) {
+ wsr88d_load_sweep_header(radar, isweep);
+ isweep++;
+ prev_elev_num = wsr88d_ray.ray_hdr.elev_num;
+ }
}
else { /* msg_type not 31 */
n = fread(&non31_seg_remainder, sizeof(non31_seg_remainder), 1,
}
}
- /* Check for end of sweep */
- if (wsr88d_ray.ray_hdr.radial_status == END_OF_ELEV) {
- wsr88d_load_sweep_header(radar, isweep);
- isweep++;
- sweep_hdrs_written++;
- prev_elev_num = wsr88d_ray.ray_hdr.elev_num;
- }
-
/* If not at end of volume scan, read next message header. */
if (wsr88d_ray.ray_hdr.radial_status != END_VOS) {
n = fread(&msghdr, sizeof(Wsr88d_msg_hdr), 1, wf->fptr);
if (n < 1) {
fprintf(stderr,"Warning: load_wsr88d_m31_into_radar: ");
- if (feof(wf->fptr) != 0) fprintf(stderr,
- "Unexpected end of file.\n");
+ if (feof(wf->fptr) != 0)
+ fprintf(stderr,"Unexpected end of file.\n");
else fprintf(stderr,"Failed reading msghdr.\n");
fprintf(stderr,"Current sweep index: %d\n"
"Last ray read: %d\n", isweep, prev_raynum);
wsr88d_load_sweep_header(radar, isweep);
- return radar;
+ end_of_vos = 1;
}
}
else {
end_of_vos = 1;
wsr88d_load_sweep_header(radar, isweep);
}
- if (feof(wf->fptr) != 0) end_of_vos = 1;
} /* while not end of vos */
return radar;