Ejemplo n.º 1
0
void SummaryComparator::printUnits(){
    std::vector<double> timeVec1, timeVec2;
    setTimeVecs(timeVec1, timeVec2);  // Sets the time vectors, they are equal for all keywords (WPOR:PROD01 etc)
    setDataSets(timeVec1, timeVec2);
    for (int jvar = 0; jvar < stringlist_get_size(keysLong); jvar++){
        std::cout << stringlist_iget(keysLong, jvar) << " unit: " << ecl_sum_get_unit(ecl_sum_fileShort, stringlist_iget(keysLong, jvar)) << std::endl;
    }
}
Ejemplo n.º 2
0
Archivo: ecl_sum.c Proyecto: flikka/ert
void ecl_sum_fmt_init_summary_x( const ecl_sum_type * ecl_sum , ecl_sum_fmt_type * fmt ) {
  fmt->locale     = NULL;
  fmt->sep        = "";
  fmt->date_fmt   = "%d/%m/%Y   ";
  fmt->value_fmt  = " %15.6g ";

  if (util_string_equal( ecl_sum_get_unit( ecl_sum , "TIME") , "DAYS"))
    fmt->days_fmt   = "%7.2f   ";
  else
    fmt->days_fmt   = "%7.4f   ";

  fmt->header_fmt = " %15s ";

  fmt->newline = "\n";
  fmt->print_header= true;
  fmt->print_dash = true;
  fmt->date_dash  = "-----------------------";
  fmt->value_dash = "-----------------";
  fmt->date_header= "-- Days   dd/mm/yyyy   ";
}
Ejemplo n.º 3
0
void output_save_S3Graph( const output_type * output, ensemble_type * ensemble , const double ** data ) {
  FILE * stream = util_mkdir_fopen( output->file , "w");
  const char * kw_fmt       = "\t%s";
  const char * unit_fmt     = "\t%s";
  const char * wgname_fmt   = "\t%s";
  const char * num_fmt      = "\t%d";
  const char * float_fmt    = "\t%0.4f";
  const char * days_fmt     = "\t%0.2f";

  const char * empty_fmt    = "\t";
  const char * date_fmt     = "%d/%d/%d";
  const char * time_header  = "DATE\tTIME";
  const char * time_unit    = "\tDAYS";
  const char * time_blank   = "\t";
  const int    data_columns = vector_get_size( output->keys );
  const int    data_rows    = time_t_vector_size( ensemble->interp_time );
  int row_nr,column_nr;

  {
    char       * origin;
    util_alloc_file_components( output->file , NULL ,&origin , NULL);
    fprintf(stream , "ORIGIN %s\n", origin );
    free( origin );
  }

  /* 1: Writing first header line with variables. */
  fprintf(stream , time_header );
  for (column_nr = 0; column_nr < data_columns; column_nr++) {
    const quant_key_type * qkey = vector_iget( output->keys , column_nr );
    print_var( stream , ecl_sum_get_keyword( ensemble->refcase , qkey->sum_key ) , qkey->quantile , kw_fmt);
  }
  fprintf(stream , "\n");

  /* 2: Writing second header line with units. */
  fprintf(stream , time_unit );
  for (column_nr = 0; column_nr < data_columns; column_nr++) {
    const quant_key_type * qkey = vector_iget( output->keys , column_nr );
    fprintf(stream , unit_fmt , ecl_sum_get_unit( ensemble->refcase , qkey->sum_key ) );
  }
  fprintf(stream , "\n");

  /*3: Writing third header line with WGNAMES / NUMS - extra information -
       breaks completely down with LGR information. */
  fprintf(stream , time_blank );
  {
    for (column_nr = 0; column_nr < data_columns; column_nr++) {
      const quant_key_type * qkey  = vector_iget( output->keys , column_nr );
      const char * ecl_key         = qkey->sum_key;
      const char * wgname          = ecl_sum_get_wgname( ensemble->refcase , ecl_key );
      int          num             = ecl_sum_get_num( ensemble->refcase , ecl_key );
      ecl_smspec_var_type var_type = ecl_sum_get_var_type( ensemble->refcase , ecl_key);
      bool need_num                = ecl_smspec_needs_num( var_type );
      bool need_wgname             = ecl_smspec_needs_wgname( var_type );

      if (need_num && need_wgname) {
        /** Do not know how to include both - will just create a
            mangled name as a combination. */
        char * wgname_num = util_alloc_sprintf("%s:%d" , wgname , num);
        fprintf(stream , wgname_fmt , wgname_num);
        free( wgname_num );
      } else if (need_num)
        fprintf(stream , num_fmt , num);
      else if (need_wgname)
        fprintf(stream , wgname_fmt , wgname);
      else
        fprintf(stream , empty_fmt );
    }
    fprintf(stream , "\n");
  }

  /*4: Writing the actual data. */
  for (row_nr = 0; row_nr < data_rows; row_nr++) {
    time_t interp_time = time_t_vector_iget( ensemble->interp_time , row_nr);
    {
      int mday,month,year;
      util_set_datetime_values(interp_time , NULL , NULL , NULL , &mday , &month , &year);
      fprintf(stream , date_fmt , mday , month , year);
    }
    fprintf(stream , days_fmt , 1.0*(interp_time - ensemble->start_time) / 86400);

    for (column_nr = 0; column_nr < data_columns; column_nr++) {
      fprintf(stream , float_fmt , data[row_nr][column_nr]);
    }
    fprintf( stream , "\n");
  }
}
Ejemplo n.º 4
0
//Called only when the keywords are equal in the getDeviations()-function
const char* SummaryComparator::getUnit(const char* keyword){
    return ecl_sum_get_unit(ecl_sum_fileShort, keyword);
}