Ejemplo n.º 1
0
/* output reference position -------------------------------------------------*/
static void outrpos(FILE *fp, const double *r, const solopt_t *opt)
{
    double pos[3],dms1[3],dms2[3];
    const char *sep=opt->sep;
    
    trace(3,"outrpos :\n");
    
    if (opt->posf==SOLF_LLH||opt->posf==SOLF_ENU) {
        ecef2pos(r,pos);
        if (opt->degf) {
            deg2dms(pos[0]*R2D,dms1);
            deg2dms(pos[1]*R2D,dms2);
            fprintf(fp,"%3.0f%s%02.0f%s%08.5f%s%4.0f%s%02.0f%s%08.5f%s%10.4f",
                    dms1[0],sep,dms1[1],sep,dms1[2],sep,dms2[0],sep,dms2[1],
                    sep,dms2[2],sep,pos[2]);
        }
        else {
            fprintf(fp,"%13.9f%s%14.9f%s%10.4f",pos[0]*R2D,sep,pos[1]*R2D,
                    sep,pos[2]);
        }
    }
    else if (opt->posf==SOLF_XYZ) {
        fprintf(fp,"%14.4f%s%14.4f%s%14.4f",r[0],sep,r[1],sep,r[2]);
    }
}
Ejemplo n.º 2
0
static void RtkCommon__deg2dms(JNIEnv* env, jclass clazz, jdouble j_deg,
      jdoubleArray j_dst)
{
   double dms[3];
   deg2dms(j_deg, dms);
   (*env)->SetDoubleArrayRegion(env, j_dst, 0, 3, dms);
}
Ejemplo n.º 3
0
// latitude/longitude/height string -----------------------------------------
AnsiString __fastcall TPlot::LatLonStr(const double *pos, int ndec)
{
    AnsiString s;
    double dms1[3],dms2[3];
    
    if (LatLonFmt==0) {
        s.sprintf("%*.*f" CHARDEG " %*.*f" CHARDEG,ndec+4,ndec,pos[0]*R2D,
                  ndec+5,ndec,pos[1]*R2D);
    }
    else {
        deg2dms(pos[0]*R2D,dms1);
        deg2dms(pos[1]*R2D,dms2);
        s.sprintf("%3.0f" CHARDEG "%02.0f'%0*.*f\" %4.0f" CHARDEG "%02.0f'%0*.*f\"",
                  dms1[0],dms1[1],ndec-2,ndec-5,dms1[2],dms2[0],dms2[1],
                  ndec-2,ndec-5,dms2[2]);
    }
    return s;
}
Ejemplo n.º 4
0
void spigot2sigprocfb(SPIGOT_INFO * spigot, sigprocfb * fb, char *filenmbase)
{
   int h_or_d, m;
   double s;

   strncpy(fb->inpfile, filenmbase, 40);
   strncpy(fb->source_name, spigot->object, 80);
   fb->nifs = 1;
   if (spigot->num_samplers == 1)
      strncpy(fb->ifstream, "YXXX", 8);
   else if (spigot->num_samplers == 2)
      strncpy(fb->ifstream, "YYXX", 8);
   fb->tstart = spigot->MJD_obs + spigot->elapsed_time / SECPERDAY;
   fb->tsamp = spigot->dt_us / 1e6;
   hours2hms(spigot->ra / 15.0, &h_or_d, &m, &s);
   fb->src_raj = h_or_d * 10000.0 + m * 100.0 + s;
   deg2dms(spigot->dec, &h_or_d, &m, &s);
   fb->src_dej = abs(h_or_d) * 10000.0 + abs(m) * 100.0 + fabs(s);
   if (spigot->dec < 0) fb->src_dej = -fb->src_dej;
   fb->az_start = spigot->az;
   fb->za_start = 90.0-spigot->el;
   fb->nchans = spigot->lags_per_sample;
   fb->foff = spigot->bandwidth / fb->nchans;
   fb->fch1 = spigot->freq_ctr + (fb->nchans / 2 - 0.5) * fb->foff;
   fb->foff = -fb->foff;
   // Here is where we chop the bottom 1/4 (200MHz) of the band
   fb->nchans = fb->nchans - fb->nchans/4;
   fb->machine_id = 7;
   fb->telescope_id = 6;
   fb->nbits = 8;
   fb->sumifs = spigot->summed_pols;
   if (fb->sumifs)
      fb->nifs = 1;
   else {
      if (spigot->num_samplers == 2)
         fb->nifs = 2;
      else
         fb->nifs = 1;
   }
   /* The following are not necessary for writing filterbank files */
   fb->headerlen = 0;
   fb->N = spigot->samples_per_file;
}
Ejemplo n.º 5
0
void wapp2fb(FILE *input, FILE *output) /* includefile */
{
  FILE *bptr, *fpou, *alfa[2];
  int pixel[2];
  double pra, pdec;
  double bw, bandwidth, scale, power, hweight, tsamp_us, crate, lmst;
  double *lag, *sum, *acf, *window, jan1, days, epoch, ras,des,rahr,dede; 
  float zerolag,*block,smin,smax;
  int doit,i,j,k,two_nlags,nlags,stat,rec_size,idump,swap_bytes,ifnum,opened;
  int filesize,headersize,beam,utsecs,iymdf[4],rah,ram,ded,dem;
  unsigned char *cblock, zuc;
  unsigned short *sblock, zus; 
  unsigned int zul;
  char message[80], outfile[80];
  void *dump;
  static float realtime=0.0;

#ifdef FFTW
  fftw_plan fftplan;
#endif
  /* establish whether we need to swap bytes (WAPP is little endian) */
  swap_bytes=big_endian();

  /* initialise correlator parameters used below */
  nlags=nchans;  
  two_nlags=2*nlags;  
  bandwidth=foff*nlags;
  tsamp_us=tsamp*1.0e6;
  if (bandwidth<0.0) bandwidth *= -1.0;

#ifdef FFTW
  acf = fftw_malloc(sizeof(double) * two_nlags);
  lag = fftw_malloc(sizeof(double) * two_nlags);
  /* set up fftw table and acf array when computing power spectra */
  fftplan=fftw_plan_r2r_1d(two_nlags,acf,lag,FFTW_R2HC,FFTW_PATIENT);
#endif
#ifndef FFTW
  /* set up acf array when computing power spectra */
  acf = (double *) malloc(two_nlags * sizeof(double));
  lag = (double *) malloc(two_nlags * sizeof(double));
#endif

  if (compute_spectra) {
    /* ranges for scaling spectra */
    smin=0.0;smax=3.0;
  } else {
    /* ranges for scaling correlation functions */
    smin=-0.5;smax=1.0;
  }

  /* set up the weights for windowing of ACF to monimize FFT leakage */
  if (hanning) {
    /* Hanning window */
    hweight=0.50;
  } else if (hamming) {
    /* Hamming window */
    hweight=0.54;
  } else {
    /* no window (default) */
    hweight=1.00;
  }

  /* define the smoothing window to be applied base on the above weight */
  window = (double *) malloc(nlags * sizeof(double));
  for (j=0; j<nlags; j++) window[j]=(hweight+(1.0-hweight)*cos(PI*j/nlags));

  /* work out number of IFs to loop over */
  if (sumifs && (nifs>1)) {
    smin*=2.0;
    smax*=2.0;
    ifnum=2;
  } else {
    sumifs=0;
    ifnum=nifs;
  }

  /* calculate required record size for reading - i.e. number of bytes/dump */
  rec_size = nifs*nlags*(nbits/8);
  dump = malloc(rec_size); /* pointer to the correlator dump */

  /* correlator data rate */
  crate = 1.0/(tsamp_us-WAPP_DEAD_TIME); 
  /* scale factor to normalize correlation functions */
  if (bandwidth < 50.0) 
    bw=50.0; /* correct scaling for narrow-band use */
  else
    bw=bandwidth;

  scale = crate/bw;
  if (wapp_level==9) scale/=16.0; /* 9-level sampling */
  if (wapp_sum) scale/=2.0;  /* summed IFs (search mode) */
  scale*=pow(2.0,(double)wapp_lagtrunc); /* needed for truncation modes */

  /* now define a number of working arrays to store lags and spectra */
  block = (float *) malloc(nlags * sizeof(float));
  cblock = (unsigned char *) malloc(nlags * sizeof(unsigned char));
  sblock = (unsigned short *) malloc(nlags * sizeof(unsigned short));

  /* if the file is ALFA data --- do the demultiplexing to two files */
  if (wapp_isalfa) {

    angle_split(src_raj,&rah,&ram,&ras);
    rahr=(double)rah+(double)ram/60.0+(double)ras/3600.0;
    angle_split(src_dej,&ded,&dem,&des);
    if (ded>0)
      dede=(double)ded+(double)dem/60.0+(double)des/3600.0;
    else
      dede=(double)ded-(double)dem/60.0-(double)des/3600.0;
    /* calculate local sidereal time in hours */
    lmst=slaGmst(tstart)*12.0/4.0/atan(1.0)-4.4502051459439667;
    if (lmst<0.0) lmst+=24.0;
    slaDjcal(5,tstart,iymdf,&stat);
    slaCaldj(iymdf[0],1,1,&jan1,&stat);
    days=tstart-jan1+1.0;
    epoch=(double)iymdf[0]+days/365.25;
    utsecs=86400*(tstart-floor(tstart));

    pixel[0]=(wapp_number-1)*2;
    pixel[1]=pixel[0]+1;
    puts("opening output files for demultiplexed ALFA data...");
    for (i=0; i<2; i++) {
      if (alfa_raj[pixel[i]] == 0.0) {
      alfa_position(rahr,dede,lmst,epoch,alfa_ang,0.0,0.0,pixel[i],&pra,&pdec);
      src_raj=h2hms(pra);
      src_dej=deg2dms(pdec);
      } else {
      src_raj=h2hms(alfa_raj[pixel[i]]);
      src_dej=deg2dms(alfa_dej[pixel[i]]);
      }
      sprintf(outfile,"%s_%.0f_%05d_%04d_%s_%d.fil",
	    project,floor(tstart),utsecs,
	    scan_number,source_name,pixel[i]);
      alfa[i]=open_file(outfile,"wb");
      puts(outfile);
      filterbank_header(alfa[i]);
    }
    beam=0;
  }

  if (headerfile) {
    /* write output ASCII header file */
    fpou=open_file("head","w");  
    fprintf(fpou,"Original WAPP file: %s\n",inpfile);
    fprintf(fpou,"Sample time (us): %f\n",tsamp_us);
    fprintf(fpou,"Observation time (s): %f\n",wapp_obstime);
    fprintf(fpou,"Time stamp (MJD): %18.12f\n",tstart);
    fprintf(fpou,"Number of samples/record: %d\n",512);
    fprintf(fpou,"Center freq (MHz): %f\n",fch1+(float)nlags*foff/2.0);
    fprintf(fpou,"Channel band (kHz): %f\n",bandwidth*1000.0/nlags);
    fprintf(fpou,"Number of channels/record: %d\n",nlags);
    fprintf(fpou,"Nifs: %d\n",ifnum);
    fprintf(fpou,"RA (J2000): %f\n",src_raj);
    fprintf(fpou,"DEC (J2000):  %f\n",src_dej);
    fprintf(fpou,"Gal l: %.4f\n",srcl);
    fprintf(fpou,"Gal b: %.4f\n",srcb); 
    fprintf(fpou,"Name: %s\n",source_name);
    fprintf(fpou,"Lagformat: %d\n",wapp_lagformat);
    fprintf(fpou,"Sum: %d\n",wapp_sum);
    fprintf(fpou,"Level: %d\n",wapp_level);
    fprintf(fpou,"AZ at start: %f\n",az_start);
    fprintf(fpou,"ZA at start: %f\n",za_start);
    fprintf(fpou,"AST at start: %f\n",ast0);
    fprintf(fpou,"LST at start: %f\n",lst0);
    fprintf(fpou,"Project ID: %s\n",project);
    fprintf(fpou,"Observers: %s\n",culprits);
    filesize=sizeof_file(inpfile);
    fprintf(fpou,"File size (bytes): %d\n",filesize);
    headersize=wapp_header_size+wapp_incfile_length;
    fprintf(fpou,"Data size (bytes): %d\n",filesize-headersize);
    fprintf(fpou,"Number of samples: %d\n",nsamples(inpfile,headersize,nbits,nifs,nchans));
    fclose(fpou);
  }

  /* initialise various counters and flags */
  opened=idump=i=j=0; 

  /* main loop reading data from infile until no more left to read */
  while( (stat=read(wapp_file,dump,rec_size)) == rec_size) {

    /* calculate elapsed time and determine whether we process this record */
    realtime += (float) tsamp;
    if ( (doit=process(realtime,start_time,final_time)) == -1) break;

    if (doit) {

      /* set ALFA beam output if necessary */
      if (wapp_isalfa) {
	output=alfa[beam];       /* set output file for this loop */
	beam=!(beam);            /* flip file for next iteration */
      }

      /* clear zerolag and blocksum arrays */
      zerolag=0.0;
      for (j=0; j<nlags; j++) block[j]=0.0;

      /* loop over the IFs */
      for (i=0; i<ifnum; i++) {
	if (ifstream[i]=='Y') {
	  if (zerolagdump) {
	    /* only interested in the zero lag term for each IF */
	    switch (nbits) {
	    case 8:
	      zuc = *(((unsigned char *)dump)+i*nlags);
	      zerolag+=zuc;
	      break;
	    case 16:
	      zus = *(((unsigned short *)dump)+i*nlags);
	      if (swap_bytes) swap_short(&zus); 
	      zerolag+=zus;
	      break;
	    case 32:
	      zul = *(((unsigned int *)dump)+i*nlags);
	      if (swap_bytes) swap_int(&zul); 
	      zerolag+=zul;
	      break;
	    }
	    /* write out the data checking IF number for summed mode */
	    if ( (sumifs && (i==1)) || (!sumifs) ) {
	      if (obits==32) {
		if (swapout) swap_float(&zerolag);
		fwrite(&zerolag,sizeof(float),1,output);
	      } else {
		sprintf(message,"cannot write %d bits in zerolag mode",obits);
		error_message(message);
	      }
	    }
	  } else {
	    /* fill lag array with scaled CFs */
	    for (j=0; j<nlags; j++) {
	      switch (nbits) {
	      case 8:
		zuc = *(((unsigned char *)dump)+j+i*nlags);
		lag[j] = scale * (double) zuc - 1.0;
		break;
	      case 16:
		zus = *(((unsigned short *)dump)+j+i*nlags);
		if (swap_bytes) swap_short(&zus);
		lag[j] = scale * (double) zus - 1.0;
		break;
	      case 32:
		zul = *(((unsigned int  *)dump)+j+i*nlags);
		if (swap_bytes) swap_int(&zul);
		lag[j] = scale * (double) zul - 1.0;
		break;
	      }
	    }
	    /* calculate power and correct for finite level quantization */
	    power = inv_cerf(lag[0]);
	    power = 0.1872721836/power/power;
	    if (i<2) {
	      if (do_vanvleck) { 
		if (wapp_level==3) {
		  /* apply standard 3-level van vleck correction */
		  vanvleck3lev(lag,nlags);
		} else if (wapp_level==9) {
		  /* apply 9-level van vleck correction */
		  vanvleck9lev(lag,nlags);
		}
	      }
	    }

	    if (compute_spectra) {
	      /* form windowed even ACF in array */
	      for(j=1; j<nlags; j++) {
		acf[j]=window[j]*lag[j]*power;
		acf[two_nlags-j]=acf[j];
	      }   
	      acf[nlags]=0.0;
	      acf[0]=lag[0]*power; 
	      /* FFT the ACF (which is real and even) -> real and even FFT */
#ifdef FFTW
	      fftw_execute(fftplan);
#endif
#ifndef FFTW
	      rfft(two_nlags,acf,lag);
#endif
	      /* if the band needs to be flipped --- do it here */
	      if (wapp_flip) {
		/* use acf as temporary array */
		for (j=0;j<nlags;j++) acf[j]=lag[j]; 
		k=nlags-1;
		for (j=0;j<nlags;j++) {
		  lag[k]=acf[j];
		  k--;
		}
	      }
  	      /* add lags to block array */
	      for (j=0; j<nlags; j++) block[j]+=lag[j];
	    } else {			
	      /* just copy correlation functions into block */
	      for (j=0; j<nlags; j++) block[j]=lag[j];	
	    }
	    /* write out data block checking IF number for summed mode */
	    if ( (sumifs && (i==1)) || (!sumifs) ) {
	      if (obits==32) {
		if (swapout) for (j=0; j<nlags; j++) swap_float(&block[j]);
		fwrite(block,sizeof(float),nlags,output);
	      } else if (obits==16) {
		float2short(block,nlags,smin,smax,sblock);
		if (swapout) for (j=0; j<nlags; j++) swap_short(&sblock[j]);
		fwrite(sblock,sizeof(unsigned short),nlags,output);
	      } else if (obits==8) {
		float2char(block,nlags,smin,smax,cblock);
		fwrite(cblock,sizeof(unsigned char),nlags,output);
	      } else if (obits==4) {
		float2four(block,nlags,smin,smax,cblock);
		fwrite(cblock,sizeof(unsigned char),nlags/2,output);
	      } else {
		sprintf(message,"cannot write %d bits in wapp2fb",obits);
		error_message(message);
	      }
	    }
	  } /* end of zerolagdump if */

	  if (!sumifs) { /* reset block and zerolag if not summing */
	    zerolag=0.0;
	    for (j=0; j<nlags; j++) block[j]=0.0;
	  }
	}          /* end of IFstream if */
      }            /* end of loop over IFs */
    }              /* end of processing if */

    /* increment dump counter and update logfile every 512 dumps */
    idump++;
    if (idump%512 == 0) {
      if (!opened) {
	/* open up logfile */
	open_log("filterbank.monitor");
	opened=1;
      }
      sprintf(message,"time:%.1fs",realtime);
      update_log(message);
    }
  }                /* end of main read loop*/

    
  /* job done - free up remaining arrays */
  free(dump);free(block);free(sblock);free(cblock);free(window);
#ifdef FFTW
  fftw_destroy_plan(fftplan);
  fftw_free(acf); fftw_free(lag);
#endif
#ifndef FFTW
  free(acf); free(lag);
#endif
}
Ejemplo n.º 6
0
void spectra_info_to_inf(struct spectra_info *s, infodata *idata)
// Convert a spectra_info structure into an infodata structure
{
    int ii, index = 2;
    char ctmp[100];
    struct passwd *pwd;
    
    strncpy(idata->object, s->source, 80);
    hours2hms(s->ra2000 / 15.0, &(idata->ra_h), &(idata->ra_m), &(idata->ra_s));
    deg2dms(s->dec2000, &(idata->dec_d), &(idata->dec_m), &(idata->dec_s));
    strcpy(idata->telescope, s->telescope);
    strcpy(idata->instrument, s->backend);
    idata->num_chan = s->num_channels;
    idata->dt = s->dt;
    // DATEOBS_to_MJD(s->date_obs, &(idata->mjd_i), &(idata->mjd_f));
    idata->mjd_i = (int)(s->start_MJD[0]);
    idata->mjd_f = s->start_MJD[0] - idata->mjd_i;
    idata->N = s->N;
    idata->freqband = s->BW;
    idata->chan_wid = s->df;
    idata->freq = s->lo_freq;
    idata->fov = s->beam_FWHM * 3600.0; // in arcsec
    idata->bary = 0;
    idata->numonoff = 0;
    strcpy(idata->band, "Radio");
    pwd = getpwuid(geteuid());
    strcpy(idata->analyzer, pwd->pw_name);
    strncpy(idata->observer, s->observer, 80);
    if (s->summed_polns)
        sprintf(ctmp,
                "2 polns were summed.  Samples have %d bits.",
                s->bits_per_sample);
    else
        sprintf(ctmp, "%d polns were not summed.  Samples have %d bits.",
                s->num_polns, s->bits_per_sample);
    sprintf(idata->notes, "Project ID %s, Date: %s.\n    %s\n",
            s->project_id, s->date_obs, ctmp);
    // If we have more than one input file, see it we need onoff bins
    if (s->num_files == 1 && s->num_pad[0] == 0) {
        idata->numonoff = 0;
        return;
    }
    /* Determine the topocentric onoff bins */
    idata->numonoff = 1;
    idata->onoff[0] = 0.0;
    idata->onoff[1] = s->num_spec[0] - 1.0;
    for (ii = 1; ii < s->num_files; ii++) {
        if (s->num_pad[ii - 1]) {
            idata->onoff[index] = idata->onoff[index - 1] + s->num_pad[ii - 1];
            idata->onoff[index + 1] = idata->onoff[index] + s->num_spec[ii];
            idata->numonoff++;
            index += 2;
        } else {
            idata->onoff[index - 1] += s->num_spec[ii];
        }
    }
    if (s->num_pad[s->num_files - 1]) {
        idata->onoff[index] = idata->onoff[index - 1] + s->num_pad[s->num_files - 1];
        idata->onoff[index + 1] = idata->onoff[index];
        idata->numonoff++;
    }
}
Ejemplo n.º 7
0
void spigot2sigprocfb(SPIGOT_INFO * spigot, sigprocfb * fb, char *filenmbase, 
                      int lokill, int hikill, int downsamp, 
                      int update_posn, double time_offset)
{
   int h_or_d, m;
   double s, dt;

   /* Set the time offset for the posn calc */
   if (update_posn){
      dt = time_offset;
   } else {
      dt = 0.0;
   }
   strncpy(fb->inpfile, filenmbase, 40);
   strncpy(fb->source_name, spigot->object, 80);
   fb->nifs = 1;
   if (spigot->num_samplers == 1)
      strncpy(fb->ifstream, "YXXX", 8);
   else if (spigot->num_samplers == 2)
      strncpy(fb->ifstream, "YYXX", 8);
   fb->tstart = spigot->MJD_obs + spigot->elapsed_time / SECPERDAY;
   fb->tsamp = spigot->dt_us / 1e6 * downsamp;
   hours2hms(spigot->ra / 15.0, &h_or_d, &m, &s);
   fb->src_raj = h_or_d * 10000.0 + m * 100.0 + s;
   deg2dms(spigot->dec, &h_or_d, &m, &s);
   fb->src_dej = abs(h_or_d) * 10000.0 + abs(m) * 100.0 + fabs(s);
   if (spigot->dec < 0) fb->src_dej = -fb->src_dej;
   fb->az_start = spigot->az;
   fb->za_start = 90.0-spigot->el;
   fb->nchans = spigot->lags_per_sample;
   fb->foff = spigot->bandwidth / fb->nchans;
   fb->fch1 = spigot->freq_ctr + (fb->nchans / 2 - 0.5) * fb->foff;
   fb->fch1 -= fb->foff * hikill;
   fb->nchans -= (hikill + lokill);
   fb->foff = -fb->foff;
   fb->machine_id = 7;
   fb->telescope_id = 6;
   fb->nbits = 8;
   fb->sumifs = spigot->summed_pols;
   if (fb->sumifs)
      fb->nifs = 1;
   else {
      if (spigot->num_samplers == 2)
         fb->nifs = 2;
      else
         fb->nifs = 1;
   }
   /* The following are not necessary for writing filterbank files */
   fb->headerlen = 0;
   fb->N = spigot->samples_per_file;

   /* Update the position if the GBT was not tracking */
   /* (i.e. for the driftscan surveys)                */
   if (update_posn && !spigot->tracking) {
      int N=0;
      char scope[10]={"GBT"}, type[]={"A"};
      char name[40];
      double MJD, lon, lat, hgt, microns, az, zd, rap, dap, rmn, dmn;
      double dtmp=0.0, atm=1010.0, temp=283.0;
      double humid=0.5, tlr=0.0065, eq=2000.0;

      /* Compute the RA/DEC using SLALIB from the Az/El */

      slaObs(N,scope,name,&lon,&lat,&hgt);
      if (fabs(hgt-880.0) > 0.01) {
         printf("Warning!:  SLALIB is not correctly identifying the GBT!\n\n");
      }
      //printf("slalib: %d '%s' '%s' %f  %f  %f\n", 
      //      N, scope, name, lon, lat, hgt);
      lon = -lon;
      az = fb->az_start * DEGTORAD;
      zd = fb->za_start * DEGTORAD;
      microns = 3e8/(spigot->freq_ctr*1e6)*1e6;
      MJD = fb->tstart + dt/86400.0;
      slaOap(type,az,zd,MJD,dtmp,lon,lat,hgt,
             dtmp,dtmp,temp,atm,humid,microns,tlr,&rap,&dap);
      //printf("slalib:  %.15f  %.15f\n", rap, dap);
      slaAmp(rap,dap,MJD,eq,&rmn,&dmn);
      //printf("slalib:  %.15f  %.15f\n", rmn, dmn);

      /* Now update the positions */
      hours2hms(rmn * RADTODEG / 15.0, &h_or_d, &m, &s);
      fb->src_raj = h_or_d * 10000.0 + m * 100.0 + s;
      deg2dms(dmn * RADTODEG, &h_or_d, &m, &s);
      fb->src_dej = abs(h_or_d) * 10000.0 + abs(m) * 100.0 + fabs(s);
      if (dmn < 0) fb->src_dej = -fb->src_dej;
   }
}