/************************************************************************ *stxyze2cm reads a file in xyz format and convert to the NAVO * * NGA, NOAA, SIO common format * ************************************************************************/ /************************************************************************ * Creator: * * Date : * ************************************************************************/ /************************************************************************ * Modification History: * * Date : * * * ************************************************************************/ #include #include #include #include "../../include/gmt.h" main(int argc, char **argv) { double lat,lon,depth,sigd,pd; int time,idepth,pred,foot; int id,nrec,sigh,isigd; if(argc < 2){ fprintf(stderr,"usage: %s topo.grd < file.stxyze > file.cm\n\n",argv[0]); fprintf(stderr," topo.grd grd-file of predicted depth\n\n"); exit(-1); } sigh=0; /* read all the data */ nrec=0; while (fscanf(stdin,"%d %d %lf %lf %lf %lf",&id,&foot,&lon,&lat,&depth,&sigd) != EOF) { nrec++; /* prepare the data for output */ if(lon > 180.) lon = lon-360.; if(lon < -180.) lon = lon+360.; idepth=floor(1000*depth-6051877+.5); isigd=floor(1000*sigd+.5); /* get the interpolated depth */ interp_topo(argv[1],&lon,&lat,&pd); pred = floor(1000*pd+.5); printf("%d %.5f %.5f %d %d %d %d %d \n",foot,lon,lat,idepth,sigh,isigd,id,pred); } }