/************************************************************************************ * * * Program - rd_ax_flt#_01s.c * * * * AUTHOR: Mandira Mukherjee * * * * Date: 10/21/94 * * * * PURPOSE/DESCRIPTION: The purpose of the program is to read the one second * * FIRE_ASTEX_NAT "ax_flt11_01s_ddmmyy" data file. * * Measurement of cloud radiative properties,remote sensing with * * LIDAR , and coordination with ER-2 and C-131 with NOAA-12. * * Flight involved two orthogonal axes 60nm long at 15,000.00ft * * centered at 35.40N 23.00W. In the ARAT datafile ONE SECOND * * there are 24 parameters. The program will request for the * * desired number of parameters and print it to the screen. * * * * The FOKKER F27 (ARAT) with flux measurement package and the * * airborne Lidar Leandre is used during ASTEX. The FOKKER 27 * * ARAT capabilities are the following: * * . Turbulence measurements of wind, temperature and moistu-* * re. Fast response sensors are located on a nose boom 5m * * long, on which are measured : * * -attack and sideslip angles by mobile vanes and by a * * five hole probe(Rosemound 858). * * -true airspeed by a Pitot probe * * - temperature by a fast response "INSU" probe * * - humidity by a Lyman-alpha humidity meter * * . Mean state sensors * * -Rosemount temperature probe * * -Reverse-flow temperature probe * * -General Eastern dew point sensor * * . Aerosols and cloud microphysics: * * -1-D drop size measurements from 0-6000 microns by * * four Knollenberg sensors * * -2-D sensor OAP 2DC for drop sizes between 25 and 800* * microns. * * . Liquid water content * * .Radiative measurements, up- and downward * * .Chemical measurements(isokinetic veins) * * .Upward or downward pointing lidar * * * ************************************************************************************/ #include #include #include #include #include #include #include #define RECSIZE 80 #define PARAMS 24 main (argc,argv) int argc; char *argv[]; { void Print_heading(); /* prints the heading of the data set */ int Get_par_type(); /* displays the choice of parameters */ int Get_rec_hd_type(); /* prints the requested header */ char filename1[MAXPATHLEN+1]; /* name of the file as first argv */ char buf[256],star[4]; /* buffer to read strings at a time */ char par_type[10],tmp[10], /* storage of requested parameter */ st[12],dot,st2[12], st3[12],st4[12],arat[12],line[50]; /* variables stored in strings */ FILE *fptr; /* file pointer */ int n,i,i1,rec_count,count, /* counter */ param[PARAMS], /* array of requested parameters */ day,hour,num,iln; double col1,col2,col3,col4,col5,col7,col8,col9,col10,col11, col13,col14,col15,col16,col17,col19,col20,col21,col22, col23,col24; /* variables column 1 thru 24 */ /*********************************************************************************/ void Print_heading(); for (count = 0;count < PARAMS; count++) { param[count] = -99; } (void) Print_heading(); if (argc == 1) { printf("Please enter the datafile name: "); scanf("%s",filename1); } else { strcpy (filename1,argv[1]); } printf ("\n\n"); printf("The datafile to be read is %s \n", filename1); Get_par_type(tmp,par_type,count,param); Get_rec_hd_type(tmp,par_type,count,param); /****************************************************************************/ if ((fptr = fopen(filename1,"r"))==NULL) { printf("***************************************************\n"); printf("ERROR-UNABLE TO OPEN DATA FILE. PROGRAM HAS TERMINATED\n"); printf("******************************************************\n"); exit(-1); } fgets(buf,120,fptr); printf("%s\n",buf); sscanf(buf,"%s %s",line,arat); if (arat[0] == 'A') /* reads in the symbol for ARAT F27 FILES */ { iln = 51; } else if(arat[0] == 'F') /* reads in the symbol for FICHIER MOYEN */ { iln = 43; } rec_count = 0; for (i = 0; i< iln;i++) { fgets(buf,120,fptr); /* printf("%s\n",buf);*/ } while ((feof(fptr)) ==0) /*for (n =0;n<11536;n++)*/ { col1 =0.0; col7 = 0.0; col14 = 0.0; col21 = 0.0; col2 = 0.0; col8 = 0.0; col15 = 0.0; col22 = 0.0; col3 = 0.0; col9 = 0.0; col16 = 0.0; col23 = 0.0; col4 = 0.0; col10= 0.0; col17 = 0.0; col24 =0.0; col5 = 0.0; col11= 0.0; col19 = 0.0; col13 = 0.0; col20 = 0.0; fgets(buf,120,fptr); /*printf("%s\n",buf);*/ sscanf(buf,"%2s%d",star,&num); for (i1 = 0; i1<13;i1++) { /*begin for loop*/ fgets(buf,80,fptr); if(i1== 1) { /*begin first scan*/ sscanf(buf,"%lf%c%lf%c%lf%c%lf%c%lf%c%s%s",&col1,&dot,&col2,&dot,&col3,&dot,&col4,&dot,&col5,&dot,st2,st); } /*end of first scan*/ else if (i1==4) { /*begin second scan*/ sscanf(buf,"%lf%c%lf%c%lf%c%lf%c%lf%c%s%s",&col7,&dot,&col8,&dot,&col9,&dot,&col10,&dot,&col11,&dot,st3,st); } /* end of second scan */ else if (i1 == 7) { /* begin third scan */ sscanf(buf,"%lf%c%lf%c%lf%c%lf%c%lf%c%s%s",&col13,&dot,&col14,&dot,&col15,&dot,&col16,&dot,&col17,&dot,st4,st); } /*end of third scan*/ else if (i1 == 10) { /* begin fourth scan*/ sscanf(buf,"%lf%c%lf%c%lf%c%lf%c%lf%c%lf%c%s",&col19,&dot,&col20,&dot,&col21,&dot,&col22,&dot,&col23,&dot,&col24,&dot,st); } /* end of fourth scan*/ } /* end of 13 for loops*/ printf("\n"); if ((feof(fptr)!=0)||(num != rec_count)) { printf("\n\n\n"); printf("----------------------------------------------------\n"); printf("*THE END OF FILE HAS BEEN REACHED........ \n"); printf(" THIS IS A NORMAL TERMINATION........... \n"); printf(" THE TOTAL NUMBER OF RECORDS: %d\n", rec_count); printf("-----------------------------------------------------\n"); exit(0); } ++rec_count; for ( count = 1; count <= PARAMS; count++) { switch (param[count -1]) { case 0: printf("%4.1lf ",col1); break; case 1: printf ("%4.3lf ",col2); break; case 2: printf ("%4.6lf ",col3); break; case 3: printf ("%3.4lf ", col4); break; case 4: printf ("%3.3lf ",col5); break; case 5: printf (" %s ",st2); break; case 6: printf ("%3.2lf ",col7); break; case 7: printf("%3.4lf ",col8); break; case 8: printf ("%3.4lf ",col9); break; case 9: printf ("%3.5lf ",col10); break; case 10: printf ("%3.5lf ", col11); break; case 11: printf ("%s ",st3); break; case 12: printf ("%2.2lf ",col13); break; case 13: printf ("%2.2lf ",col14); break; case 14: printf ("%3.6lf ",col15); break; case 15: printf ("%3.3lf ", col16); break; case 16: printf ("%3.3lf ",col17); break; case 17: printf (" %s ",st4); break; case 18: printf ("%2.2lf ",col19); break; case 19: printf ("%3.4lf ",col20); break; case 20: printf ("%3.4lf ", col21); break; case 21: printf ("%3.6lf ",col22); break; case 22: printf ("%.2lf ",col23); break; case 23: printf ("%3.3lf ",col24); break; } /*End of Switch */ } /*End of for */ printf ("\n"); } /* End of while */ fclose(fptr); } /* End of main */ /******************************************************************************** * * * FILE: Print_heading * * * * AUTHOR: Mandira Mukherjee * * * * PURPOSE/DESCRIPTION: Prints the heading for the FIRE_ASTEX_SOFIA_01S program. * * * * INVOCATION: * * (void) Print_heading() * * * * INTERNAL ROUTINES: * * NONE. * * * * EXTERNAL ROUTINES: * * NONE * * * *********************************************************************************/ void Print_heading() { printf("\n\n"); printf("***********************************************************\n"); printf("* *\n"); printf("* FIRE_ASTEX_SOFIA_01s_ARAT_FLIGHT *\n"); printf("* Read Program *\n"); printf("* *\n"); printf("* Version 1.00 September 30, 1994 *\n"); printf("* *\n"); printf("***********************************************************\n"); printf("\n"); } /* End of Printing */ /********************************************************************************* * * * FILE: Get_par_type * * * * AUTHOR: Mandira Mukherjee. * * * * PURPOSE/DESCRIPTION: * * There are 24 parameters of information collected at * * each event. They are: * * Static Pressure, Static Temperature, Dew Point Temperature* * Water Vapor, Relative Humidity, Liquid Water Content, * * Surface Temperature, Upward Radiance, Downward Radiance, * * Aircraft Roll, Aircraft Pitch, Aircraft heading, Wind * * Velocity, Wind Direction, Simple W, Latitude INS, Longitude* * INS, Pressure Altitude, Radar Altimeter Altitude, Particle* * Scattering Nephlometer, Time Fractional. * * INVOCATION: * * (void) Get_par_type * * * * INTERNALROUTINES: * * NONE: * *********************************************************************************/ int Get_par_type(tmp,par_type,count,param) int count,param[PARAMS]; char *par_type,*tmp; { char par[15]; /* Temp var to store type */ int pe; printf("\n"); printf("There are five parameters of information that was \n"); printf("collected at each event. These parameters are: \n"); printf("\n"); printf(" NO. Parameter Units \n"); printf(" ----- ----------- ----- \n"); printf(" 1. Static Pressure hPa \n"); printf(" 2. Static Temperature C \n"); printf(" 3. Dew Point Temperatuer C \n"); printf(" 4. Water Vapor Mixing Ratio g/kg \n"); printf(" 5. Relative Humidity percent \n"); printf(" 6. Liquid Water Content g/kg \n"); printf(" 7. Surface Temperature C \n"); printf(" 8. Upward Radiance W/m^2-sr \n"); printf(" 9. Downward Radiance W/m^2-sr \n"); printf(" 10. Aircraft Roll deg \n"); printf(" 11. Aircraft Pitch deg \n"); printf(" 12. Aircraft Heading deg \n"); printf(" 13. Wind Velocity m/s \n"); printf(" 14. Wind Direction deg \n"); printf(" 15. Simple W m/s \n"); printf(" 16. Latitude INS deg \n"); printf(" 17. Longitude INS deg \n"); printf(" 18. Reserved (Blank) \n"); printf(" 19. Pressure Altitude m \n"); printf(" 20. Radar Altimeter Altitude m \n"); printf(" 21. Radar Altimeter Altitude m \n"); printf(" 22. Part. Scattering Neph. 1/m \n"); printf(" 23. Reserved (Blank) \n"); printf(" 24. Time h \n"); printf("\n\n"); /* SELECT PARAMETERS */ par_type[0]= 'q'; while ((par_type[0]!='a') && (par_type[0] != 'A') && (par_type[0] != 's') && (par_type[0]!= 'S') && (par_type[0] != 'X') && (par_type[0] != 'x')) { printf(" Please indicate the number of parameters to be printed \n"); printf(" Please select: a or A for ALL parameters\n"); printf(" S or s for some and X or x to exit the program\n\n\n"); scanf("%s",par_type); strcpy(tmp,par_type); } if ((strcmp(par_type,"a")== 0) || (strcmp(par_type,"A")== 0)) { for (count =0; count <= PARAMS; count++) param[count]= count; } else if ((strcmp(par_type, "s")== 0) || (strcmp(par_type,"S")== 0)) { printf ("**********Parameters selection Requested*************\n"); for (count =1; count <= PARAMS;count++) { printf("Enter q to end selection or X to exit program\n"); printf("Please enter parameter #%d-------->",count); scanf("%s",par_type); printf("%s\n",par_type); strcpy(tmp,par_type); if ((strcmp(par_type,"X")==0) || (strcmp(par_type,"x")== 0)) { printf ("\n\n"); printf("*******EXIT PROGRAM***********\n"); exit(-1); } if (((strcmp(par_type,"q")== 0) || (strcmp(par_type,"Q")== 0))&& (count == 1)) { printf("\n\n"); printf("*****************NO PARAMETER SELECTED*************\n"); printf("*****************EXIT PROGRAM**********************\n"); exit(-1); } if ((strcmp(par_type,"q")== 0) || (strcmp(par_type,"Q")== 0)) { break; } if ((atoi(tmp) > PARAMS) || (atoi(tmp) <= 0)) { printf("\n"); printf(" THE TOTAL PARAMETERS AVAILABLE ARE 1 THRU 24\n"); printf(" THE REQUESTED PARAMETER IS OUT OF RANGE\n"); strcpy(tmp," "); } pe = atoi(par_type); param[count-1]= pe -1; } /*end of for statement */ } /* end of else if */ else if ((strcmp(par_type,"x")== 0) || (strcmp(par_type,"X")== 0)) { printf ("\n\n"); printf("****************EXIT PROGAM*****************\n"); exit(0); } } /* end of the get_type function */ /********************************************************************************* * FILE: Get_rec_hd_type * * * * AUTHOR: Mandira Mukherjee. * * * * PURPOSE/DESCRIPTION: * * There are 24 parameters of information collected at * * each event. They are: * * Static Pressure, Static Temperature, Dew Point Temperature* * Water Vapor, Relative Humidity, Liquid Water Content, * * Surface Temperature, Upward Radiance, Downward Radiance, * * Aircraft Roll, Aircraft Pitch, Aircraft heading, Wind * * Velocity, Wind Direction, Simple W, Latitude INS, Longitude* * INS, Pressure Altitude, Radar Altimeter Altitude, Particle* * Scattering Nephlometer, Time Fractional. * * INVOCATION: * * (void) Get_rec_hd_type * * * * INTERNALROUTINES: * * NONE: * *********************************************************************************/ int Get_rec_hd_type(tmp,par_type,count,param) int count,param[PARAMS]; char *par_type,*tmp; { count = 0; for ( count = 1; count <= PARAMS; count++) { switch (param[count -1]) { case 0: printf("Pressure "); break; case 1: printf("Temp.Stat "); break; case 2: printf("Pt. Rose "); break; case 3: printf("Rap.mlang "); break; case 4: printf("Hum.relat. "); break; case 5: printf("Eau liquide "); break; case 6: printf("Temp. Surf. "); break; case 7: printf("Radiance^ "); break; case 8: printf("Radiancev "); break; case 9: printf("Roulis "); break; case 10: printf("Tangage "); break; case 11: printf("Cap "); break; case 12: printf("Mod.VentI "); break; case 13: printf("Dir.VentI "); break; case 14: printf("W simple "); break; case 15: printf("Lat.INS "); break; case 16: printf("Lon.INS "); break; case 17: printf("Res.Blank "); break; case 18: printf("Alt.Pres. "); break; case 19: printf("Radio Alti1 "); break; case 20: printf("Radio Alti2 "); break; case 21: printf("Nphlo "); break; case 22: printf("Res.Blank "); break; case 23: printf("Heure dci. "); break; default: break; } /* End of Switch */ } /* End of for */ } /* End of Get_rec_hd_type function */ /******************************************************************************************/