/////////////////////////////////////////////////////////////////////////////////////////////// ///////DIMM観測結果のファイルから0.10秒刻みのシーイングの頻度を返すプログラム ///////// ///////元データ(例:seeing.001)をDIMMZ.cppで解析して作ったファイル(例:seeing.001zc)を ///////// ///////このプログラムで解析してください。 ///////// ///////東北大学大学院理学研究科天文学専攻修士1年 沖田博文 ///////// ///////E-mail: h-okita@astr.tohoku.ac.jp Last Update:2008/10/06 ///////// /////////////////////////////////////////////////////////////////////////////////////////////// #include #include #define pi 3.14159265 //円周率 int main(void) { //////////以下の情報を入力///////////////////////////////////////////////////////////////////// char file[100]="seeing.001zc" ; //処理するファイル名 char city[100]="東北大学理学部物理A棟(宮城県仙台市)" ; //観測地 #define N 12433 //ループの回数(処理するファイルの行数) //////////////////////////////////////////////////////////////////////////////////////////////// int n ; FILE *fi ; int nn=0 ; int hist[101] ; float tom=N ; for( nn=0; nn<=100; nn=nn+1){ hist[nn]=0 ; } fi=fopen(file, "r") ; //処理するファイル名 if(fi == NULL){ printf("No File. \n") ; } else{ for(n=1; n<=N; n=n+1){ float Z=0.0, Time=0.0, Vla=0.0, Vta=0.0, Hla=0.0, Hta=0.0, Vlo=0.0, Vto=0.0, Hlo=0.0, Hto=0.0 ; float Vle=0.0, Vte=0.0, Hle=0.0, Hte=0.0, Ave=0.0 ; //ファイルの読み込み // Z TimeVla Vta Hla Hta Vlo Vto Hlo Hto Vle Vte Hle Hte Ave fscanf(fi,"%8f %9f %8f %8f %8f %8f %8f %8f %8f %8f %8f %8f %8f %8f %8f\n", &Z, &Time, &Vla, &Vta, &Hla, &Hta, &Vlo, &Vto, &Hlo, &Hto, &Vle, &Vte, &Hle, &Hte, &Ave ) ; //0.1秒角刻みでAveの値の頻度をカウント for( nn=0; nn<=100; nn=nn+1 ){ if( nn/10.0 <= Ave ){ if( Ave < (nn+1)/10.0 ){ hist[nn] = hist[nn]+1 ; } } } } fclose(fi) ; printf("seeing number frequence\n") ; printf("# ---------------------------------------------------------------------------\n") ; for( nn=0; nn<=100; nn=nn+1 ){ printf("%f %d %f\n", nn/10.0, hist[nn], hist[nn]/tom ) ; } } return 0 ; }