#include #include #include //#include #include int main() { double r=0.011237; // standard ratio of c13/c12 -- based on Pee Dee Belemnite double c13r1,c13r2,sm; int s,yy; int vy,vd; float vco2[66],vc13[66],wv; char ls_fn[80],x2_fn[98],x3_fn[98]; FILE *x2_ptr,*x3_ptr,*ls_ptr; sprintf(ls_fn,"../d_co2dt_73stn42m.txt"); if ((ls_ptr=fopen(ls_fn, "w")) == NULL) { printf("\n Unable to open listing file, exitting program ...\n\n"); exit(0); } printf("processing ... \n"); for (s=1;s<=73;s++) { sm=0; sprintf(x2_fn,"../co2c13obs/co2_msr_monthly_stn%d.txt",s); if ((x2_ptr=fopen(x2_fn, "r")) == NULL) { printf("\n Unable to open input2 file, exitting program ...\n\n"); exit(0); } // sprintf(x3_fn,"../data_co2c13obs/c13_msr_monthly_stn%d.txt",s); // if ((x3_ptr=fopen(x3_fn, "r")) == NULL) // { printf("\n Unable to open input3 file...\n\n"); // exit(0); // } for (yy=1;yy<=60;yy++) // 5yr x 12mn { fscanf(x2_ptr,"%d %d %f\n",&vy,&vd,&vco2[yy]); // fscanf(x3_ptr,"%d %d %f\n",&vy,&vd,&vc13[yy]); } for (yy=2;yy<=60;yy++) { wv=(float)(vco2[yy]-vco2[yy-1]); sm = sm +wv; // if (yy>18) fprintf(ls_ptr,"%d\t%d \t %f\n",s,yy,sm); if (yy>18) fprintf(ls_ptr,"%d\t%d \t %f\n",s,yy,wv); } fclose(x2_ptr); // fclose(x3_ptr); } // end of s // fprintf(ls_ptr,"avg: %f\n",sm/73); fclose(ls_ptr); return 1; }