# ############################################################################ # 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 ############################################################################ # This document uses Tab 4 Settings ############################################################################ # History # 2010-08-21 1.0 Inital Release # 2010-08-21 1.01 Changed Position of Legend # 2010-08-21 1.2 Fix when lowest temp below zero and no data for every day of the year (including leap day) # 2010-12-14 1.21 Added function to display error message if jpgraph files not found ############################################################################ //include_once("Settings.php"); //include_once("common.php"); ################# User Settings ############################### $loc = "../"; # Set to location of NOAA report files $jploc = "../jpgraph/" ; # Set to location of jpgraph files $first_year_of_data = "2012"; # First year of NOAA data that is available $temp_type = 'C' ; # Set to F or C for Farenheit or Celcius $month_names = array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); $do_cache = false; # Set to true to cache data for up to 24 hours. $cache_location = "./cache/"; # Set to location of cache file. Chmod to 666 or 777 so that it is writeable; $SITE['viewscr'] = 'sce'; // Password for View Source Function ################# End of User Settings ############################### error_reporting(E_ALL & ~E_NOTICE); check_sourceview_mc(); require ("wxnoaacsvdata.php"); $temp_increments = 5 + (5*('F' == strtoupper($temp_type))); $max_temp_scale = 5 + (ceil(max($yeardata[0])/$temp_increments))*$temp_increments; $min_temp_scale = (floor(min(array_filter($yeardata[11]))/$temp_increments))*$temp_increments; $ytickPositions = $ytickLabels = array(); $t = $min_temp_scale; for ($i = 0; $t <= $max_temp_scale; $i++){ $ytickPositions[$i] = $t; $t = $t+($temp_increments*2); } if ('F' == strtoupper($temp_type)){ $temp_unit = "°F"; } else $temp_unit = "°C"; if ($graph_interval == 1) { $tickPositions = array(0,31,60,91,121,152,182,213,244,274,305,335); $record_high_data = $yeardata[0]; $record_low_data = $yeardata[1]; $average_high_data = $yeardata[2]; $average_low_data = $yeardata[3]; $average_mean_data = $yeardata[4]; } else { $tickPositions = array(0,1,2,3,4,5,6,7,8,9,10,11); $record_high_data = $yeardata[10]; $record_low_data = $yeardata[11]; $average_high_data = $yeardata[12]; $average_low_data = $yeardata[13]; $average_mean_data = $yeardata[14]; } $tickLabels = $month_names; ################# Functions #################################### function create_image1(&$value,$value1) { //Set the image width and height $width = 400; $height = 100; //Create the image resource $image = ImageCreate($width, $height); //We are making three colors, white, black and gray $white = ImageColorAllocate($image, 255, 255, 255); $black = ImageColorAllocate($image, 0, 0, 0); $grey = ImageColorAllocate($image, 204, 204, 204); //Make the background black ImageFill($image, 0, 0, $grey); //Add randomly generated string in white to the image ImageString($image, 5, 40, 20, $value, $black); ImageString($image, 5, 40, 60, $value1, $black); //Tell the browser what kind of file is come in // header("Content-Type: image/jpeg"); //Output the newly created image in jpeg format // ImageJpeg($image); //Free up resources ImageDestroy($image); } function check_sourceview_mc () { global $SITE; if ( isset($_GET['view']) && $_GET['view'] == $SITE['viewscr'] ) { $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; } } ############################################################################ # End of Page ############################################################################ ?> Meteo San Sebastian Arriola / Climograma