METEO Meyenheim IALSACEM4

 Latitude N 47° 54' 42"    Longitude E 07° 21' 22"    Altitude 210 m

*** Modified by laulau and beteljuice # TNET Services, Inc. # Copyright: (c) 1992-2010 Copyright TNET Services, Inc. # # License: # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # ############################################################################ # Location of the dayfile.txt # # This needs to point to where your dayfile.txt is relative to where this # script is running. # # Normally... This will work because the daytime.txt and this script are # in the same directory (folder) $SITE['dayfile'] = '../dayfile.txt'; # # Need to know where the realtime.txt file is too. We look there to get # the Unit types of the values for temp, wind, press, and rain... # # Normal would be something like $SITE['realtime'] = '../realtime.txt'; # ############################################################################ ## OVERRIDE VALUES... REMOVE IF YOU ARE USING THIS SCRIPT $SITE['realtime'] = '../realtime.txt'; $SITE['dayfile'] = '../dayfile.txt'; ############################################################################ ############################################################################ # Really shouldn't need to change anything below here unless you want to # change the language... ############################################################################ // Fields of realtime.txt file - DON'T CHANGE!! Even for language $SITE['rfields'] = array( "date","time","temp","hum","dew","wspeed","wgust","bearing","rrate", "rfall","press","wdir","beaufort","windunit","tempunit","pressunit","rainunit", "windrun","presstrend","rmonth","ryear","rfallY","intemp","inhum","wchill", "temptrendval","tempTH","TtempTH","tempTL","TtempTL", "windTM","TwindTM","wgustTM","TwgustTM", "pressTH","TpressTH","pressTL","TpressTL", "version","build","rmaxgust","heatindex","humidex","UV","ET","SolarRad", "avgbearing","rlhour", "forecast", "daylight", "finestat"); // Values in the dayfile.txt - DON'T CHANGE!! Even for language $SITE['dfields'] = array ( 'date', 'gusthi','gusthidir','gusthitm', 'tempmin','tempmintm', 'tempmax','tempmaxtm', 'pressmin','pressmintm', 'pressmax','pressmaxtm', 'rainratemax','rainratemaxtm', 'raintot', 'tempavg', 'winrun', 'winavghi','winavghitm', 'hummin','hummintm', 'hummax','hummaxtm', 'evapt','sunst', 'heatimax','heatitm', 'apptmax','apptmaxtm', 'apptmin','apptmintm', 'df32[0]','df32[1]','df32[2]','df32[3]','df32[4]','df32[5]','df32[6]','df32[7]','df32[8]', 'hdd','cdd' ); // Values for correlating Windrun units based on windunits $windrununits = array ( 'm/s' => 'Kilometres', 'mph' => 'Miles', 'km/h' => 'Kilometres', 'kts' => 'Nautical Miles' ); // Check for Options check_sourceview(); // Option to override year? if ( isset($_REQUEST['y'] )) { $year = intval($_REQUEST['y']); } else { // $year = date('Y'); $year = date("Y", mktime(0, 0, 0, date("m"), date("d")-1, date("Y"))); // last data was yesterday ;-) } // Option to override month? if (isset($_REQUEST['m'] )) { $month = intval($_REQUEST['m']); } else { // $month = date('m'); $month = date("m", mktime(0, 0, 0, date("m"), date("d")-1, date("Y"))); // last data was yesterday ;-) } // Get Units Info from the realtime.txt file // Read data into array $DATA = get_raw($SITE['realtime'],' '); $SITE['tempunit'] = ret_rval('tempunit'); $SITE['windunit'] = ret_rval('windunit'); $SITE['pressunit'] = ret_rval('pressunit'); $SITE['rainunit'] = ret_rval('rainunit'); $SITE['windrununit'] = $windrununits[ret_rval('windunit')]; // READ the dayfile into the $raw array $raw = file($SITE['dayfile']); // *** NEW - create year / month options $months = array ("Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Août", "Septembre","Octobre","Novembre","Décembre"); // moved from main code // find out 'records began year' $yearstart = intval("20" . substr($raw[0],6,2)); $yearend = date("Y", mktime(0, 0, 0, date("m"), date("d")-1, date("Y"))); // last data was yesterday ;-) $select = "
Année:
Mois:
\n"; echo $select; // END NEW ********** // Display the data //echo '

Monthly Climatological Summary

'; display_month($year,$month) ; //echo '
Collected data is generated at 12 minutes after Midnight each day'; // Function to parse the month needed. // Allows multiple display_month calls above. function display_month($year,$month) { global $raw, $SITE, $months; $months = array ("Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Août", "Septembre","Octobre","Novembre","Décembre"); echo '

Données mensuelles ' . $months[$month -1 ] . ' ' . $year . '


'; echo ''. '' ; // Set found counter to 0 $found = 0; $cddtot = 0; $hddtot = 0; $tmax = -50; $tmin = 50; $tmoy = 0; $nbj = 0; $pmin = 1100; $pmax = 900; $wmax = 0; $wrun = 0; $rtot = 0; $rmax = 0; $hmax = 0; $hmin = 100; // 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) ) { $nbj += 1; // Date echo ''; // Temps echo ''; if ($values[ret_val('tempmax')] > $tmax){ $tmax = $values[ret_val('tempmax')]; } if ($values[ret_val('tempmin')] < $tmin){ $tmin = $values[ret_val('tempmin')]; } $tmoy += $values[ret_val('tempavg')]; // Deg day echo ''; $hddtot = $hddtot + $values[ret_val('hdd')]; $cddtot = $cddtot + $values[ret_val('cdd')]; // Pressure echo ''; if ($values[ret_val('pressmax')] > $pmax){ $pmax = $values[ret_val('pressmax')]; } if ($values[ret_val('pressmin')] < $pmin){ $pmin = $values[ret_val('pressmin')]; } // Wind echo ''; if ($values[ret_val('gusthi')] > $wmax){ $wmax = $values[ret_val('gusthi')]; $wdir = windDir($values[ret_val('gusthidir')]); } $wrun += $values[ret_val('winrun')]; // Rain echo ''; $rtot += $values[ret_val('raintot')]; if ($values[ret_val('rainratemax')] > $rmax){ $rmax = $values[ret_val('rainratemax')]; } // Hum echo ''; if ($values[ret_val('hummax')] > $hmax){ $hmax = $values[ret_val('hummax')]; } if ($values[ret_val('hummin')] < $hmin){ $hmin = $values[ret_val('hummin')]; } echo '' . $LF; $found++; } } if ($found) { // Date echo ''; // Temps echo ''; // Deg day echo ''; // Pressure echo ''; // Wind echo ''; // Rain echo ''; // Hum echo ''; echo '' . $LF; } echo '
Jour Temp maxTemp minTemp moy. Déficit
DJU
Exédent
DJU
Press max
(' . $SITE['pressunit'] . ')
Press min
(' . $SITE['pressunit'] . ')
Rafale max
(' . $SITE['windunit'] . ')
DirectionParcours
(' . $SITE['windrununit'] . ')
Pluie
(' . $SITE['rainunit'] . ')
Averse
' . $SITE['rainunit'] . '/hr
Hum max
(%)
Hum min
(%)
' . substr($values[ret_val('date')],0,2) . '' . $values[ret_val('tempmax')] . '°' . $SITE['tempunit'] . '' . $values[ret_val('tempmin')] . '°' . $SITE['tempunit'] . '' . $values[ret_val('tempavg')] . '°' . $SITE['tempunit'] . '' . $values[ret_val('hdd')] . '°' . $SITE['tempunit'] . '' . $values[ret_val('cdd')] . '°' . $SITE['tempunit'] . '' . $values[ret_val('pressmax')] . '' . $values[ret_val('pressmin')] . '' . $values[ret_val('gusthi')] . '' . windDir($values[ret_val('gusthidir')]) . '' . $values[ret_val('winrun')] . '' . $values[ret_val('raintot')] . '' . $values[ret_val('rainratemax')] . '' . $values[ret_val('hummax')] . '' . $values[ret_val('hummin')] . '
' .'Extr.'. '' . $tmax . '°' . $SITE['tempunit'] . '' . $tmin . '°' . $SITE['tempunit'] . '' . number_format($tmoy/$nbj,1) . '°' . $SITE['tempunit'] . '' . $hddtot . '°' . $SITE['tempunit'] . '' . $cddtot . '°' . $SITE['tempunit'] . '' . $pmax . '' . $pmin . '' . $wmax . '' . $wdir . '' . $wrun . '' . $rtot . '' . $rmax . '' . $hmax . '' . $hmin . '
'; // If we found no records, output an error: if (!$found) { 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 ("N","NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSO","SO", "OSO", "O", "ONO", "NO", "NNO"); $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 ############################################################################ ?>


Mise à jour :
powered by Cumulus v