#!/usr/bin/perl -w
#use strict;
# liste les donnees des manips DUO
my $D_version = "10-10-2013";
#################################################################
print ("\n  lit_plaques.pl   F_TAJAHMADY   version du $D_version \n ");
#################################################################
my $nb_param = @ARGV;
if ($nb_param != 2) {
    print ("\n LANCER : lit_plaques.pl FICHIER_plaques  FICHIER_out \n");  
    print (" FICHIER_plaques : nom du fichier des donnees plaques \n");
    print (" FICHIER_out : nom du fichier des donnees formatees \n");
    exit(1);
   }
my $FICH_in = $ARGV[0];
print (" FICHIER_plaques : $FICH_in \n");
my $FICH_out = $ARGV[1];
# ouverture du fichier FICHIER_plaques en lecture
open (F_in,"< $FICH_in") || die " Impossible ouvrir $FICH_in";
# ouverture du fichier FICHIER_out en ecriture
open (F_out,"> $FICH_out") || die " Impossible ouvrir $FICH_out";
print (" fichier plaques en lecture : $FICH_in \n");
print (" fichier plaques en ecriture : $FICH_out \n");

# lire le fichier des plaques
$nb_plaques_trait = 0;
while ($l_plaque = <F_in>) {
  chop ($l_plaque);
  @D = split /;/, $l_plaque;
  $champ = $D[0];
  $manip = $D[1];
  $plate = $D[2];
  $object = $D[3];
  $exposure = $D[4];
  $emulsion = $D[5];
  $plateholder= $D[6];
  $development = $D[7];
  $observer = $D[8];
  $date = $D[9];
  $RA = $D[10];
  $DEC = $D[11];
  $ST_start = $D[12];
  $ST_start_UT = $D[13];
  $ST_end = $D[14];
  $ST_end_UT = $D[15];
  $filter = $D[16];
  $F = $D[17];
  $POS = $D[18];
  $seeing = $D[19];
  $remarks = $D[20];
  $scientist = $D[21];
   
  $nb_plaques_trait++;



print (" CHAMP =  $champ     MANIP = $manip  \n");
printf F_out (" CHAMP =  $champ     MANIP = $manip  \n");

print (" Plate No. = $plate 	DATE = $date \n");
printf F_out (" Plate No. = $plate 	DATE = $date \n");

print (" Object = $object	R.A. = $RA \n");
printf F_out (" Object = $object	R.A. = $RA \n");

print ("		        Dec. = $DEC \n");
printf F_out ("		             Dec. = $DEC \n");

print (" Exposure = $exposure   S.T. Start = $ST_start  // UT = $ST_start_UT \n");
printf F_out (" Exposure = $exposure   S.T. Start = $ST_start  // UT = $ST_start_UT \n");

print (" 			S.T. End = $ST_end  // UT = $ST_end_UT \n");
printf F_out (" 			S.T. End = $ST_end  // UT = $ST_end_UT \n");

print (" Emulsion = $emulsion	Filter = $filter \n");
printf F_out (" Emulsion = $emulsion	Filter = $filter \n");

print (" Plateholder = $plateholder	 F = $F \n");
printf F_out (" Plateholder = $plateholder	 F = $F \n");

print (" Development = $development	 Position of Telescope = $POS \n");
printf F_out (" Development = $development	 Position of Telescope = $POS \n");

print (" Observer = $observer 		 Seeing = $seeing \n");
printf F_out (" Observer = $observer 		 Seeing = $seeing \n");

print (" Remarks = $remarks \n");
printf F_out (" Remarks = $remarks \n");

print (" Scientist = $scientist \n\n\n");
printf F_out (" Scientist = $scientist \n\n\n");
}
print (" nb. de plaques traitees = $nb_plaques_trait \n");


