Пример #1
0
/*
 * 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());
Пример #2
0
<?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";
//}