tgr0ss83 0 Light Poster

Not the prettiest edits, but does the job, and it's fast :)

Sorry Cereal, i know it's like taking crayon to a Picasso :)

<?php
$file = "http://mis.nyiso.com/public/realtime/realtime_gen_lbmp.csv";

$f = fopen($file, "r");
$ln= 0;
$theData=array();
$nyc = array();
$millwood = array();
$hudvl = array();
$dunwood = array();

$nycLmp = array();
$millwoodLmp = array();
$hudvlLmp = array();
$dunwoodLmp = array();

$arr = array('nyc' => array(23512,23513,23515,23516,23517,23518,23519,23520,23523,23524,23533,23534,23535,23538,23540,23541,23657,23660,23729,23770,23786,23810, 23816,23817,23820,24077,24078,24079,24080,24084,24094,24095,24096,24097,24098,24099,24100,24101,24102,24103,24104,24105,24106,24107, 24108,24110,24111,24112,24113,24114,24115,24116,24117,24118,24119,24120,24121,24122,24123,24124,24125,24126,24127,24128,24129,24130, 24131,24132,24133,24134,24135,24136,24137,24138,24149,24152,24155,24156,24157,24158,24159,24160,24161,24162,24163,24168,24195,24196, 24202,24225,24226,24227,24228,24229,24230,24231,24232,24233,24234,24235,24236,24237,24238,24239,24240,24241,24242,24243,24244,24245, 24246,24247,24248,24249,24250,24251,24252,24253,24254,24255,24256,24257,24258,24259,24260,24261,323558,323559,323566,323567,323568,323569,323581,323582,323595,323610,323651,323677,323678,923512,923533,923568,924077,924094,924106,924149,924156,924157,924158,924160,924162,924228),
'millwood' => array(23530,23531,23653,23659,23776,24019,24139,24193,24198,323649),
'hudv1' => array(23526,23586,23587,23588,23589,23590,23591,23592,23593,23595,23607,23608,23609,23610,23611,23612,23632,23639,23640,23641,23642,23654,23754,23765,23769,24000,24148,24192,323565,323602,323613,323627,323648,923586,923587),
'dunwood' => array(23655,24194,323650));

#while($line = fgets($f)) { # both give same results and similar performance
while($line = stream_get_line($f,10000,"\n")) {
	$b=explode(",",$line);
	unset($b[1],$b[4],$b[5]);
	$b=implode(",",$b);
	$b=str_replace('"','',$b);
	$b=preg_split("/[\s,]/",$b);
   # $b = preg_split('/[\s,]/', trim($line));
	

    
    if(in_array($b[2],$arr['millwood']))
    {
        $millwood[] = array($b[0],$b[1]);
		$millwoodLmp[] = $b[3];
    }
    
    elseif(in_array($b[2],$arr['hudv1']))
    {
        $hudv1[] = array($b[0],$b[1]);
		$hudv1Lmp[] = $b[3];
    }
    
    elseif(in_array($b[2],$arr['dunwood']))
    {
        $dunwood[] = array($b[0],$b[1]);
		$dunwoodLmp[] = $b[3];
    }
    
    elseif(in_array($b[2],$arr['nyc']))
    {
        $nyc[] = array($b[0],$b[1]);
		$nycLmp[]=$b[3];
		
    }
    
} 
$theData[]=$nyc[0][0];
$theData[]=$nyc[0][1];
$theData[]=array_sum($nycLmp)/count($nycLmp); // average nyc
$theData[]=array_sum($dunwoodLmp)/count($dunwoodLmp); // average dunwood
$theData[]=array_sum($hudv1Lmp)/count($hudv1Lmp); // average hud vl
$theData[]=array_sum($millwoodLmp)/count($millwoodLmp); // average millwood

var_dump($millwoodLmp);
var_dump($theData);
fclose($f);
echo "done\n";
echo memory_get_peak_usage(); # you can remove this

Thanks again,