コード例 #1
0
ファイル: oldrawdlm.c プロジェクト: Shirling-VT/VTRST3.5
static IDL_VPTR IDLOldRawWrite(int argc,IDL_VPTR *argv) {
  int s=0;
  IDL_LONG unit=0,recnum;
  IDL_FILE_STAT stat;

  struct RadarIDLParm *iprm=NULL;
  struct RawIDLData *iraw=NULL;

  struct RadarParm *prm=NULL;
  struct RawData *raw=NULL;

  FILE *fp;

  IDL_ENSURE_SCALAR(argv[0]);
  IDL_ENSURE_STRUCTURE(argv[1]);
  IDL_ENSURE_STRUCTURE(argv[2]);
  IDL_ENSURE_SCALAR(argv[3]);
  IDL_EXCLUDE_EXPR(argv[1]);
  IDL_EXCLUDE_EXPR(argv[2]);

  unit=IDL_LongScalar(argv[0]);
  recnum=IDL_LongScalar(argv[3]);

  s=IDL_FileEnsureStatus(IDL_MSG_RET,unit,IDL_EFS_USER);

  if (s==FALSE) {
    s=-1;
    return (IDL_GettmpLong(s));
  }


  /* Get information about the file */

  IDL_FileFlushUnit(unit);
  IDL_FileStat(unit,&stat);

  /* Find the file pointer */

  fp=stat.fptr;

  if (fp==NULL) {
    s=-1;
    return (IDL_GettmpLong(s));
  }

  iprm=(struct RadarIDLParm *) argv[1]->value.s.arr->data;
  iraw=(struct RawIDLData *) argv[2]->value.s.arr->data;

  prm=RadarParmMake();
  raw=RawMake();

  IDLCopyRadarParmFromIDL(iprm,prm);
  IDLCopyRawDataFromIDL(prm->nrang,prm->mplgs,prm->xcf,iraw,raw);

  s=OldRawFwrite(fp,"rawwrite",prm,raw,recnum,NULL);

  RadarParmFree(prm);
  RawFree(raw);



  return (IDL_GettmpLong(s));
}
コード例 #2
0
int32 OldRawIDLWrite(int argc,char *argv[]) {

  int n,x;
  struct RadarIDLParm *idlprm;
  struct RawIDLData *idlraw;
  struct RadarParm prm;
  struct RawData raw;
  int32 recnum;
  IDL_FILE_STAT stat;
  FILE *fp;
  int unit; 
  int s;

  unit = *( (int32 *) argv[0]);

  /* Make sure that the "STDIO" keyword was used to
   * open the file in IDL.
   */

  s=IDL_FileEnsureStatus(IDL_MSG_RET,unit,IDL_EFS_STDIO);
  if (s==FALSE) return -1;

  /* Get information about the file */

  IDL_FileStat(unit,&stat);
 
  /* Find the file pointer */

  fp=stat.fptr; 

  fflush(fp);
  
  if (fp==NULL) return -1;

  /* get the structure pointers */

  idlprm=(struct RadarIDLParm *) argv[1];
  idlraw=(struct RawIDLData *) argv[2];
  recnum=*((int32 *) argv[3]);
  memset(&prm,0,sizeof(struct RadarParm));
  memset(&raw,0,sizeof(struct RawData));

  /* load up the data structures */

  prm.revision.major=idlprm->revision.major;
  prm.revision.minor=idlprm->revision.minor;
  prm.cp=idlprm->cp;
  prm.stid=idlprm->stid;
  prm.time.yr=idlprm->time.yr;
  prm.time.mo=idlprm->time.mo;
  prm.time.dy=idlprm->time.dy;
  prm.time.hr=idlprm->time.hr;
  prm.time.mt=idlprm->time.mt;
  prm.time.sc=idlprm->time.sc;
  prm.time.us=idlprm->time.us;
  prm.txpow=idlprm->txpow;
  prm.nave=idlprm->nave;
  prm.atten=idlprm->atten;
  prm.lagfr=idlprm->lagfr;
  prm.smsep=idlprm->smsep;
  prm.ercod=idlprm->ercod;
  prm.stat.agc=idlprm->stat.agc;
  prm.stat.lopwr=idlprm->stat.lopwr;
  prm.noise.search=idlprm->noise.search;
  prm.noise.mean=idlprm->noise.mean;
  prm.channel=idlprm->channel;
  prm.bmnum=idlprm->bmnum;
  prm.scan=idlprm->scan;
  prm.rxrise=idlprm->rxrise;
  prm.intt.sc=idlprm->intt.sc;
  prm.intt.us=idlprm->intt.us;
  prm.txpl=idlprm->txpl;
  prm.mpinc=idlprm->mpinc;
  prm.mppul=idlprm->mppul;
  prm.mplgs=idlprm->mplgs;
  prm.nrang=idlprm->nrang;
  prm.frang=idlprm->frang;
  prm.rsep=idlprm->rsep;
  prm.xcf=idlprm->xcf;
  prm.tfreq=idlprm->tfreq;
  prm.offset=idlprm->offset;
  prm.mxpwr=idlprm->mxpwr;
  prm.lvmax=idlprm->lvmax;

  for (n=0;n<prm.mppul;n++) prm.pulse[n]=idlprm->pulse[n];
  for (n=0;n<prm.mplgs;n++) {
    prm.lag[n][0]=idlprm->lag[n];
    prm.lag[n][1]=idlprm->lag[LAG_SIZE+n];
  }

  if (strlen(IDL_STRING_STR(&idlprm->combf)) !=0) 
    strncpy(prm.combf,IDL_STRING_STR(&idlprm->combf),COMBF_SIZE);

  raw.revision.major=idlraw->revision.major;
  raw.revision.minor=idlraw->revision.minor;
  raw.thr=idlraw->thr;

  for (n=0;n<prm.nrang;n++) {
    raw.pwr0[n]=idlraw->pwr0[n];

    for (x=0;x<prm.mplgs;x++) {
      raw.acfd[n][x][0]=idlraw->acfd[x*MAX_RANGE+n];
      raw.acfd[n][x][1]=idlraw->acfd[LAG_SIZE*MAX_RANGE+MAX_RANGE*x+n];
      if (prm.xcf !=0) {
        raw.xcfd[n][x][0]=idlraw->xcfd[x*MAX_RANGE+n];
        raw.xcfd[n][x][1]=idlraw->xcfd[LAG_SIZE*MAX_RANGE+MAX_RANGE*x+n];
      }
    }

  }
 
  s=OldRawFwrite(fp,"rawwrite",&prm,&raw,recnum,NULL);

  return s;

}