/* * Print a report of IEM Cow statistics * This is called from the python spammer script as it uses the output to * send in an email */ date_default_timezone_set('America/Chicago'); /* Generate some cow statistics! */ $ets = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $sts = $ets - 86400.0; date_default_timezone_set('UTC'); include "../../include/cow.php"; include "../../include/database.inc.php"; $cow = new Cow(iemdb("postgis")); $cow->setLimitTime($sts, $ets); $cow->setHailSize(1.0); $cow->setLimitType(array("TO", "SV")); $cow->setLimitLSRType(array("TO", "SV")); $cow->milk(); if (sizeof($cow->warnings) == 0) { echo "No Warnings Issued\n"; die; } echo sprintf("SVR+TOR Warnings Issued: %s Verified: %s [%.1f %%]\n", sizeof($cow->warnings), $cow->computeWarningsVerified(), $cow->computeWarningsVerifiedPercent()); echo sprintf("Reduction of Size Versus County Based [%.1f %%]\n", $cow->computeSizeReduction()); echo sprintf("Average Perimeter Ratio [%.1f %%]\n", $cow->computeAveragePerimeterRatio()); echo sprintf("Percentage of Warned Area Verified (15km) [%.1f %%]\n", $cow->computeAreaVerify()); echo sprintf("Average Storm Based Warning Size [%.0f sq km]\n", $cow->computeAverageSize()); echo sprintf("Probability of Detection(higher is better)[%.2f]\n", $cow->computePOD()); echo sprintf("False Alarm Ratio (lower is better) [%.2f]\n", $cow->computeFAR()); echo sprintf("Critical Success Index (higher is better) [%.2f]\n", $cow->computeCSI());
} $cow->milk(); $charturl = sprintf("chart.php?aw=%s&ae=%s&b=%s&c=%s&d=%s", $cow->computeWarningsVerified(), $cow->computeWarnedEvents(), $cow->computeUnwarnedEvents(), $cow->computeWarningsUnverified(), "NA"); if (sizeof($ltype) == 0) { $content .= "<div class='warning'>You did not select any of the Local Storm \n\tReport types above, so none are listed below...<br /><br /></div>"; } if (sizeof($wtype) == 0) { $content .= "<div class='warning'>You did not select any of the Warning \n\ttypes above, so none are listed below...<br /><br /></div>"; } $dstat = date("m/d/Y H:i", $sts); $dstat1 = date("m/d/Y H:i", $ets); $aw = sprintf("%s", $cow->computeWarningsVerified()); $pv = sprintf("%.1f", $cow->computeWarningsVerifiedPercent()); $sr = sprintf("%.1f", $cow->computeSizeReduction()); $asz = sprintf("%.0f", $cow->computeAverageSize()); $av = sprintf("%.0f", $cow->computeAreaVerify()); $ae = $cow->computeWarnedEvents(); $b = $cow->computeUnwarnedEvents(); $tdq = $cow->computeTDQEvents(); $wtable = ""; reset($cow->warnings); $wsz = sizeof($cow->warnings); while (list($k, $warn) = each($cow->warnings)) { $wtable .= printWARN($cow, $warn); } $ltable = ""; reset($cow->lsrs); $lsz = sizeof($cow->lsrs); while (list($k, $lsr) = each($cow->lsrs)) { if ($lsr["warned"]) { continue;
<?php date_default_timezone_set('UTC'); include "../../include/wfoLocs.php"; include "../../include/cow.php"; include "../../include/database.inc.php"; echo "WFO,AREA_V,SIZE_R\n"; //while (list($key,$val) = each($wfos)){ $cow = new Cow(iemdb("postgis")); $cow->setLimitTime(mktime(6, 0, 0, 10, 1, 2007), mktime(0, 0, 0, 1, 1, 2014)); $cow->setHailSize(0.75); $cow->setLimitType(array("TO")); $cow->setLimitLSRType(array("TO")); $cow->setLimitWFO(array("MPX")); $cow->milk(); echo sprintf("%s,%.1f,%.1f\n", $key, $cow->computeAreaVerify(), $cow->computeSizeReduction()); echo $cow->computeAveragePerimeterRatio(); echo "\n"; echo $cow->computePOD(); echo "\n"; echo $cow->computeFAR(); echo "\n"; echo $cow->computeCSI(); echo "\n"; echo $cow->computeSharedBorder(); echo "\n"; //}