/* makecol.c read '*.mcl' file as follows: d:\slar\es115a.slr : image file name 0.013 : minimum pixel size 9195 4224 : rows and columns 512 : file header size 16 : row header 4 : row trailer 5 : number of latitude coefficients 60.198 : b[0] -- intercept 7.1776e-006 : b[1] -- y -1.8923e-010 : b[2] -- y*y -1.1064e-004 : b[3] -- x -1.2695e-010 : b[4] -- x*x 5 : number of longitude coefficients -133.18150 : b[0] -- intercept -1.0837e-005 : b[1] -- x -2.3141e-020 : b[2] -- x*x -2.2208e-004 : b[3] -- y -2.3462e-011 : b[4] -- y*y */ #include #include #include #include "getfile3.c" #define STR_LEN 100 #define MIN_DIM 25 int NumImage=5; struct dir { char id; float scale; int iscale; }D[5]= { {'\0', 1.0,1}, {'w', 3.0, 3}, {'x', 9.0, 9}, {'y',27.0,27}, {'z',81.0,81} }; main(argc,argv) int argc; char *argv[]; { int i,j,k; char string[100],path[100],name[100],type[100],outfile[100]; FILE *fpin,*fpout; float minpix,a[8],b[8]; int row,col,hdr,row_hdr,row_tlr; int nlat,nlon; if(get_file_name("*.mcl",string)<0) { printf("No '.mcl' files\n\n"); exit(0); } fpin=fopen(string,"rb"); if(!fpin) { printf("Could not open '%s'\n"); exit(0); } fpout=fopen("mcl.col","wt"); fprintf(fpout,"begin_vector\n"); fprintf(fpout,"begin_collage\n"); fprintf(fpout,"color_lut = d:\gloria\grey.lut\n"); fprintf(fpout,"assignment = d:\gloria\grey.asn\n"); fprintf(fpout,"missing = 0\n"); fprintf(fpout,"minimum_pixel = %f",minpix); fprintf(fpout,"begin_image\n"); fprintf(fpout, "---------------------------------------------------------------------\n"); fprintf(fpout, "name maxpix minpix row col hdr r_hdr r_tlr N a0 a1\n"); fprintf(fpout, "------------ ------ ------ ---- ---- --- ----- ----- - ------ ----------*\n"); for(;;) { if(fscanf(fpin,"%s",string)<1) break; split(string,path,name,type); printf("path = '%s' name = '%s' type = '%s'\n",path,name,type); fscanf(fpin,"%f",&minpix); printf(" minpix = %f\n",minpix); fscanf(fpin,"%d",&row); printf(" row = %d\n",row); fscanf(fpin,"%d",&col); printf(" col = %d\n",col); fscanf(fpin,"%d",&hdr); printf("file header = %d\n",hdr); fscanf(fpin,"%d",&row_hdr); printf(" row header = %d\n",row_hdr); fscanf(fpin,"%d",&row_tlr); printf("row trailer = %d\n",row_tlr); fscanf(fpin,"%d",&nlat); printf("nlat = %d\n",nlat); if(nlat<0&&nlat>7) exit(0); for(i=0;i7) exit(0); for(i=0;iSTR_LEN) { printf("In split() -- string 1 too long!\n\n"); exit(0); } for(i=0;i0) { for(i=0;i0) num+=1; if(strlen(type)>0) num+=1; return(num); }