CU INSTAAR Tethered balloon data. Contact Detlev Helmig for access.
Field campaign: 15 January - 1 March 2012
0, so it gets into the 'else' below.
}
if (($pos === false) * (substr($file, 0, 1)!=".")) { // starting string might be same as another filename (ie A24-PALMS, and A24-PALMSpartType)
$skipIt=1;
} else {
$wholePrefix = substr($file, 0, $pos); //now seach on the whole prefix of filename, not part of it.
}
// if ((preg_match($strToFind, $wholePrefix)) * ($skipIt==0)) { //find items starting with dataID
if (($strToFind == $wholePrefix) * ($skipIt==0)) { //find matching string (won't find partial match with substr)
if ($ftype =="ibw") { //if searching ibw files (want to find zip files, not folders with same prefix).
$fname=$file; // it's a match. ibw folder = dataID
break;
} else { //finds ict files here if there's a match
$fname=$file; //found one
break; // done searching this folder
}
} // endif
} // endwhile
closedir($open);
return $fname;
}
// Reads last line of icartt file starting at end
function readlastline($fileName) {
$fp = @fopen($fileName, "r");
$pos = -1;
$t = " ";
while ($t != "\n") {
fseek($fp, $pos, SEEK_END);
$t = fgetc($fp);
$pos = $pos - 1;
if (($pos==-2)*($t == "\n")) {
$t=" "; //reset so it doesn't find very first /n if that is the last char in file.
}
}
$t = fgets($fp);
fclose($fp);
return $t;
}
function writeTableRow($dataGroup, $dataID, $dataArr) { //ie pass in "Chem", "ARNOLD", "O3_ppbv","NO3_pptv"
echo "
\n"; //new row
echo "
$dataID
\n"; //first col has file prefix (dataID)
echo "
\n"; //2nd col has icartt, ibw file icons if data exists
// IBW FILES
$IBWFilePathAndName = "../../data/Ground/ibw/All/$dataGroup/$dataID";
if (file_exists($IBWFilePathAndName)) {
$phpPath = "datafunction.php?mission=2012ubwos&platform=Ground&filetype=ibw&fldate=All&datagroup=".$dataGroup."&dataid=".$dataID;
echo " "; //link for IBW folder.
echo "";
}
// ICARTT FILES
$foundit=0; //init variable
$vrsn = array('RA','RB', 'RC', 'RD', 'RE', 'R0', 'R1', 'R2', 'R3', 'R4', 'R5');
$i=0;
if ($dataID == "Met-PSD") {
$fdate = "20120112";
} elseif ($dataID == "Rad-PSD") {
$fdate = "20120113";
} else {
$fdate = "20120115";
}
while($foundit==0 && $i<10) {
$ICTFilePathAndName = "../../data/Ground/ict/All/$dataGroup/".$dataID."_UBWOS_".$fdate."_".$vrsn[$i].".ict";
if (file_exists($ICTFilePathAndName)) {
$foundit=1;
echo "\n"; // make link
echo "";
echo "\n";
} else {
$i+=1;
} //end if exists
} //end while
$fname = $dataID."_UBWOS_".$fdate."_".$vrsn[$i].".ict";
if ($foundit==1) { //found a file that matches file prefix that was passed in.
$rev = substr($fname, strlen($fname)-6, 2); // icartt file revision from filename
// $modDate = date("Ymd, H, T", filemtime("../../data/Atlantis/ict/AllCrz/$dataGroup/$fname")); //file modification in yyyymmdd, hh, MDT
//NEED TO DO THIS TO FIND TIME OF LAST UPDATE IN FILE.
$lastLine = readlastline("../../data/Ground/ict/All/$dataGroup/$fname"); // returns entire last line of text from file
$lastTimeArr = sscanf($lastLine, "%d"); // extracts the first number (don't know how many there will be, so do it this way)
$lastTime = $lastTimeArr[0]; // get the first number in the array which is the 1st number in the line of data.
$pos = strpos($fname, "_", 0); // position of first _ in filename
$pos = strpos($fname, "_", $pos+1); // position of second _
$fileDate = substr($fname, $pos+1, 8); //get the date from the filename
// print "Extracted date: $fileDate\n";
//Now do date arithmetic with # of secs from date in icartt filename.
// print "lasttime in file = $lastTime\n";
$n = sscanf($fileDate, "%4d%2d%2d", $year, $month, $day); //read 4 digit year 2 digit month 2 digit day from file date
// prints yyyymmdd of file start+lastTime
$endData = date("Ymd H:i:s\n", mktime(0,0,0, $month, $day, $year)+$lastTime); //end date of data.
echo "
\n"; // close 2nd col tag
echo "
$rev
\n "; // 3rd col has file revision.
echo "
$endData
\n "; // 4th col has date/time of last data in file. Useful to know if it has been updated since last download.
echo "
"; //5th col has links to graphs
foreach($dataArr as $item) { //write out the links to png files
echo " $item ";
}
echo "
\n "; // 5th row has data plots.
} else { //foundit=0 // no IBW folder found
echo " \n "; // close 2nd col
echo "
\n "; // empty 3rd col
echo "
\n "; // empty 4th col
echo "
\n "; // empty 5th col
}
echo "
\n"; // close row tag
}
//end of functions
if (!isset($_COOKIE["DataAgreement"])) {
$requestedpageGET = strip_tags($_GET["page"]);
$pos = strpos($requestedpageGET, "/groups/csl7/measurements/2012ubwos/");
if ($pos === false) {
die("Error in requested URL\n");
}
echo "
Data policy
";
echo "\n";
}
else {
print <<All times are MST. Each file contains data for entire measurement period. Click an icon to download that file.
Data revision is indicated by R followed by a letter (preliminary) or a number (final data).
A indicates files in ICARTT ascii format.
A indicates files in Igor binary format (zipped file containing folder of Igor files).
HTMLBLOCK;
//has to be flush left, or block doesn't work.
echo "";
}
?>