/* Calc. R matrix with C13 obs. data per mil based on Deng's formular */ #include #include #include #include int main() { double c13ppm,unc; int s,yy,m,c; int vy,vm; float vco2,wv; float vc13sd[74][13],sg[74]; char ls_fn[80],x3_fn[98]; //,x2_fn[98] FILE *x3_ptr,*ls_ptr; //*x2_ptr, sprintf(ls_fn,"../c13uncrtn_R73permil.txt"); if ((ls_ptr=fopen(ls_fn, "w")) == NULL) { printf("\n Unable to open listing file, exitting program ...\n\n"); exit(0); } sprintf(x3_fn,"../c13stdev_obs73stn.txt"); if ((x3_ptr=fopen(x3_fn, "r")) == NULL) { printf("\n Unable to open stdev file, exitting program ...\n\n"); exit(0); } for (s=1;s<=73;s++) for (m=1;m<=12;m++) { fscanf(x3_ptr,"%d %f %f\n",&vm,&vc13sd[s][m],&sg[s]); } fclose(x3_ptr); printf("processing ... \n",s); for (s=1;s<=73;s++) { for (yy=1;yy<=5;yy++) // 5yr for (m=1;m<=12;m++) // 12mn { c=(yy-1)*12+m; /* calculating uncertainty of C13 ... the values of stdev of C13 from data are in unit of per mil. using the values * 2 for ppm to permil ( 8 per mil~= 4 ppm in air) using FengDeng's param. for co2 * 1% *2 as part2 */ unc=(vc13sd[s][m]*vc13sd[s][m])+sg[s]*sg[s]*0.011*0.011*2*2; wv=(float)(unc); if (c>18) fprintf(ls_ptr,"%f\n",wv); // fprintf(ls_ptr,"st-%d %d - %d\t %f %f %f\n",s,vy,vm,wv,vc13sd[s][m],sg[s]); } // end of yy /// fclose(x2_ptr); } // end of s fclose(ls_ptr); return 1; }