#include #include #include #include #define MAXBUF 81 main (argc,argv) int argc; char *argv[]; { char filename[15]; char id[4],sp[5]; char t2[5],title[6],mon[3],day[3],hr[3],t3[6]; char temp[MAXBUF],t4[5]; char loni[7],lonf[6],dlon[5],lati[6],latf[6],dlat[5]; char nlon[3],nlat[3]; float longit[82],latit[50]; float data[82][50]; char test[14]; float holdit[3970]; int rec,i,j,k,l,kk,m; FILE *f1; /* the latitude and longitude range is from 85W to 10E, 70N to 15N at surface pressure SP represents Surface pressure in Pascals and ST is the Sea Surface Temperature in degrees Kelvin */ banner(argc); if (argc ==1) { printf("\nPlease enter in the input file name\n\n"); scanf("%s",filename);} else strcpy(filename,argv[1]); if((f1 = fopen(filename,"r")) == NULL) { printf("Can't open the input file\n"); exit(1); } fscanf(f1,"%s%s%s%s%s%s%s%s%s%s",title,t2,mon,day,hr,t3,t3,id,t3,sp); printf("Month is %s day %s hour %s ",mon,day,hr); printf("and the surface pressure is %s Pascal.\n",sp); fscanf(f1,"%s%s%s%s%s%s%s%s",t4,t4,t4,t4,t4,t4,t4,t4); fscanf(f1,"%7s%7s%7s%7s%7s%7s%7s%7s", loni,lonf,dlon,nlon,lati,latf,dlat,nlat); if (atoi(lonf) == 355.00) strcpy(lonf,"5.00"); printf("Initial longitude = %s and the final longitude = %s.\n\n\n", loni,lonf); printf("The longitude delta is %s and the number of longitude positions are %s.\n\n",dlon,nlon); printf("Initial latitude = %s and the final latitude = %s with a delta of %s\n",lati,latf,dlat); printf("providing %s latitude postions.\n",nlat); /* The remaining data is a sweep of latitude numbers per longitude position */ longit[0] = atof(loni); latit[0] = atof(lati); fgets(&temp[0],MAXBUF,f1); /* get all of the data from the file and store in array holdit */ m = 0; while (feof(f1) ==0) { fgets(&temp[0],MAXBUF,f1); kk =1; for (l=0;l<6;l++) { strncpy(test,&temp[kk],13); holdit[m] = atof(test); kk=kk+13; m++; } } /* break the holdit array up into data sections and display */ m=0; for (i=0;i