* The conversion functions may NOT be macros.
*/
+/* Modification to properly convert DM field (DEK 21 Nov 2012) */
+
#ifdef USE_TWO_BYTE_PRECISION
#define F_FACTOR 100.0
#define F_DR_FACTOR 1000.0
#define F_DZ_RANGE_OFFSET 50
+#define F_DM_RANGE_OFFSET 130 /* DEK */
#else
#define F_FACTOR 2.0
#define F_DR_FACTOR 10.0
#define F_DZ_RANGE_OFFSET 32
#endif
+/* #define F_VR_OFFSET 63.5 */
+#define F_VR_OFFSET 127.0
+#define F_DR_OFFSET 12.0
+
/* IMPORTANT: This is the offset from reserved values. This
* number must be exactly (or >=) the number of
* reserved values in XX_F and XX_INVF.
float DZ_F(Range x) {
if (x >= F_OFFSET) /* This test works when Range is unsigned. */
- return (((float)x-F_OFFSET)/F_FACTOR - F_DZ_RANGE_OFFSET); /* Default wsr88d. */
+ return (((float)x-F_OFFSET)/F_FACTOR - F_DZ_RANGE_OFFSET); /* Default wsr88d. */
if (x == 0) return BADVAL;
if (x == 1) return RFVAL;
if (x == 2) return APFLAG;
return BADVAL; /* Can't get here, but quiets the compiler. */
}
+
+float DM_F(Range x) {
+ if (x >= F_OFFSET) /* This test works when Range is unsigned. */
+ return (((float)x-F_OFFSET)/F_FACTOR - F_DM_RANGE_OFFSET); /* DEK */
+ if (x == 0) return BADVAL;
+ if (x == 1) return RFVAL;
+ if (x == 2) return APFLAG;
+ if (x == 3) return NOECHO;
+ return BADVAL; /* Can't get here, but quiets the compiler. */
+}
+
+
float VR_F(Range x) {
float val;
if (x >= F_OFFSET) { /* This test works when Range is unsigned. */
- val = (((float)x-F_OFFSET)/F_FACTOR - 63.5); /* Default wsr88d coding. */
- /* fprintf(stderr, "x=%d, val=%f\n", x, val); */
- return val;
+ val = (((float)x-F_OFFSET)/F_FACTOR - F_VR_OFFSET); /* Default wsr88d coding. */
+ /* fprintf(stderr, "x=%d, val=%f\n", x, val); */
+ return val;
}
if (x == 0) return BADVAL;
if (x == 1) return RFVAL;
float DR_F(Range x) { /* Differential reflectivity */
float val;
if (x >= F_OFFSET) { /* This test works when Range is unsigned. */
- val = (((float)x-F_OFFSET)/F_DR_FACTOR - 12.0);
- return val;
+ val = (((float)x-F_OFFSET)/F_DR_FACTOR - F_DR_OFFSET);
+ return val;
}
if (x == 0) return BADVAL;
if (x == 1) return RFVAL;
float LR_F(Range x) {/* From MCTEX */
if (x >= F_OFFSET) /* This test works when Range is unsigned. */
- return (float) (x - 250.)/6.;
+ return (float) (x - 250.)/6.;
if (x == 0) return BADVAL;
if (x == 1) return RFVAL;
if (x == 2) return APFLAG;
return BADVAL;
}
+float HC_F(Range x) { /* HydroClass (Sigmet) */
+ if (x == 0) return BADVAL;
+ return (float)x;
+}
+
/****************************
Sigmet RhoHV : one_byte values
> RohHV = sqrt((N-1)/253)
*******************************/
float RH_F(Range x) {
if (x == 0) return BADVAL;
- return (float)(sqrt((double)((x-1.0)/253.0)));
- }
+ /* return (float)(sqrt((double)((x-1.0)/253.0))); */
+ return (float)x / 100.;
+}
/*****************************
Sigmet PhiDP : one_byte values
******************************/
float PH_F(Range x) {
if (x == 0) return BADVAL;
- return (float)(180.0*((x-1.0)/254.0));
+ /*return (float)(180.0*((x-1.0)/254.0));*/
+ return x/10.;
}
+/* TODO: Should this be 5. cm. instead of 0.5? Or maybe 10. cm.? */
float rsl_kdp_wavelen = 0.5; /* Default radar wavelen = .5 cm. See
* nsig_to_radar.c for the code that sets this.
- */
+ */
+/* KD_F for 1 or 2 byte. */
float KD_F(Range x)
{
- if (x >= F_OFFSET) {
- x -= F_OFFSET;
- if (rsl_kdp_wavelen == 0.0) return BADVAL;
- if (x < 128)
- return (float)(
- -0.25 * pow((double)600.0,(double)((127-x)/126.0))
- )/rsl_kdp_wavelen;
- else if (x > 128)
- return (float)(
- 0.25 * pow((double)600.0,(double)((x-129)/126.0))
- )/rsl_kdp_wavelen;
- else
- return 0.0;
- }
if (x == 0) return BADVAL;
- if (x == 1) return RFVAL;
- if (x == 2) return APFLAG;
- if (x == 3) return NOECHO;
- return BADVAL;
+ return x/100.;
}
-float SQ_F(Range x) {
- if (x >= F_OFFSET) return (float)((x - F_OFFSET)/10000.);
+/* Normalized Coherent Power (DORADE) */
+float NP_F(Range x)
+{
if (x == 0) return BADVAL;
- if (x == 1) return RFVAL;
- if (x == 2) return APFLAG;
- if (x == 3) return NOECHO;
- return BADVAL; /* Can't get here, but quiets the compiler. */
+ return (float)(x - 1) / 100.;
+}
+
+/* Standard Deviation (for Dual-pole QC testing.) */
+float SD_F(Range x)
+{
+ if (x == 0) return BADVAL;
+ return (float)x / 100.;
+}
+
+/* Signal Quality Index */
+float SQ_F(Range x)
+{
+ if (x == 0) return BADVAL;
+ return (float)(x-1) / 65533.;
}
float TI_F(Range x)
float MD_F(Range x) { return MZ_F(x); } /* ZD Mask */
float ZE_F(Range x) { return DZ_F(x); }
float VE_F(Range x) { return VR_F(x); }
-float DM_F(Range x) { return DZ_F(x); }
+/* float DM_F(Range x) { return DZ_F(x); } DEK */
float DX_F(Range x) { return DZ_F(x); }
float CH_F(Range x) { return DZ_F(x); }
float AH_F(Range x) { return DZ_F(x); }
float CV_F(Range x) { return DZ_F(x); }
float AV_F(Range x) { return DZ_F(x); }
+float VS_F(Range x) { return VR_F(x); }
+float VL_F(Range x) { return VR_F(x); }
+float VG_F(Range x) { return VR_F(x); }
+float VT_F(Range x) { return VR_F(x); }
+float VC_F(Range x) { return VR_F(x); }
if (x == RFVAL) return (Range)1;
if (x == APFLAG) return (Range)2;
if (x == NOECHO) return (Range)3;
+ if (x < -F_DZ_RANGE_OFFSET) return (Range)0;
return (Range)(F_FACTOR*(x+F_DZ_RANGE_OFFSET)+.5 + F_OFFSET); /* Default wsr88d. */
}
+Range DM_INVF(float x)
+{
+ if (x == BADVAL) return (Range)0;
+ if (x == RFVAL) return (Range)1;
+ if (x == APFLAG) return (Range)2;
+ if (x == NOECHO) return (Range)3;
+ return (Range)(F_FACTOR*(x+F_DM_RANGE_OFFSET)+.5 + F_OFFSET); /* DEK */
+}
+
+
Range VR_INVF(float x)
{
if (x == BADVAL) return (Range)0;
if (x == RFVAL) return (Range)1;
if (x == APFLAG) return (Range)2;
if (x == NOECHO) return (Range)3;
- return (Range)(F_FACTOR*(x+63.5)+.5 + F_OFFSET); /* Default wsr88d coding. */
+ if (x < -F_VR_OFFSET) return (Range)0;
+ return (Range)(F_FACTOR*(x+F_VR_OFFSET)+.5 + F_OFFSET); /* Default wsr88d coding. */
}
Range DR_INVF(float x) /* Differential reflectivity */
if (x == RFVAL) return (Range)1;
if (x == APFLAG) return (Range)2;
if (x == NOECHO) return (Range)3;
- return (Range)(F_DR_FACTOR*(x + 12.0) + F_OFFSET + 0.5);
+ if (x < -F_DR_OFFSET) return (Range)0;
+ return (Range)(F_DR_FACTOR*(x + F_DR_OFFSET) + F_OFFSET + 0.5);
+}
+
+Range HC_INVF(float x) /* HydroClass (Sigmet) */
+{
+ if (x == BADVAL) return (Range)0;
+ return (Range)(x + 0.5); /* Round */
}
Range LR_INVF(float x) /* MCTEX */
> 253 0.9980
> 254 1.0000
****************************/
+/* RH_INVF for 1 or 2 byte data. */
Range RH_INVF(float x) {
if (x == BADVAL) return (Range)0;
- return (Range)(x * x * 253.0 + 1.0 + 0.5);
+ /* return (Range)(x * x * 253.0 + 1.0 + 0.5); */
+ return (Range)(x * 100. +.5);
}
/******************************
*******************************/
Range PH_INVF(float x) {
if (x == BADVAL) return (Range)0;
- return (Range)((x / 180.0) * 254.0 + 1.0 + 0.5);
+ /* return (Range)((x / 180.0) * 254.0 + 1.0 + 0.5); */
+ return (Range)(x*10.+ 0.5);
}
+
+/* KD_INVF for 1 or 2 byte data. */
Range KD_INVF(float x) {
if (x == BADVAL) return (Range)0;
- if (x == RFVAL) return (Range)1;
- if (x == APFLAG) return (Range)2;
- if (x == NOECHO) return (Range)3;
- if (rsl_kdp_wavelen == 0.0) return (Range)0;
- if (x < 0) {
- x = 127 -
- 126 * (log((double)-x) - log((double)(0.25/rsl_kdp_wavelen))) /
- log((double)600.0) +
- 0.5;
- } else if (x > 0) {
- x = 129 +
- 126 * (log((double)x) - log((double)0.25/rsl_kdp_wavelen)) /
- log((double)600.0) +
- 0.5;
- } else {
- x = 128;
- }
- x += F_OFFSET;
- return (Range) x;
-
+ return (Range)(x * 100. + 0.5);
}
-Range SQ_INVF(float x) /* Signal Quality Index */
+/* Standard Deviation (for Dual-pole QC testing.) */
+Range SD_INVF(float x)
{
if (x == BADVAL) return (Range)0;
- if (x == RFVAL) return (Range)1;
- if (x == APFLAG) return (Range)2;
- if (x == NOECHO) return (Range)3;
- return (Range)(x * 10000. + F_OFFSET);
+ return (Range)(x * 100.);
+}
+
+/* Signal Quality Index */
+Range SQ_INVF(float x)
+{
+ if (x == BADVAL) return (Range)0;
+ return (Range)(x * 65533. + 1. +.5);
+}
+
+/* Normalized Coherent Power (DORADE) */
+Range NP_INVF(float x)
+{
+ if (x == BADVAL) return (0);
+ return (Range)(x * 100. + 1.);
}
Range TI_INVF(float x) /* MCTEX */
Range MD_INVF(float x) { return MZ_INVF(x); } /* ZD Mask */
Range ZE_INVF(float x) { return DZ_INVF(x); }
Range VE_INVF(float x) { return VR_INVF(x); }
-Range DM_INVF(float x) { return DZ_INVF(x); }
+/* Range DM_INVF(float x) { return DZ_INVF(x); } DEK */
Range DX_INVF(float x) { return DZ_INVF(x); }
Range CH_INVF(float x) { return DZ_INVF(x); }
Range AH_INVF(float x) { return DZ_INVF(x); }
Range CV_INVF(float x) { return DZ_INVF(x); }
Range AV_INVF(float x) { return DZ_INVF(x); }
+Range VS_INVF(float x) { return VR_INVF(x); }
+Range VL_INVF(float x) { return VR_INVF(x); }
+Range VG_INVF(float x) { return VR_INVF(x); }
+Range VT_INVF(float x) { return VR_INVF(x); }
+Range VC_INVF(float x) { return VR_INVF(x); }
#define STATIC
STATIC int RSL_max_sweeps = 0; /* Initial allocation for sweep_list.
- * RSL_new_sweep will allocate the space first
- * time around.
- */
+ * RSL_new_sweep will allocate the space first
+ * time around.
+ */
STATIC int RSL_nsweep_addr = 0; /* A count of sweeps in the table. */
STATIC Sweep_list *RSL_sweep_list = NULL;
STATIC int RSL_nextents = 0;
int i;
if (table == NULL) return;
for (i=0; i<table->nindexes; i++)
- FREE_HASH_NODE(table->indexes[i]); /* A possible linked list of Rays. */
+ FREE_HASH_NODE(table->indexes[i]); /* A possible linked list of Rays. */
free(table->indexes);
free(table);
}
int j;
/* Find where it goes, split the list and slide the tail down one. */
for (i=0; i<RSL_nsweep_addr; i++)
- if (s == RSL_sweep_list[i].s_addr) break;
+ if (s == RSL_sweep_list[i].s_addr) break;
if (i == RSL_nsweep_addr) return; /* Not found. */
/* This sweep is at 'i'. */
RSL_nsweep_addr--;
for (j=i; j<RSL_nsweep_addr; j++)
- RSL_sweep_list[j] = RSL_sweep_list[j+1];
+ RSL_sweep_list[j] = RSL_sweep_list[j+1];
RSL_sweep_list[RSL_nsweep_addr].s_addr = NULL;
RSL_sweep_list[RSL_nsweep_addr].hash = NULL;
int i,j;
if (RSL_nsweep_addr >= RSL_max_sweeps) { /* Current list is too small. */
- RSL_nextents++;
- new_list = (Sweep_list *) calloc(100*RSL_nextents, sizeof(Sweep_list));
- if (new_list == NULL) {
- perror("INSERT_SWEEP");
- exit(2);
- }
+ RSL_nextents++;
+ new_list = (Sweep_list *) calloc(100*RSL_nextents, sizeof(Sweep_list));
+ if (new_list == NULL) {
+ perror("INSERT_SWEEP");
+ exit(2);
+ }
/* Copy the old list to the new one. */
- for (i=0; i<RSL_max_sweeps; i++) new_list[i] = RSL_sweep_list[i];
- RSL_max_sweeps = 100*RSL_nextents;
- free(RSL_sweep_list);
- RSL_sweep_list = new_list;
+ for (i=0; i<RSL_max_sweeps; i++) new_list[i] = RSL_sweep_list[i];
+ RSL_max_sweeps = 100*RSL_nextents;
+ free(RSL_sweep_list);
+ RSL_sweep_list = new_list;
}
/* Find where it goes, split the list and slide the tail down one. */
for (i=0; i<RSL_nsweep_addr; i++)
- if (s < RSL_sweep_list[i].s_addr) break;
-
+ if (s < RSL_sweep_list[i].s_addr) break;
+
/* This sweep goes at 'i'. But first we must split the list. */
for (j=RSL_nsweep_addr; j>i; j--)
- RSL_sweep_list[j] = RSL_sweep_list[j-1];
+ RSL_sweep_list[j] = RSL_sweep_list[j-1];
RSL_sweep_list[i].s_addr = s;
RSL_sweep_list[i].hash = NULL;
/* Simple linear search; but this will be a binary search. */
int i;
for (i=0; i<RSL_nsweep_addr; i++)
- if (s == RSL_sweep_list[i].s_addr) return i;
+ if (s == RSL_sweep_list[i].s_addr) return i;
return -1;
}
s->ray = (Ray **) calloc(max_rays, sizeof(Ray*));
if (s->ray == NULL) perror("RSL_new_sweep, Ray*");
s->h.nrays = max_rays; /* A default setting. */
+ s->h.elev = -999.;
+ s->h.azimuth = -999.;
return s;
}
int i;
if (s == NULL) return s;
for (i=0; i<s->h.nrays; i++) {
- RSL_clear_ray(s->ray[i]);
+ RSL_clear_ray(s->ray[i]);
}
return s;
}
int i;
if (v == NULL) return v;
for (i=0; i<v->h.nsweeps; i++) {
- RSL_clear_sweep(v->sweep[i]);
+ RSL_clear_sweep(v->sweep[i]);
}
return v;
}
int i;
if (s == NULL) return;
for (i=0; i<s->h.nrays; i++) {
- RSL_free_ray(s->ray[i]);
+ RSL_free_ray(s->ray[i]);
}
if (s->ray) free(s->ray);
REMOVE_SWEEP(s); /* Remove from internal Sweep list. */
if (v == NULL) return;
for (i=0; i<v->h.nsweeps; i++)
- {
- RSL_free_sweep(v->sweep[i]);
- }
+ {
+ RSL_free_sweep(v->sweep[i]);
+ }
if (v->sweep) free(v->sweep);
free(v);
}
n_sweep->h = s->h;
for (i=0; i<s->h.nrays; i++) {
- n_sweep->ray[i] = RSL_copy_ray(s->ray[i]);
+ n_sweep->ray[i] = RSL_copy_ray(s->ray[i]);
}
return n_sweep;
}
new_vol->h = v->h;
for (i=0; i<v->h.nsweeps; i++) {
- new_vol->sweep[i] = RSL_copy_sweep(v->sweep[i]);
+ new_vol->sweep[i] = RSL_copy_sweep(v->sweep[i]);
}
return new_vol;
}
double cwise_angle_diff(float x,float y)
{
/* Returns the clockwise angle difference of x to y.
- * If x = 345 and y = 355 return 10.
- * If x = 345 and y = 335 return 350
- */
+ * If x = 345 and y = 355 return 10.
+ * If x = 345 and y = 335 return 350
+ */
double d;
d = (double)(y - x);
double ccwise_angle_diff(float x,float y)
{
/* Returns the counterclockwise angle differnce of x to y.
- * If x = 345 and y = 355 return 350.
- * If x = 345 and y = 335 return 10
- */
+ * If x = 345 and y = 355 return 350.
+ * If x = 345 and y = 335 return 10
+ */
double d;
d = (double)(x - y);
if (hash == NULL) return NULL;
/* Set low pointer to hash index with ray angle just below
- * requested angle and high pointer to just above requested
- * angle.
- */
+ * requested angle and high pointer to just above requested
+ * angle.
+ */
/* set low and high pointers to initial search locations*/
low = hash;
high = hash->ray_high;
/* Search until clockwise angle to high is less then clockwise
- * angle to low.
- */
+ * angle to low.
+ */
clow = cwise_angle_diff(ray_angle,low->ray->h.azimuth);
chigh = cwise_angle_diff(ray_angle,high->ray->h.azimuth);
cclow = ccwise_angle_diff(ray_angle,low->ray->h.azimuth);
while((chigh > clow) && (clow != 0))
- {
- if (clow < cclow)
- {
- low = low->ray_low;
- high = low->ray_high; /* Not the same low as line before ! */
- }
- else
- {
- low = low->ray_high;
- high = low->ray_high; /* Not the same low as line before ! */
- }
-
- clow = cwise_angle_diff(ray_angle,low->ray->h.azimuth);
- chigh = cwise_angle_diff(ray_angle,high->ray->h.azimuth);
- cclow = ccwise_angle_diff(ray_angle,low->ray->h.azimuth);
- }
+ {
+ if (clow < cclow)
+ {
+ low = low->ray_low;
+ high = low->ray_high; /* Not the same low as line before ! */
+ }
+ else
+ {
+ low = low->ray_high;
+ high = low->ray_high; /* Not the same low as line before ! */
+ }
+
+ clow = cwise_angle_diff(ray_angle,low->ray->h.azimuth);
+ chigh = cwise_angle_diff(ray_angle,high->ray->h.azimuth);
+ cclow = ccwise_angle_diff(ray_angle,low->ray->h.azimuth);
+ }
if(chigh <= cclow)
- {
- return high;
- }
+ {
+ return high;
+ }
else
- {
- return low;
- }
+ {
+ return low;
+ }
}
* why bother?
*/
while(table->indexes[hash] == NULL) {
- hash++;
- if(hash >= table->nindexes) hash = 0;
+ hash++;
+ if(hash >= table->nindexes) hash = 0;
}
return hash;
i = SWEEP_INDEX(s);
if (i==-1) { /* Obviously, an unregistered sweep. Most likely the
- * result of pointer assignments.
- */
- i = INSERT_SWEEP(s);
+ * result of pointer assignments.
+ */
+ i = INSERT_SWEEP(s);
}
if (RSL_sweep_list[i].hash == NULL) { /* First time. Construct the table. */
- RSL_sweep_list[i].hash = construct_sweep_hash_table(s);
+ RSL_sweep_list[i].hash = construct_sweep_hash_table(s);
}
return RSL_sweep_list[i].hash;
/*
* Return closest Ray in Sweep within limit (angle) specified
* in parameter list. Assume PPI mode.
- */
+ */
int hindex;
Hash_table *hash_table;
Azimuth_hash *closest;
closest = the_closest_hash(hash_table->indexes[hindex],ray_angle);
/* Is closest ray within limit parameter ? If
- * so return ray, else return NULL.
- */
+ * so return ray, else return NULL.
+ */
close_diff = angle_diff(ray_angle,closest->ray->h.azimuth);
if (ray == NULL) return BADVAL;
if(ray->h.gate_size == 0)
- {
- if(radar_verbose_flag)
- {
- fprintf(stderr,"RSL_get_value_from_ray: ray->h.gate_size == 0\n");
- }
- return BADVAL;
- }
+ {
+ if(radar_verbose_flag)
+ {
+ fprintf(stderr,"RSL_get_value_from_ray: ray->h.gate_size == 0\n");
+ }
+ return BADVAL;
+ }
/* range_bin1 is range to center of first bin */
bin_index = (int)(((rm - ray->h.range_bin1)/ray->h.gate_size) + 0.5);
i++;
while( i < v->h.nsweeps)
- {
- if(v->sweep[i] != NULL) break;
- i++;
- }
+ {
+ if(v->sweep[i] != NULL) break;
+ i++;
+ }
if(i >= v->h.nsweeps) return NULL;
i--;
while( i >= 0)
- {
- if(v->sweep[i] != NULL) break;
- i--;
- }
+ {
+ if(v->sweep[i] != NULL) break;
+ i--;
+ }
if(i < 0) return NULL;
smallest_ray_num = 9999999;
if (s == NULL) return r;
for (i=0; i<s->h.nrays; i++)
- if (s->ray[i]) {
- if (s->ray[i]->h.ray_num <= 1) return s->ray[i];
- if (s->ray[i]->h.ray_num < smallest_ray_num) {
- r = s->ray[i];
- smallest_ray_num = r->h.ray_num;
- }
- }
+ if (s->ray[i]) {
+ if (s->ray[i]->h.ray_num <= 1) return s->ray[i];
+ if (s->ray[i]->h.ray_num < smallest_ray_num) {
+ r = s->ray[i];
+ smallest_ray_num = r->h.ray_num;
+ }
+ }
return r;
}
int i;
if (v == NULL) return NULL;
for (i=0; i<v->h.nsweeps; i++)
- if (RSL_get_first_ray_of_sweep(v->sweep[i])) return v->sweep[i];
+ if (RSL_get_first_ray_of_sweep(v->sweep[i])) return v->sweep[i];
return NULL;
}
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1
};
if (radar_verbose_flag) fprintf(stderr,"Selected fields for ingest:");
while (c_field) {
- /* CHECK EACH FIELD. This is a fancier case statement than C provides. */
- if (radar_verbose_flag) fprintf(stderr," %s", c_field);
- if (strcasecmp(c_field, "all") == 0) {
- for (i=0; i<MAX_RADAR_VOLUMES; i++) rsl_qfield[i] = 1;
- } else if (strcasecmp(c_field, "none") == 0) {
- for (i=0; i<MAX_RADAR_VOLUMES; i++) rsl_qfield[i] = 0;
- } else {
-
- for (i=0; i<MAX_RADAR_VOLUMES; i++)
- if (strcasecmp(c_field, RSL_ftype[i]) == 0) {
- rsl_qfield[i] = 1;
- break; /* Break the for loop. */
- }
-
- if (i == MAX_RADAR_VOLUMES) {
- if (radar_verbose_flag)
- fprintf(stderr, "\nRSL_select_fields: Invalid field name <<%s>> specified.\n", c_field);
- }
- }
- c_field = va_arg(ap, char *);
+ /* CHECK EACH FIELD. This is a fancier case statement than C provides. */
+ if (radar_verbose_flag) fprintf(stderr," %s", c_field);
+ if (strcasecmp(c_field, "all") == 0) {
+ for (i=0; i<MAX_RADAR_VOLUMES; i++) rsl_qfield[i] = 1;
+ } else if (strcasecmp(c_field, "none") == 0) {
+ for (i=0; i<MAX_RADAR_VOLUMES; i++) rsl_qfield[i] = 0;
+ } else {
+
+ for (i=0; i<MAX_RADAR_VOLUMES; i++)
+ if (strcasecmp(c_field, RSL_ftype[i]) == 0) {
+ rsl_qfield[i] = 1;
+ break; /* Break the for loop. */
+ }
+
+ if (i == MAX_RADAR_VOLUMES) {
+ if (radar_verbose_flag)
+ fprintf(stderr, "\nRSL_select_fields: Invalid field name <<%s>> specified.\n", c_field);
+ }
+ }
+ c_field = va_arg(ap, char *);
}
if (radar_verbose_flag) fprintf(stderr,"\n");
RSL_invf_list[0] = RSL_invf_list[0];
for (i=0; i<MAX_RADAR_VOLUMES; i++)
- if (strcasecmp(c_field, RSL_ftype[i]) == 0) {
- rsl_qfield[i] = 1;
- break; /* Break the for loop. */
- }
+ if (strcasecmp(c_field, RSL_ftype[i]) == 0) {
+ rsl_qfield[i] = 1;
+ break; /* Break the for loop. */
+ }
if (i == MAX_RADAR_VOLUMES) { /* We should never see this message for
- * properly written ingest code.
- */
- fprintf(stderr, "rsl_query_field: Invalid field name <<%s>> specified.\n", c_field);
+ * properly written ingest code.
+ */
+ fprintf(stderr, "rsl_query_field: Invalid field name <<%s>> specified.\n", c_field);
}
/* 'i' is the index. Is it set? */
/* Could be static and force use of 'rsl_query_sweep' */
int *rsl_qsweep = NULL; /* If NULL, then read all sweeps. Otherwise,
- * read what is on the list.
- */
+ * read what is on the list.
+ */
#define RSL_MAX_QSWEEP 500 /* It'll be rediculious to have more. :-) */
int rsl_qsweep_max = RSL_MAX_QSWEEP;
if (radar_verbose_flag) fprintf(stderr,"Selected sweeps for ingest:");
- for (;c_sweep; c_sweep = va_arg(ap, char *))
- {
- /* CHECK EACH FIELD. This is a fancier case statement than C provides. */
- if (radar_verbose_flag) fprintf(stderr," %s", c_sweep);
- if (strcasecmp(c_sweep, "all") == 0) {
- for (i=0; i<RSL_MAX_QSWEEP; i++) rsl_qsweep[i] = 1;
- rsl_qsweep_max = RSL_MAX_QSWEEP;
- } else if (strcasecmp(c_sweep, "none") == 0) {
- /* Commented this out to save runtime -GJW
- * rsl_qsweep[] already initialized to 0 above.
- *
- * for (i=0; i<RSL_MAX_QSWEEP; i++) rsl_qsweep[i] = 0;
- * rsl_qsweep_max = -1;
- */
- } else {
- i = sscanf(c_sweep,"%d", &isweep);
- if (i == 0) { /* No match, bad argument. */
- if (radar_verbose_flag) fprintf(stderr,"\nRSL_read_these_sweeps: bad parameter %s. Ignoring.\n", c_sweep);
- continue;
- }
-
- if (isweep < 0 || isweep > RSL_MAX_QSWEEP) {
- if (radar_verbose_flag) fprintf(stderr,"\nRSL_read_these_sweeps: parameter %s not in [0,%d). Ignoring.\n", c_sweep, RSL_MAX_QSWEEP);
- continue;
- }
-
- if (isweep > rsl_qsweep_max) rsl_qsweep_max = isweep;
- rsl_qsweep[isweep] = 1;
- }
+ for (;c_sweep; c_sweep = va_arg(ap, char *))
+ {
+ /* CHECK EACH FIELD. This is a fancier case statement than C provides. */
+ if (radar_verbose_flag) fprintf(stderr," %s", c_sweep);
+ if (strcasecmp(c_sweep, "all") == 0) {
+ for (i=0; i<RSL_MAX_QSWEEP; i++) rsl_qsweep[i] = 1;
+ rsl_qsweep_max = RSL_MAX_QSWEEP;
+ } else if (strcasecmp(c_sweep, "none") == 0) {
+ /* Commented this out to save runtime -GJW
+ * rsl_qsweep[] already initialized to 0 above.
+ *
+ * for (i=0; i<RSL_MAX_QSWEEP; i++) rsl_qsweep[i] = 0;
+ * rsl_qsweep_max = -1;
+ */
+ } else {
+ i = sscanf(c_sweep,"%d", &isweep);
+ if (i == 0) { /* No match, bad argument. */
+ if (radar_verbose_flag) fprintf(stderr,"\nRSL_read_these_sweeps: bad parameter %s. Ignoring.\n", c_sweep);
+ continue;
+ }
+
+ if (isweep < 0 || isweep > RSL_MAX_QSWEEP) {
+ if (radar_verbose_flag) fprintf(stderr,"\nRSL_read_these_sweeps: parameter %s not in [0,%d). Ignoring.\n", c_sweep, RSL_MAX_QSWEEP);
+ continue;
+ }
+
+ if (isweep > rsl_qsweep_max) rsl_qsweep_max = isweep;
+ rsl_qsweep[isweep] = 1;
+ }
}
if (radar_verbose_flag) fprintf(stderr,"\n");
if (r == NULL) return;
for (ibin=0; ibin<r->h.nbins; ibin++)
{
- val = r->h.f(r->range[ibin]);
- if ( val >= (float)NOECHO ) continue; /* Invalid value */
- r->range[ibin] = r->h.invf(val + dbz_offset);
+ val = r->h.f(r->range[ibin]);
+ if ( val >= (float)NOECHO ) continue; /* Invalid value */
+ r->range[ibin] = r->h.invf(val + dbz_offset);
}
}
int iray;
if (s == NULL) return;
for (iray=0; iray<s->h.nrays; iray++)
- RSL_add_dbz_offset_to_ray(s->ray[iray], dbz_offset);
+ RSL_add_dbz_offset_to_ray(s->ray[iray], dbz_offset);
}
/*********************************************************************/
int isweep;
if (v == NULL) return;
for (isweep=0; isweep<v->h.nsweeps; isweep++)
- RSL_add_dbz_offset_to_sweep(v->sweep[isweep], dbz_offset);
+ RSL_add_dbz_offset_to_sweep(v->sweep[isweep], dbz_offset);
}