#include <stdio.h> 
#include <string.h> 
int main(){

    /* declare variables */
    float precipRateESurface[3][3][3][72][28];
    FILE  *fp;
    int   i, j, k, m, n, size;
    float  lat,lon;

    /* binary file name */ 
    char inputfile[128] ="../data/GPM/DPR/GPMCOR_DPR_2603_M_L3S_D3M_08A.nc.precipRateESurface_mean";

    for(i=0; i<3; i++){
        for(j=0; j<3; j++){
            for(k=0; k<3; k++){
                for(m=0; m<72; m++){
                    for(n=0; n<28; n++){
                        precipRateESurface[i][j][k][m][n]=0;
                    }
                }
            }
        }
    }

    /* binary file open */
    fp = fopen(inputfile, "rb");
    if(fp == NULL ) {
        printf("error:file open error[%s] \n", inputfile);
    }
    else
    { 
        /* file read */
        size = fread(precipRateESurface, sizeof(precipRateESurface), 1, fp);
	    printf("read size=%d\n",size);

        /* precipRateESurface print */
	    printf("filename=%s\n",inputfile);
        lat = (140.0/28.0) * 14 - 70.0 + (140.0/28.0/2);
        lon = (360.0/72.0) * 63 - 180.0 + (360.0/72.0/2);
        printf("lat=%f, lon=%f\n",lat,lon);
        printf("precipRateESurface.mean[0][0][0][63][14]= %f \n", precipRateESurface[0][0][0][63][14]);
        printf("precipRateESurface.mean[0][1][0][63][14]= %f \n", precipRateESurface[0][1][0][63][14]);

        /* binary file close   */
        fclose(fp);
    }
    return 0;
}

