예제 #1
0
void nexr_list_lev ( char *filnam, int *lenfnam,
		char *radparm, int *lenparm, int *ier)

{

int i, nbin, iret;
long    flen, lofset = 20;
char cfil[LLPATH], cprm[LLMXLN];
char stid[]="KFTG", callid[5];

Radar *radar=NULL;
FILE *fp;


*ier = 0;

strncpy(cfil, filnam, *lenfnam);
strncpy(cprm, radparm, *lenparm);
cfil[*lenfnam] = '\0';
cprm[*lenparm] = '\0';

/* get actual file name to use in rsl call */
cfl_inqr ( cfil, NULL, &flen, cfil, &iret);

RSL_select_fields(cprm, NULL);

/*
if ( cprm[0] == 'd' )
        VINDEX = DZ_INDEX;
else if ( cprm[0] == 's' )
        VINDEX = SW_INDEX;
else if ( cprm[0] == 'v' )
        VINDEX = VR_INDEX;
*/

/*
 * see if we can get the station ID from bytes 21-24, otherwise, just use any ID
 */

fp = cfl_ropn ( cfil, NULL, &iret );
if  ( iret != 0 )  {
    printf("failed to open %s\n",cfil);
    *ier = -1;
    return;
    }
else {
    cfl_seek ( fp, lofset, SEEK_SET, &iret );
    if  ( iret != 0 )  {
        *ier = -1;
        cfl_clos ( fp, &iret );
        return;
        }
    }

cfl_read ( fp, 4, (unsigned char *)callid, &nbin, &iret );
cfl_clos ( fp, &iret );

if (( nbin < 4 )||(callid[0] < 'A')||(callid[0] > 'Z')) /* use a safe station ID....we aren't plotting lat/lon anyhow */
   strcpy(callid,stid);
else
   callid[4] = '\0';


/*RSL_radar_verbose_on();*/
RSL_read_these_sweeps("all", NULL);
radar = RSL_wsr88d_to_radar(cfil, callid);
/*RSL_radar_verbose_off();*/

if ( radar == NULL )
   {
   printf("failed to open %s\n",cfil);
   *ier = -1;
   return;
   }

for (i=0; i<radar->h.nvolumes; i++) {
   if (radar->v[i]) {
        printf("Volume %s: Sweeps available %d\n", cprm, radar->v[i]->h.nsweeps);
        print_header_for_volume(radar->v[i]);
      }
   }

RSL_free_radar(radar);


}
main(int argc, char **argv)
{
  char *infile;

  Radar *radar;
  char *site = NULL;
  int i;

  qprint_ray = 0; /* Global flag for printing ray values. */
  process_args(argc, argv, &infile, &qprint_ray, &site); /* malloc for in/outfile */

  RSL_radar_verbose_on();
  RSL_read_these_sweeps("all", NULL);

  radar = RSL_anyformat_to_radar(infile, site);

  printf("Radar date: %2.2d/%2.2d/%2.2d\n", radar->h.month, radar->h.day, radar->h.year);
  printf("Radar time: %2.2d:%2.2d:%f\n", radar->h.hour, radar->h.minute, radar->h.sec);

  printf("Radar file: %s\n", infile);
  printf("Radar site: %c%c%c%c\n",
		 radar->h.name[0],
		 radar->h.name[1],
		 radar->h.name[2],
		 radar->h.name[3]);
  printf("Radar date: %2.2d/%2.2d/%2.2d\n", radar->h.month, radar->h.day, radar->h.year);
  printf("Radar time: %2.2d:%2.2d:%f\n", radar->h.hour, radar->h.minute, radar->h.sec);


printf("Radar sec       : %f\n", radar->h.sec); /* Second plus fractional part. */
printf("Radar radar_type: %s\n", radar->h.radar_type);
                       /* Type of radar.  Use for QC-ing the data.
	                    * Supported types are:
                        * "wsr88d", "lassen", "uf",
                        * "nsig", "mcgill",
	                    * "kwajalein", "rsl", "toga".
                        * Set by appropriate ingest routine.
                        */
printf("Radar nvolumes  : %d\n", radar->h.nvolumes);
printf("Radar number    : %d\n", radar->h.number);
printf("Radar name      : %s\n", radar->h.name);
printf("Radar radar_name: %s\n", radar->h.radar_name);
printf("Radar city      : %s\n",  radar->h.city);
printf("Radar state     : %s\n", radar->h.state);
printf("Radar latd: %d\n", radar->h.latd);
printf("Radar latm: %d\n", radar->h.latm);
printf("Radar lats: %d\n", radar->h.lats);
printf("Radar lond: %d\n", radar->h.lond);
printf("Radar lonm: %d\n", radar->h.lonm);
printf("Radar lons: %d\n", radar->h.lons);
printf("Radar height: %d\n", radar->h.height);
printf("Radar spulse: %d\n", radar->h.spulse);
printf("Radar lpulse: %d\n", radar->h.lpulse);
printf("Radar lpulse: %d\n", radar->h.lpulse);


for (i=0; i<radar->h.nvolumes; i++) {

  if (radar->v[i]) {
	printf("PRINT_HEADER_FOR_VOLUME, %d, ... nsweeps = %d\n", i, radar->v[i]->h.nsweeps);
	print_header_for_volume(radar->v[i]);
  }
}
exit(0);

}