]> Pileus Git - ~andy/rsl/blobdiff - src/wsr88d_m31.c
Merge branch 'master' into aweather
[~andy/rsl] / src / wsr88d_m31.c
similarity index 98%
rename from wsr88d_m31.c
rename to src/wsr88d_m31.c
index 9e4c5b198603b7172bafd659ed092e1dba08ec44..4325407d6403f8dabc0b32eed73b992227097b07 100644 (file)
@@ -380,7 +380,7 @@ void wsr88d_load_ray_into_radar(Wsr88d_ray_m31 *wsr88d_ray, int isweep,
     int *field_offset;
     int ifield, nfields;
     int iray;
-    const nconstblocks = 3;
+    const int nconstblocks = 3;
 
     Data_moment_hdr data_hdr;
     int ngates, do_swap;
@@ -388,11 +388,11 @@ void wsr88d_load_ray_into_radar(Wsr88d_ray_m31 *wsr88d_ray, int isweep,
     unsigned short item;
     float value, scale, offset;
     unsigned char *data;
-    Range (*invf)(float x);
-    float (*f)(Range x);
     Ray *ray;
     int vol_index, waveform;
-    char *type_str;
+    Range (*invf)(float x) = DZ_INVF;
+    float (*f)(Range x) = DZ_F;
+    char *type_str = "Unknown type";
 
     int keep_hi_prf_dz = 0; /* TODO: make this an argument. */
 
@@ -471,13 +471,11 @@ void wsr88d_load_ray_into_radar(Wsr88d_ray_m31 *wsr88d_ray, int isweep,
        if (data_hdr.scale == 0) scale = 1.0; 
        data = &wsr88d_ray->data[data_index];
        for (i = 0; i < ngates; i++) {
-           if (data_hdr.datasize_bits != 16) {
-               item = *data;
-               data++;
-           } else {
-               item = *(unsigned short *)data;
+           if (data_hdr.datasize_bits == 16) {
+               item = ((unsigned short *)data)[i];
                if (do_swap) swap_2_bytes(&item);
-               data += 2;
+           } else {
+               item = ((unsigned char  *)data)[i];
            }
            if (item > 1)
                value = (item - offset) / scale;