/************************************************************************/ /* program to calculate the concentration from flux */ /* c = M * s M - response function m x n s - estimate of s. n x 1 m: # of stations n: # of regions */ /* Ref: Deng, F. et al, 2007. Global monthly CO2 flux inversion with focus over North America. Tellus, 59B: 179-190 */ /* Written by G. Mo June, 2012 */ /************************************************************************/ #include #include //#include #include #include int main() { /* set matrix size here */ int m=3066; int n=3001; /* ------------- */ double **M,*s,*c; float v0,v1,v3; int i,j,k; char in1_fn[80],in2_fn[80],outp_fn[180]; FILE *in1_ptr,*in2_ptr,*outp_ptr; M = (double **) malloc ((m+1)* sizeof(double)); for (i=0; i<=m; i++) M[i] = (double *) malloc ((n+1)* sizeof(double)); s = (double *) malloc (n* sizeof (double)); c = (double *) malloc (m* sizeof (double)); /*** ***/ printf("reading M matrix ...\n"); sprintf(in1_fn,"../response_73stn.bin"); if ((in1_ptr=fopen(in1_fn, "rb")) == NULL) { printf("\n Unable to open file1, exitting program ...\n\n"); exit(0); } for(i=0;i