#include "type_hyd.h" #include "var.h" int main(int argc, char *argv[]){ short int inval, i; float min_lo_a, max_hi_a, min_lo_b, max_hi_b; float mid_a, mid_b, active_a, active_b; float ar_mid_a, ar_mid_b, ar_scal_a, ar_scal_b; static hyd_header hyd; TimeList *Tl=NULL; TimeDate td; /* declarations for user part */ long int first=1, day_int, prev_int, int_sec, a, b; float step, d[200], r_rate=0; double n[200]; ident(); if (argc<2){ printf("please enter name of file to be typed in command line !\n"); exit(0); } /* open files */ file_hnd(argv); /*** read *.hd file ***/ Get_Fmt(); rewind(hyd_fil); printf("\nP R I N T O U T O F %s \n",argv[1]); printf("\n"); while(!GetHyd(&hyd,1)){ /* discard 'mismatches', not considered by VIEW_HYD */ if ( (hyd.eq_diameter<=0.) || (hyd.eq_diameter>50.) ) continue; if ( (hyd.velocity<0.) || (hyd.velocity>30.) ) continue; if ( (hyd.obl<0.) || (hyd.obl>2.) ) continue; /* discard edge events, not considered by VIEW_HYD either */ if ((hyd.min_a<=hyd.mh->gate1)||(hyd.max_a>=hyd.mh->gate2)) continue; if ((hyd.min_b<=hyd.mh->gate1)||(hyd.max_b>=hyd.mh->gate2)) continue; /* calculate area for normalisation: min_lo_a, max_hi_a, min_lo_b, max_hi_b are given limits of measurement area, determined while recording time of data. However, the user may be interested in only a portion of the available measurement area. The user may define the limits use_lo_a, use_hi_a, use_lo_b, use_hi_b. In this program this is done via the TYPE_HYD.SET file */ mid_a = (hyd.min_a + hyd.max_a)/2.f; mid_b = (hyd.min_b + hyd.max_b)/2.f; if ((mid_ause_hi_a)|| (mid_buse_hi_b)) continue; min_lo_a=(float)(oeu.g1+1)+0.5*(float)(hyd.max_a-hyd.min_a); min_lo_b=(float)(oeu.g1+1)+0.5*(float)(hyd.max_b-hyd.min_b); max_hi_a=(float)(oeu.g2-1)-0.5*(float)(hyd.max_a-hyd.min_a); max_hi_b=(float)(oeu.g2-1)-0.5*(float)(hyd.max_b-hyd.min_b); active_a=minf(max_hi_a,(float)use_hi_a)-maxf(min_lo_a,(float)use_lo_a)+1.; active_b=minf(max_hi_b,(float)use_hi_b)-maxf(min_lo_b,(float)use_lo_b)+1.; ar_mid_a=(minf(max_hi_a,(float)use_hi_a)+maxf(min_lo_a,(float)use_lo_a))/2.; ar_mid_b=(minf(max_hi_b,(float)use_hi_b)+maxf(min_lo_b,(float)use_lo_b))/2.; ar_scal_a= oeu.xscale0_1*(oeu.l0_1 - oeu.xscale0_2*(ar_mid_b-255.5))/oeu.l0_1; ar_scal_b= oeu.xscale0_2*(oeu.l0_2 + oeu.xscale0_1*(ar_mid_a-255.5))/oeu.l0_2; hyd.n_area=(float)(active_a * ar_scal_a * active_b * ar_scal_b); /* convert line scan number to 'normal' day time */ GetDayTime(hyd.lin_day,&td); // /* please insert user routines here to process the data of // one single hydrometeor, e.g. print it to the screen: */ // // printf("\nNUMERIC INFO ON SINGLE HYDROMETEOR: \n"); // printf("time = %02d:%02d:%02d.%03d \n", // td.hour,td.min,td.sec,td.msec); // printf("equivolumetric diameter = %8.3f mm \n",hyd.eq_diameter); // printf("volume = %8.3f mm3 \n",hyd.volume); // printf("vertical fall velocity = %8.3f m/s \n",hyd.velocity); // printf("oblateness = %8.6f \n",hyd.obl); // printf("area for normalisation = %8.3f mm*mm \n",hyd.n_area); // printf("height of one line = %8.6f mm \n",hyd.y_scale); // printf("type = %s \n",&typtxt[hyd.type][0]); // // printf("\n FRONT (A) SIDE (B) \n"); // printf("height %12.3f %12.3f mm\n",hyd.height_a,hyd.height_b); // printf("longest line %12.3f %12.3f mm\n",hyd.width_a,hyd.width_b); // printf("oblateness %12.3f %12.3f \n",hyd.obl_a,hyd.obl_b); // printf("number of lines%12d %12d\n",hyd.lines_a,hyd.lines_b); // printf("pixelwidth %12.6f %12.6f mm\n",hyd.x_scale_a,hyd.x_scale_b); // if (getch()==27) exit(0); // // printf("\n"); // printf("Pixels in camera A, start at bottom(=line 000)\n"); // for (i=0;i %02ld:%02ld:%02ld", a/3600,(a/60)%60,(a%3600)%60,b/3600,(b/60)%60,(b%3600)%60); printf(" %5.2f ->%5.2f mm n=%12.7f /m3mm \n", d[i]-step/2.,d[i]+step/2.,1.e6*n[i]/step/int_sec); n[i]=0; } printf("rainrate =%lf \n",(3600.*r_rate/int_sec)); r_rate=0; } prev_int=day_int; if (getch()==27) exit(0); } i=0; while( hyd.eq_diameter >= ((i+1)*step) ) i++; if (i<200) n[i] += 1. / (hyd.n_area * hyd.velocity); else printf(" out of class range: d=%f mm \n",hyd.eq_diameter); r_rate+=hyd.volume/hyd.n_area; /* end of user routines */ if (fsetpos(hyd_fil,&hyd.succ)){ printf("Could not set hyd.succ = %ld \n",hyd.succ); perror("");exit(0); } } printf("\n END OF FILE ENCOUNTERED \n"); } float minf(float a, float b){ float res; res=a; if (bres) res=b; return(res); }