]> Pileus Git - ~andy/rsl/blobdiff - nsig_to_radar.c
RSL v1.43
[~andy/rsl] / nsig_to_radar.c
index 88788e46dba3b2ff6ae1e6535ae5cd0686cfadfa..d134b55a7461f12111c0ec18c791a3d7c408ab3d 100644 (file)
@@ -193,6 +193,7 @@ RSL_nsig_to_radar
   float azm, elev, pitch, roll, heading, azm_rate, elev_rate,
     pitch_rate, roll_rate, heading_rate,
     lat, lon;
+  float fix_angle;
   int alt;  /* Altitude */
   float rvc;  /* Radial correction velocity m/s */
   float vel_east, vel_north, vel_up; /* Platform velocity vectors m/sec */
@@ -240,17 +241,6 @@ RSL_nsig_to_radar
   if (radar_verbose_flag)
     fprintf(stderr, "Read %d bytes for rec2.\n", n);
 
-   /** Test for scan mode -- If scan is a RHI will return NULL  **/
-   /** because RSL can't handle RHI's.  In the future, replace  **/
-   /** NULL will a routine to convert RHI's to RSL Format       **/
-   ant_scan_mode =NSIG_I2(prod_file->rec2.task_config.scan_info.ant_scan_mode);
-   if(ant_scan_mode == 2)
-      {
-      if (radar_verbose_flag)
-      fprintf(stderr, "RHI scan detected. Unable to process, returning NULL.\n");
-      /*      return NULL; */
-      }
-  
   /* Count the bits set in 'data_mask' to determine the number
    * of parameters present.
    */
@@ -487,6 +477,9 @@ RSL_nsig_to_radar
    radar->h.height = (int)sea_lvl_hgt;
    radar->h.spulse = (int)(pw*1000);
    radar->h.lpulse = (int)(pw*1000);
+   ant_scan_mode = NSIG_I2(prod_file->rec2.task_config.scan_info.ant_scan_mode);
+   if(ant_scan_mode == 2 || ant_scan_mode == 7) radar->h.scan_mode = RHI;
+   else radar->h.scan_mode = PPI;
 
    if (radar_verbose_flag) {
 #ifdef NSIG_VER2
@@ -630,6 +623,14 @@ RSL_nsig_to_radar
         ifield = HC_INDEX;
         f      = HC_F; 
         invf   = HC_INVF;
+      case NSIG_DTB_DBZ2:
+        ifield = CZ_INDEX;
+        f      = CZ_F; 
+        invf   = CZ_INVF;
+      case NSIG_DTB_ZDRC2:
+        ifield = ZD_INDEX;
+        f      = ZD_F; 
+        invf   = ZD_INVF;
         break;
       default:
         fprintf(stderr,"Unknown field type: %d  Skipping it.\n", data_type);
@@ -668,8 +669,9 @@ RSL_nsig_to_radar
       sweep->h.beam_width = beam_width;
       sweep->h.vert_half_bw = vert_half_bw;
       sweep->h.horz_half_bw = horz_half_bw;
-      elev = nsig_from_bang(nsig_sweep[itype]->idh.fix_ang);
-      sweep->h.elev = elev;
+      fix_angle = nsig_from_bang(nsig_sweep[itype]->idh.fix_ang);
+      if (radar->h.scan_mode == PPI) sweep->h.elev = fix_angle;
+      else sweep->h.azimuth = fix_angle;
       
       for(j = 0; j < num_rays; j++)
         {
@@ -725,7 +727,7 @@ RSL_nsig_to_radar
             else
               ray->h.unam_rng = 0.0;
           ray->h.prf2 = (int) prf2;
-          ray->h.fix_angle = (float)sweep->h.elev;
+          ray->h.fix_angle = fix_angle;
           ray->h.azim_rate  = azim_rate;
           ray->h.pulse_count = num_samples;
           ray->h.pulse_width = pw;
@@ -734,7 +736,7 @@ RSL_nsig_to_radar
           ray->h.wavelength  = wave/100.0;     /* meters */
           ray->h.nyq_vel     = max_vel;        /* m/s */
           if (elev == 0.) elev = sweep->h.elev;
-          ray->h.elev        = elev;
+          ray->h.elev        = (nsig_from_bang(ray_p->h.end_elev)+nsig_from_bang(ray_p->h.beg_elev))/2.0;
           /* Compute mean azimuth angle for ray. */
           az1 = nsig_from_bang(ray_p->h.beg_azm);
           az2 = nsig_from_bang(ray_p->h.end_azm);