Päivä | Max lämpö | Min lämpö | Keskiarvo | Max paine (' . $SITE['pressunit'] . ') | Min
paine (' . $SITE['pressunit'] . ') |
Tuulenpuuska (' . $SITE['windunit'] . ') | Tuulen suunta | Tuulen matka (' . $SITE['windrununit'] . ') |
Sademäärä (' . $SITE['rainunit'] . ') | Max sade ' . $SITE['rainunit'] . '/h | ';
// Set found counter to 0
$found = 0;
// Read the array now looking for data in the data set we want
foreach($raw as $key) {
if (strpos($key, ";") !==FALSE ){
$values = preg_split('/;/',$key);
} else {
$values = preg_split('/,/',$key);
}
// Check to see if this is in the date data set
if ($year == "20" . substr($values[ret_val('date')],6,2)
&& $month == substr($values[ret_val('date')],3,2) ) {
// Date
echo '
---|---|---|---|---|---|---|---|---|---|---|
' . substr($values[ret_val('date')],0,2) . ' | '; // Temps echo '' . $values[ret_val('tempmax')] . '°' . $SITE['tempunit'] . ' | ' . $values[ret_val('tempmin')] . '°' . $SITE['tempunit'] . ' | ' . $values[ret_val('tempavg')] . '°' . $SITE['tempunit'] . ' | '; // Pressure echo '' . $values[ret_val('pressmax')] . ' | ' . $values[ret_val('pressmin')] . ' | '; // Wind echo '' . $values[ret_val('gusthi')] . ' | ' . windDir($values[ret_val('gusthidir')]) . ' | ' . $values[ret_val('winrun')] . ' | '; // Rain echo '' . $values[ret_val('raintot')] . ' | ' . $values[ret_val('rainratemax')] . ' | '; echo '
Sorry, there is no data found for " . $months[$month -1 ] . ' ' . $year . "
"; } } // Return the array position of the variable function ret_val($lookup) { global $SITE; $rtn = array_search ( $lookup , $SITE['dfields'] ); if ($rtn !== FALSE) { return( $rtn ); } else { return("-"); } } // Return the array position of the variable function ret_rval($lookup) { global $SITE, $DATA; $rtn = array_search ( $lookup , $SITE['rfields'] ); if ($rtn !== FALSE) { return( $DATA[$rtn] ); } else { return("-"); } } // Standard Source view option check function check_sourceview () { global $SITE; if ( isset($_GET['view']) && $_GET['view'] == 'sce' ) { $filenameReal = __FILE__; $download_size = filesize($filenameReal); header('Pragma: public'); header('Cache-Control: private'); header('Cache-Control: no-cache, must-revalidate'); header("Content-type: text/plain"); header("Accept-Ranges: bytes"); header("Content-Length: $download_size"); header('Connection: close'); readfile($filenameReal); exit; } } // Calculate Word WinDir from Bearing function windDir ($winddir) { if (!isset($winddir)) { return "---"; } $windlabel = array ("Pohjoinen","NNE", "Koillinen", "ENE", "Itä", "ESE", "Kaakko", "SSE", "Etelä", "SSW","Lounas", "WSW", "Länsi", "WNW", "Luode", "NNW"); $dir = $windlabel[ fmod((($winddir + 11) / 22.5),16) ]; return "$dir"; } // Function to read the data file with the // Delimiter provided function get_raw( $rawfile , $del ) { $rawdata = array(); $fd = fopen( $rawfile, "r" ); if ( $fd ) { $rawinfo = ''; while (! feof ( $fd ) ) { $rawinfo .= fread( $fd, 8192 ); } fclose($fd); $rawdata = explode ( $del, $rawinfo ); } else { $rawdata[0]= -9999; } return $rawdata; } ############################################################################ # End of Module ############################################################################