- if (little_endian()) swap_2_bytes(&uf_dh[3+2*i]); /* Unswap. */
- if (strncmp((char *)&uf_dh[3+2*i], "DZ", 2) == 0) ifield = DZ_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "VR", 2) == 0) ifield = VR_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "SW", 2) == 0) ifield = SW_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "CZ", 2) == 0) ifield = CZ_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "UZ", 2) == 0) ifield = ZT_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "ZT", 2) == 0) ifield = ZT_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "DR", 2) == 0) ifield = DR_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "ZD", 2) == 0) ifield = ZD_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "DM", 2) == 0) ifield = DM_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "RH", 2) == 0) ifield = RH_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "PH", 2) == 0) ifield = PH_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "XZ", 2) == 0) ifield = XZ_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "CD", 2) == 0) ifield = CD_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "MZ", 2) == 0) ifield = MZ_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "MD", 2) == 0) ifield = MD_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "ZE", 2) == 0) ifield = ZE_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "VE", 2) == 0) ifield = VE_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "KD", 2) == 0) ifield = KD_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "TI", 2) == 0) ifield = TI_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "DX", 2) == 0) ifield = DX_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "CH", 2) == 0) ifield = CH_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "AH", 2) == 0) ifield = AH_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "CV", 2) == 0) ifield = CV_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "AV", 2) == 0) ifield = AV_INDEX;
- else if (strncmp((char *)&uf_dh[3+2*i], "SQ", 2) == 0) ifield = SQ_INDEX;
- else { /* etc. DON'T know how to handle this yet. */
- field_type = (char *)&uf_dh[3+2*i];
- fprintf(stderr, "Unknown field type %c%c\n", (char)field_type[0], (char)field_type[1]);
- continue;
- }
- switch (ifield) {
- case DZ_INDEX: f = DZ_F; invf = DZ_INVF; break;
- case VR_INDEX: f = VR_F; invf = VR_INVF; break;
- case SW_INDEX: f = SW_F; invf = SW_INVF; break;
- case CZ_INDEX: f = CZ_F; invf = CZ_INVF; break;
- case ZT_INDEX: f = ZT_F; invf = ZT_INVF; break;
- case DR_INDEX: f = DR_F; invf = DR_INVF; break;
- case ZD_INDEX: f = ZD_F; invf = ZD_INVF; break;
- case DM_INDEX: f = DM_F; invf = DM_INVF; break;
- case RH_INDEX: f = RH_F; invf = RH_INVF; break;
- case PH_INDEX: f = PH_F; invf = PH_INVF; break;
- case XZ_INDEX: f = XZ_F; invf = XZ_INVF; break;
- case CD_INDEX: f = CD_F; invf = CD_INVF; break;
- case MZ_INDEX: f = MZ_F; invf = MZ_INVF; break;
- case MD_INDEX: f = MD_F; invf = MD_INVF; break;
- case ZE_INDEX: f = ZE_F; invf = ZE_INVF; break;
- case VE_INDEX: f = VE_F; invf = VE_INVF; break;
- case KD_INDEX: f = KD_F; invf = KD_INVF; break;
- case TI_INDEX: f = TI_F; invf = TI_INVF; break;
- case DX_INDEX: f = DX_F; invf = DX_INVF; break;
- case CH_INDEX: f = CH_F; invf = CH_INVF; break;
- case AH_INDEX: f = AH_F; invf = AH_INVF; break;
- case CV_INDEX: f = CV_F; invf = CV_INVF; break;
- case AV_INDEX: f = AV_F; invf = AV_INVF; break;
- case SQ_INDEX: f = SQ_F; invf = SQ_INVF; break;
- default: f = DZ_F; invf = DZ_INVF; break;
- }
-
- /* Do we place the data into this volume? */
- if (radar->v[ifield] == NULL) continue; /* Nope. */
-
- if (isweep >= radar->v[ifield]->h.nsweeps) { /* Exceeded sweep limit.
- * Allocate more sweeps.
- * Copy all previous sweeps.
- */
- if (radar_verbose_flag)
- fprintf(stderr,"Exceeded sweep allocation of %d. Adding 20 more.\n", isweep);
- new_volume = RSL_new_volume(radar->v[ifield]->h.nsweeps+20);
- new_volume = copy_sweeps_into_volume(new_volume, radar->v[ifield]);
- radar->v[ifield] = new_volume;
- }
-
- if (radar->v[ifield]->sweep[isweep] == NULL) {
- if (radar_verbose_flag)
- fprintf(stderr,"Allocating new sweep for field %d, isweep %d\n", ifield, isweep);
- radar->v[ifield]->sweep[isweep] = RSL_new_sweep(1000);
- radar->v[ifield]->sweep[isweep]->h.nrays = 0; /* Increment this for each
- * ray encountered.
- */
- radar->v[ifield]->h.f = f;
- radar->v[ifield]->h.invf = invf;
- radar->v[ifield]->sweep[isweep]->h.f = f;
- radar->v[ifield]->sweep[isweep]->h.invf = invf;
- radar->v[ifield]->sweep[isweep]->h.sweep_num = uf_ma[9];
- radar->v[ifield]->sweep[isweep]->h.elev = uf_ma[35] / 64.0;
- }
-
-
-
- current_fh_index = uf_dh[4+2*i];
- uf_fh = uf + current_fh_index - 1;
- sweep = radar->v[ifield]->sweep[isweep];
- iray = sweep->h.nrays;
- nbins = uf_fh[5];
- radar->v[ifield]->sweep[isweep]->ray[iray] = RSL_new_ray(nbins);
- ray = radar->v[ifield]->sweep[isweep]->ray[iray];
- sweep->h.nrays += 1;
-
-
- if (ray) {
- /*
- * ---- Beginning of MANDATORY HEADER BLOCK.
- */
- ray->h.ray_num = uf_ma[7];
- if (little_endian()) swap2(&uf_ma[10], 8);
- memcpy(radar->h.radar_name, &uf_ma[10], 8);
- if (little_endian()) swap2(&uf_ma[10], 8/2);
- memcpy(radar->h.name, &uf_ma[14], 8);
- if (little_endian()) swap2(&uf_ma[14], 8/2);
-
+ if (little_endian()) swap_2_bytes(&uf_dh[3+2*i]); /* Unswap. */
+ ifield = -1;
+ field_type = (char *)&uf_dh[3+2*i];
+ for (j=0; j<MAX_RADAR_VOLUMES; j++) {
+ if (strncmp(field_type, RSL_ftype[j], 2) == 0) {
+ ifield = j;
+ break;
+ }
+ }
+ if (ifield < 0) { /* DON'T know how to handle this yet. */
+ fprintf(stderr, "Unknown field type %c%c\n", (char)field_type[0],
+ (char)field_type[1]);
+ continue;
+ }
+
+ f = RSL_f_list[ifield];
+ invf = RSL_invf_list[ifield];
+
+ /* Do we place the data into this volume? */
+ if (radar->v[ifield] == NULL) continue; /* Nope. */
+
+ if (isweep >= radar->v[ifield]->h.nsweeps) { /* Exceeded sweep limit.
+ * Allocate more sweeps.
+ * Copy all previous sweeps.
+ */
+ if (radar_verbose_flag)
+ fprintf(stderr,"Exceeded sweep allocation of %d. Adding 20 more.\n", isweep);
+ new_volume = RSL_new_volume(radar->v[ifield]->h.nsweeps+20);
+ new_volume = copy_sweeps_into_volume(new_volume, radar->v[ifield]);
+ radar->v[ifield] = new_volume;
+ }
+
+ if (radar->v[ifield]->sweep[isweep] == NULL) {
+ if (radar_verbose_flag)
+ fprintf(stderr,"Allocating new sweep for field %d, isweep %d\n", ifield, isweep);
+ radar->v[ifield]->sweep[isweep] = RSL_new_sweep(1000);
+ radar->v[ifield]->sweep[isweep]->h.nrays = 0; /* Increment this for each
+ * ray encountered.
+ */
+ radar->v[ifield]->h.f = f;
+ radar->v[ifield]->h.invf = invf;
+ radar->v[ifield]->sweep[isweep]->h.f = f;
+ radar->v[ifield]->sweep[isweep]->h.invf = invf;
+ radar->v[ifield]->sweep[isweep]->h.sweep_num = uf_ma[9];
+ radar->v[ifield]->sweep[isweep]->h.elev = uf_ma[35] / 64.0;
+ }
+
+
+
+ current_fh_index = uf_dh[4+2*i];
+ uf_fh = uf + current_fh_index - 1;
+ sweep = radar->v[ifield]->sweep[isweep];
+ iray = sweep->h.nrays;
+ nbins = uf_fh[5];
+ radar->v[ifield]->sweep[isweep]->ray[iray] = RSL_new_ray(nbins);
+ ray = radar->v[ifield]->sweep[isweep]->ray[iray];
+ sweep->h.nrays += 1;
+
+
+ if (ray) {
+ /*
+ * ---- Beginning of MANDATORY HEADER BLOCK.
+ */
+ ray->h.ray_num = uf_ma[7];
+ if (little_endian()) swap2(&uf_ma[10], 8);
+ memcpy(radar->h.radar_name, &uf_ma[10], 8);
+ if (little_endian()) swap2(&uf_ma[10], 8/2);
+ memcpy(radar->h.name, &uf_ma[14], 8);
+ if (little_endian()) swap2(&uf_ma[14], 8/2);
+