00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <stdio.h>
00022
00023 #include <math.h>
00024 #include <string.h>
00025 #include <unistd.h>
00026
00027 #include <utils/utils.h>
00028 #include <sed/sed_sedflux.h>
00029
00030
00031 char *help_msg[] =
00032 {
00033 " ",
00034 " sed2binary [options] [parameters] [filein] ",
00035 " convert a sedflux property output file into flat binary format. ",
00036 " ",
00037 " Options ",
00038 " -v - be verbose. [off] ",
00039 " -h - print this help message. ",
00040 " -hfile - print a help message on the file formats. ",
00041 " ",
00042 NULL
00043 };
00044
00045 #define FORGET_THIS_FOR_NOW
00046
00047 int main(int argc, char *argv[])
00048 {
00049 #if !defined( FORGET_THIS_FOR_NOW )
00050 Sed_file *fpin;
00051 FILE *fpout;
00052 char *infile, *outfile;
00053 char *verbose;
00054 Profile_header *hdr;
00055 double **data;
00056 Eh_args *args;
00057
00058 args = eh_opts_init(argc,argv);
00059 if ( eh_check_opts( args , NULL , NULL , NULL )!=0 )
00060 eh_exit(-1);
00061
00062 infile = eh_get_opt_str( args , "in" , NULL );
00063 outfile = eh_get_opt_str( args , "out" , NULL );
00064 verbose = eh_get_opt_str( args , "verbose" , "no" );
00065
00066 fpin = sed_open_sedflux_file_r( infile , NULL );
00067 sed_read_sedflux_profile( fpin );
00068 hdr = sed_get_sedflux_file_header( fpin );
00069
00070 if ( !outfile )
00071 fpout = stdout;
00072 else
00073 if ( !(fpout=fopen(outfile,"w")) )
00074 perror(outfile), eh_exit(-1);
00075
00076 if ( g_strcasecmp( verbose , "yes" )==0 )
00077 {
00078 eh_open_log(NULL);
00079 eh_print_log(DEFAULT_ERROR_LOG,"number of rows : %d",hdr->n_rows);
00080 eh_print_log(DEFAULT_ERROR_LOG,"number of columns : %d",hdr->n_cols);
00081 }
00082
00083 data = sed_get_sedflux_file_data( fpin );
00084
00085 fwrite( data[0] , sizeof(double) , hdr->n_rows*hdr->n_cols , fpout );
00086
00087 g_free(infile);
00088 g_free(outfile);
00089
00090 sed_close_sedflux_file( fpin );
00091 fclose(fpout);
00092 #endif
00093
00094 return 0;
00095 }
00096
00097 #undef FORGET_THIS_FOR_NOW
00098