/************************************************************************ * updatecm reads a file in cm format and update with new pred-depth * * * ************************************************************************/ /************************************************************************ * Creator: * * Date : * ************************************************************************/ /************************************************************************ * Modification History: * * Date : * * * ************************************************************************/ #include #include #include main(int argc, char **argv) { double lat,lon,pd; int idepth,pred; int id,nrec,sigh,sigd,num; if(argc < 2){ fprintf(stderr,"usage: %s topo.grd < file.cm > file.cm\n\n",argv[0]); fprintf(stderr," topo.grd grd-file of predicted depth\n\n"); exit(-1); } /* read all the data */ nrec=0; while (fscanf(stdin,"%d %lf %lf %d %d %d %d %d",&num,&lon,&lat,&idepth,&sigh,&sigd,&id,&pred) != EOF) { nrec++; /* get the interpolated depth */ interp_topo(argv[1],&lon,&lat,&pd); pred = floor(pd+.5); printf("%d %.5f %.5f %d %d %d %d %d \n",num,lon,lat,idepth,sigh,sigd,id,pred); } }