LOPES — A LOFAR Prototype Station

no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


browsedata [Y/m/d H:i] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== LOPES Data ======
 +~~NOCACHE~~
 +
 +
 +**[[http://www-ik.fzk.de/~lopesuser/|LOPES-30 DAQ Status]]**\\ Status of the LOPES data acquisition - including thunderstorm mode - at the KIT \\ //Password required//\\
 +**[[http://www-ik.fzk.de/~lopesuser/thunderstorm.html|LOPES Thunderstorm trigger]]**\\ Extra page to show present static electric field at KIT with indication of thunderstorm mode for the LOPES DAQ \\ //Password required//
 +
 +===== Data Browser =====
 +
 +<php>
 +  global $ldircont, $tdircont, $dynspecdir, $dynthmbdir, $skipintro, $ID;
 +  $dynspecdir = "/users/staf/anigl/public_html/lopes_daily_dynspec";
 +  $dynthmbdir = "/mnt/public/www/html/lopes/data/media/browsedata/dynspec/";
 +  $basedir    = "/var/www/html/lopes/";
 +
 +  function showitem($year, $month, $day) {
 +    global $ldircont, $tdircont, $dynspecdir, $dynthmbdir;
 +
 +    $monstr = date("ym", mktime(0,0,0,$month,1,$year));
 +    $daystr = date("ymd", mktime(0,0,0,$month,$day,$year));
 +    if (preg_match("/$monstr/", $daystr)) {
 +      $tfiles = preg_grep("/ds_($daystr)_/", $tdircont);
 +      $lfiles = preg_grep("/ds_($daystr)_/", $ldircont);
 +      $lfiles = preg_grep("/thumbs/", $lfiles, PREG_GREP_INVERT);
 +      echo '<table class="dynspec" cellspacing="0"><tr><td>';
 +      if (current($lfiles) && is_readable($dynspecdir."/".current($lfiles))) {
 + echo '<a href="/~anigl/lopes_daily_dynspec/'.current($lfiles).'">';
 + if (current($tfiles) && is_readable($dynthmbdir."/".current($tfiles))) {
 +   echo '<img style="width: 95px; height: 100px;"
 +      src="/lopes/lib/exe/fetch.php?media=browsedata:dynspec:'.current($tfiles).'" alt="Preview">';
 + } else {
 +          $base = preg_split("/\//", current($lfiles));
 +          $base = preg_split("/\./", end($base));
 +          exec("/usr/bin/convert -crop 798x894+260+168 ".$dynspecdir."/".current($lfiles)." ".$dynthmbdir."/".$base[0].".png", $return, $error);
 +          exec("/usr/bin/mogrify -resize 95x100 ".$dynthmbdir."/".$base[0].".png", $return, $error);
 +          if ($error > 0) {
 +     echo '<img style="width: 95px; height: 100px;" src="/lopes/lib/exe/fetch.php?media=browsedata:no-preview.png" alt="'.$error.'">';
 +          } else {
 +     echo '<img style="width: 95px; height: 100px;"
 +      src="/lopes/lib/exe/fetch.php?media=browsedata:dynspec:'.$base[0].'.png" alt="Preview">';
 +          }
 + }
 + echo '</a>';
 +      } else {
 + echo '<img style="width: 95px; height: 100px;" src="/lopes/lib/exe/fetch.php?media=browsedata:no-data.png" alt="No data">';
 +      }
 +      echo '</td></tr><tr><td>';
 +      echo date("Y-m-d", mktime(0, 0, 0, $month, $day, $year)).'</td></tr><tr><td style="height: 12px;"></td></tr></table>';
 +    }
 +  }
 +
 +  function showyear($year) {
 +    global $ldircont, $tdircont, $dynspecdir, $dynthmbdir, $ID;
 +
 +    if (mktime(0, 0, 0, 1, 1, $year) == -1) {
 +      genintro();
 +      return;
 +    }
 +    echo '<div class="bar-bottom" style="border-top: none;">';
 +    tpl_link(wl($ID),'Overview');
 +    tpl_link(wl($ID,'date='.date("Y", mktime(0,0,0,1,1,$year-1))),date("Y", mktime(0,0,0,1,1,$year-1)).' (Previous)');
 +    tpl_link(wl($ID,'date='.date("Y", mktime(0,0,0,1,1,$year+1))),date("Y", mktime(0,0,0,1,1,$year+1)).' (Next)');
 +    echo '</div>';
 +    echo '
 +      <h2>Dynamic spectra for '.$year.'</h2>
 +      <p>These are the dynamic spectra for '.$year.'.
 +    ';
 +    for ($month = 1; $month < 13; $month ++) {
 +      $cnt = 0;
 +      $monstr = date("ym", mktime(0,0,0,$month,1,$year));
 +      for ($day = 1; $day < 32; $day ++) {
 +        $daystr = date("ymd", mktime(0,0,0,$month,$day,$year));
 +        if (count(preg_grep("/ds_($daystr)_/", $ldircont)) > 0) {
 +          $cnt ++;
 +        }
 +      }
 +      echo '<p><table><tr><td style="width: 150px; padding: 0px; margin: 0px;">';
 +      tpl_link(wl($ID,'date='.date("Ym", mktime(0,0,0,$month,1,$year))),date("F", mktime(0,0,0,$month,1,$year)));
 +      echo '</a></td><td>('.$cnt.' spectra in archive)</td></tr></table></p>
 +      ';
 +    }
 +    echo '
 +     </p>
 +    ';
 +  }
 +
 +  function showmonth($mstr) {
 +    global $ldircont, $tdircont, $dynspecdir, $dynthmbdir, $skipintro, $ID;
 +
 +    preg_match("/(....)(..)/", $mstr, $date);
 +    if (! $skipintro && mktime(0, 0, 0, $date[2], 1, $date[1]) == -1) {
 +      genintro();
 +      return;
 +    }
 +    echo '<div class="bar-bottom" style="border-top: none;">';
 +    tpl_link(wl($ID,'date='.date("Y", mktime(0,0,0,1,1,$date[1]))),$date[1].' Overview');
 +    tpl_link(wl($ID,'date='.date("Ym", mktime(0,0,0,$date[2]-1,1,$date[1]))),date("F Y", mktime(0,0,0,$date[2]-1,1,$date[1])).' (Previous)');
 +    tpl_link(wl($ID,'date='.date("Ym", mktime(0,0,0,$date[2]+1,1,$date[1]))),date("F Y", mktime(0,0,0,$date[2]+1,1,$date[1])).' (Next)');
 +    echo '</div>';
 +    if (! $skipintro) echo '
 +      <h2>Dynamic spectra for '.date("F Y", mktime(0, 0, 0, $date[2], 1, $date[1])).'</h2>
 +      <p>
 +    ';
 +    for ($day = 1; $day < 32; $day ++) {
 +      showitem($date[1], $date[2], $day);
 +    } 
 +
 +    if (! $skipintro) echo '</p>';
 +
 +  }
 +
 +  function showday($dstr) {
 +    global $ldircont, $tdircont, $dynspecdir, $dynthmbdir, $ID;
 +
 +    preg_match("/(....)(..)(..)/", $dstr, $date);
 +    if (mktime(0, 0, 0, $date[2], $date[3], $date[1]) == -1) {
 +      genintro();
 +      return;
 +    }
 +    echo '<div class="bar-bottom" style="border-top: none;">';
 +    tpl_link(wl($ID,date("Ym", mktime(0,0,0,$date[2],1,$date[1]))),date("F Y", mktime(0,0,0,$date[2],1,$date[1])).' Overview');
 +    tpl_link(wl($ID,date("Ymd", mktime(0,0,0,$date[2],$date[3]-1,$date[1]))),date("Y-m-d", mktime(0,0,0,$date[2],$date[3]-1,$date[1])).' (Previous)');
 +    tpl_link(wl($ID,date("Ymd", mktime(0,0,0,$date[2],$date[3]+1,$date[1]))),date("Y-m-d", mktime(0,0,0,$date[2],$date[3]+1,$date[1])).' (Next)');
 +    echo '</div>';
 +    echo '
 +      <h2>Dynamic spectrum for '.date("j F Y", mktime(0, 0, 0, $date[2], $date[3], $date[1])).'</h2>
 +      <p>
 +    ';
 +
 + }
 +
 +  function genintro() {
 +    global $skipintro, $navbar, $ID;
 +
 +    echo '
 +      <p>
 +      From every Cosmic Ray event file generated in LOPES, a total frequency spectrum is generated
 +      as well. Every night, the spectra from one day are packed together into a <em>dynamic
 +      spectrum</em>, which provides useful information on external circumstances like Solar bursts,
 +      man-made interference sources, and hardware defects.
 +      </p><p>';
 +    tpl_link(wl($ID.':dynamic_spectra'),"Learn more about dynamic spectra...");
 +    echo '</p>
 +      <h2>Recent data</h2>
 +      <p>
 +    ';
 +    for ($day = 15; $day > 1; $day --) {
 +      $time = mktime(0,0,0,date("m"),date("d")-$day,date("Y"));
 +      showitem(date("Y", $time), date("m", $time), date("d", $time));
 +    }
 +    echo '</p>';
 +
 +    $skipintro = true;
 +    echo '
 +      <h2>Browse Archive</h2>
 +      <p><ul><li>';
 +      tpl_link(wl($ID,'date='.date("Y")),date("Y").' Data');
 +    echo "</li><li>\n";
 +      tpl_link(wl($ID,'date='.(date("Y")-1)),(date("Y")-1).' Data');
 +    echo "</li><li>\n";
 +      tpl_link(wl($ID,'date='.(date("Y")-2)),(date("Y")-2).' Data');
 +    echo "</li></ul></p>";
 +    echo '<h2>Daily Logbook</h2>
 +<p>
 +A list of CR data amount (disk space, files, antennae) per year, month and day can be found in the <a class="extlink" href="http://www.astro.ru.nl/anigl/datalopes.html">Daily Logbook</a>.</p>
 +    ';
 +  }
 +
 +  ob_start();
 +  system("cd $dynspecdir; find . -not -regex '.*/\..*'");
 +  $ldircont = preg_split("/\n/", ob_get_contents());
 +  ob_end_clean();
 +
 +  ob_start();
 +  system("cd $basedir/content/data/dynspec/thumbs; find . -not -regex '.*/\..*'");
 +  $tdircont = preg_split("/\n/", ob_get_contents());
 +  ob_end_clean();
 +
 +  if (getID('date') && preg_match("/\d+/", getID('date'), $num) && strlen($num[0]) >= 4)  {
 +    switch (strlen($num[0])) {
 +    case 4:
 +      showyear($num[0]);
 +      break;
 +    case 6:
 +      showmonth($num[0]);
 +      break;
 +    case 8:
 +      showday($num[0]);
 +      break;
 +    default:
 +      genintro();
 +    }
 +  } else {
 +    genintro();
 +  }
 +</php>