"; } //echo "cURL Error: " . curl_error($ch); } else { //var_dump($data); } curl_close($ch); return $data; } function get_U_comp($t_spd,$t_dir) { $result = -1 * ($t_spd * 0.5148) * sin($t_dir * (pi() / 180)); return $result; } function get_V_comp($t_spd,$t_dir) { $result = -1 * ($t_spd * 0.5148) * cos($t_dir * (pi() / 180)); return $result; } function extrap_wind_spd($t_wnd_spd,$t_old_wnd_spd,$t_height,$t_old_height,$level) { $m = ($t_wnd_spd - $t_old_wnd_spd)/($t_height - $t_old_height); // slope $b = $t_old_wnd_spd - $m * $t_old_height; $result = $m * $level + $b; return $result; } function extrap_wind_dir($t_wnd_dir,$t_old_wnd_dir,$t_height,$t_old_height,$level) { $m = ($t_wnd_dir - $t_old_wnd_dir)/($t_height - $t_old_height); // slope $b = $t_old_wnd_dir - $m * $t_old_height; $result = $m * $level + $b; return $result; } function shear($t_u_diff, $t_v_diff) { $result = (sqrt(($t_u_diff * $t_u_diff ) + ($t_v_diff * $t_v_diff )))/.5148; return $result; // return result in knots, NOT m/s } function get_wind_dir($ustm, $vstm) { // calculate storm direction if( $vstm > 0) $ANG = 180; elseif ( ($ustm < 0) && ($vstm < 0)) $ANG = 0; elseif ( ($ustm > 0) && ($vstm < 0)) $ANG = 360; if($vstm == 0) $vstm = .00000001; $storm_direction = (180 / pi()) * atan($ustm / $vstm) + $ANG; return $storm_direction; } function output_wind_data($FINAL_direction, $FINAL_speed) { if($FINAL_direction >= 349 and $FINAL_direction <= 360){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction >= 0 and $FINAL_direction <= 11){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 11 and $FINAL_direction <= 34){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 34 and $FINAL_direction <= 56){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 56 and $FINAL_direction <= 78){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 78 and $FINAL_direction <= 101){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 101 and $FINAL_direction <= 124){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 124 and $FINAL_direction <= 146){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 146 and $FINAL_direction <= 169){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 169 and $FINAL_direction <= 191){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 191 and $FINAL_direction <= 214){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 214 and $FINAL_direction <= 236){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 236 and $FINAL_direction <= 259){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 259 and $FINAL_direction <= 281){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 281 and $FINAL_direction <= 304){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 304 and $FINAL_direction <= 326){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } elseif ($FINAL_direction > 326 and $FINAL_direction <= 349){ $provided_wind_data = "\"Wind " . round($FINAL_speed,0) . ''; } else $provided_wind_data = "" . round($FINAL_direction,0) . ''; return $provided_wind_data; } //$num_entries = 85; $report_date = ''; $model_init_hour = ''; $model_date = ''; $got_time = 0; $ruc_counter = 0; $i = 0; $j = 0; $k = 0; $in_dst="false"; //if( (date("m")>=4) && (date("m")<=10) ) // IS CURRENT DATE INSIDE OF APRIL->OCT WINDOW? //{ if( (date("m")>3) && (date("m")<11) ) //IS CURRENT DATE INSIDE MARCH->NOV WINDOW? { $in_dst="true"; } elseif(date("m")=="3") //IS IT MARCH? { if( (date("j")>7) && (date("D")=="Sun") ) //IS IT THE SECOND SUN OF THE MONTH? { if(date("H")>"1") //IS IT PAST 2:00AM? { $in_dst="true"; } } } elseif(date("m")=="11") //IS IT NOV? { if( (date("j")<=7) && (date("D")=="Sun") ) //IS IT THE FIRST SUN OF THE MONTH? { if(date("H")>"1") //IS IT PAST 2:00AM? { $in_dst="false"; } } } //} $time_offset = 0; //echo $in_dst; if($in_dst =="true") //INSIDE OF DST $time_offset = 400; else $time_offset = 500; if ( ! isset($_REQUEST['rapstation']) ) $_REQUEST['rapstation']="KABR"; if ( ! isset($_REQUEST['modelname']) ) $_REQUEST['modelname']="NAM"; $rapstation = $_REQUEST['rapstation']; $modelname = $_REQUEST['modelname']; //if ($rapstation == "KMBG") // $rapstation = "KY26"; if ($modelname == "") $modelname = "NAM"; if ($modelname == "HRRR") { //if ($rapstation == "KSAW"){ // $rapstation1 = "727435"; //} if ($rapstation == "KLNL"){ $rapstation1 = "000396"; } elseif ($rapstation == "MQTM"){ $rapstation1 = "000397"; } elseif ($rapstation == "GRMM"){ $rapstation1 = "000398"; } elseif ($rapstation == "KTNM"){ $rapstation1 = "000399"; } else { $rapstation1 = $rapstation; } } elseif ($modelname == "GFS") { if ($rapstation == "KMBG") { $rapstation1 = "KY26"; } else { $rapstation1 = $rapstation; } } else { $rapstation1 = $rapstation; } //Set Length of data if ($modelname == "NAM") { $num_entries = 85; $modelname1 = $modelname; } elseif ($modelname == "NAMNEST") { $num_entries = 61; $modelname1 = $modelname; } elseif ($modelname == "HRRR") { $num_entries = 19; $modelname1 = $modelname; } elseif ($modelname == "RAP") { $num_entries = 22; $modelname1 = $modelname; } elseif ($modelname == "GFS") { $num_entries = 141; $modelname1 = "GFS3"; } elseif ($modelname == "HIRESW") { $num_entries = 49; $modelname1 = $modelname; } $REPORT_TIME = array_fill(0,$num_entries,0); $REPORT_TIME_RAW = array_fill(0,$num_entries,0); $REPORT_DAY = array(0,0,0,0,0,0,0,0,0,0,0,0); $SHO = array(0,0,0,0,0,0,0,0,0,0,0,0); $LI = array(0,0,0,0,0,0,0,0,0,0,0,0); $SWEAT = array(0,0,0,0,0,0,0,0,0,0,0,0); $KIndex = array(0,0,0,0,0,0,0,0,0,0,0,0); $LCL = array(0,0,0,0,0,0,0,0,0,0,0,0); $LCLP = array(0,0,0,0,0,0,0,0,0,0,0,0); $LCLT = array(0,0,0,0,0,0,0,0,0,0,0,0); $PWAT = array(0,0,0,0,0,0,0,0,0,0,0,0); $TTI = array(0,0,0,0,0,0,0,0,0,0,0,0); $CAPE = array(0,0,0,0,0,0,0,0,0,0,0,0); $NCAPE = array_fill(0,$num_entries,0); $CINS= array(0,0,0,0,0,0,0,0,0,0,0,0); $LID= array(0,0,0,0,0,0,0,0,0,0,0,0); $EL= array(0,0,0,0,0,0,0,0,0,0,0,0); $LFCT= array(0,0,0,0,0,0,0,0,0,0,0,0); $BRCH = array(0,0,0,0,0,0,0,0,0,0,0,0); $BRCHSHEAR = array(0,0,0,0,0,0,0,0,0,0,0,0); $SRH = array(0,0,0,0,0,0,0,0,0,0,0,0); $HLCY1K = array(0,0,0,0,0,0,0,0,0,0,0,0); $STMOTION = array(0,0,0,0,0,0,0,0,0,0,0,0); $EHI = array(0,0,0,0,0,0,0,0,0,0,0,0); $SHEAR1KM = array(0,0,0,0,0,0,0,0,0,0,0,0); $SHEAR3KM = array(0,0,0,0,0,0,0,0,0,0,0,0); $SHEAR6KM = array(0,0,0,0,0,0,0,0,0,0,0,0); $UVV = array(0,0,0,0,0,0,0,0,0,0,0,0); $HAIL = array(0,0,0,0,0,0,0,0,0,0,0,0); $WBZ = array(0,0,0,0,0,0,0,0,0,0,0,0); $HEIGHT_0C = array(0,0,0,0,0,0,0,0,0,0,0,0); $HEIGHT_20C = array(0,0,0,0,0,0,0,0,0,0,0,0); $CravenSig = array(0,0,0,0,0,0,0,0,0,0,0,0); $SCP = array(0,0,0,0,0,0,0,0,0,0,0,0); $STP = array(0,0,0,0,0,0,0,0,0,0,0,0); $EBWD = array(0,0,0,0,0,0,0,0,0,0,0,0); $PCPN_TOT = array_fill(0,$num_entries,0); $PCPN_HR = array_fill(0,$num_entries,0); $a_surf_u = array(0,0,0,0,0,0,0,0,0,0,0,0); $a_surf_v = array(0,0,0,0,0,0,0,0,0,0,0,0); $a_1000_u = array(0,0,0,0,0,0,0,0,0,0,0,0); $a_1000_v = array(0,0,0,0,0,0,0,0,0,0,0,0); $uMean = array(0,0,0,0,0,0,0,0,0,0,0,0); $uDelta = array(0,0,0,0,0,0,0,0,0,0,0,0); $vMean = array(0,0,0,0,0,0,0,0,0,0,0,0); $vDelta = array(0,0,0,0,0,0,0,0,0,0,0,0); $SURF_T = array_fill(0,$num_entries,0); $SURF_TC = array_fill(0,$num_entries,0); $SURF_TD = array_fill(0,$num_entries,0); $SURF_TA = array(0,0,0,0,0,0,0,0,0,0,0,0); $SURF_WSPD = array(0,0,0,0,0,0,0,0,0,0,0,0); $SURF_WDIR = array(0,0,0,0,0,0,0,0,0,0,0,0); $SURF_RH = array_fill(0,$num_entries,0); $MSLP_MB = array_fill(0,$num_entries,0); $MSLP_CH_3HR = array_fill(0,$num_entries,0); $MSLP_CH_6HR = array_fill(0,$num_entries,0); $PCPN_HR = array_fill(0,$num_entries,0); $PCPN_TOT = array_fill(0,$num_entries,0); $MOMT_U = array(); $MOMT_V = array(); $MB850_HEIGHT = array_fill(0,$num_entries,0); $MB700_HEIGHT = array_fill(0,$num_entries,0); $MB850_TEMP = array_fill(0,$num_entries,0); $MB925_HEIGHT = array_fill(0,$num_entries,0); $MB925_TEMP = array_fill(0,$num_entries,0); $MB850_DEWTEMP = array_fill(0,$num_entries,0); $MB700_TEMP = array_fill(0,$num_entries,0); $MB850_MB700_THICK = array_fill(0,$num_entries,0); $SFC_MB925_LR = array_fill(0,$num_entries,0); $SFC_MB850_LR = array_fill(0,$num_entries,0); $SFC_3KM_LR = array_fill(0,$num_entries,0); $SHERBS3 = array_fill(0,$num_entries,0); // convert to upper case // PSU Site - Stopped working on 10/22/16 - Possibly blocked server //$url = 'ftp://ftp.meteo.psu.edu/pub/bufkit/' . $modelname . '/latest/' . strtolower($modelname1) . '_' . strtolower($rapstation1) . '.buf'; //echo $url; //New version with PEV site $url = 'ftp://ftp.meteo.psu.edu/pub/bufkit/' . $modelname . '/' . strtolower($modelname1) . '_' . strtolower($rapstation1) . '.buf'; // Bufkit Warehouse //$url = 'http://www.meteor.iastate.edu/~ckarsten/bufkit/data/' . strtolower($modelname) . '/' . strtolower($modelname1) . '_' . strtolower($rapstation1) . '.buf'; //echo $url; $html = file_get_contents_curl($url); if(empty($html)){ //PSU Site $url = 'ftp://ftp.meteo.psu.edu/pub/bufkit/' . $modelname . '/latest/' . strtolower($modelname1) . '_' . strtolower(substr($rapstation1,1,3)) . '.buf'; //Bufkit Warehouse //$url = 'http://www.meteor.iastate.edu/~ckarsten/bufkit/data/' . strtolower($modelname) . '/' . strtolower($modelname1) . '_' . strtolower(substr($rapstation1,1,3)) . '.buf'; //echo $url; $html = file_get_contents_curl($url); } // start the parsing $lines = explode("\r\n", $html); while ($i < count($lines)): // time if (preg_match("/TIME =/i", $lines[$i])) { $ruc_counter = $ruc_counter +1; // found time line - now process rest of info $pos = strpos($lines[$i],'/'); if ($pos > 0 ){ $REPORT_TIME[$ruc_counter-1] = substr($lines[$i],$pos+1,4); if($REPORT_TIME[$ruc_counter-1] > 0) $REPORT_TIME[$ruc_counter-1] = $REPORT_TIME[$ruc_counter-1] / 100; if($REPORT_TIME[$ruc_counter-1] == 0) $REPORT_TIME[$ruc_counter-1] = 0; $REPORT_TIME_RAW[$ruc_counter-1] = $REPORT_TIME[$ruc_counter-1]; $REPORT_TIME[$ruc_counter-1] = $REPORT_TIME[$ruc_counter-1] . " Z"; $REPORT_DAY[$ruc_counter-1] = substr($lines[$i],$pos-4,2) . '/' . substr($lines[$i],$pos-2,2); $REPORT_MONTH[$ruc_counter-1] = substr($lines[$i],$pos-4,2); $REPORT_YEAR[$ruc_counter-1] = '20' . substr($lines[$i],$pos-6,2); $REPORT_DAY_MONTH[$ruc_counter-1] = substr($lines[$i],$pos-2,2); $MODEL_RUN_HOUR[$ruc_counter-1] = substr($lines[$i],$pos+1,2); $day_week = '20' . substr($lines[$i],$pos-6,2) . '-' . substr($lines[$i],$pos-4,2) . '-' . substr($lines[$i],$pos-2,2); $REPORT_DAY_WEEK[$ruc_counter-1] = strftime("%a",strtotime($day_week)); if($got_time == 0){ $got_time = 1; $report_date = substr($lines[$i],$pos-4,2) . '/' . substr($lines[$i],$pos-2,2) . '/20' . substr($lines[$i],$pos-6,2); $model_init_hour = substr($lines[$i],$pos+1,2); #Set runs that need extra hours in the HRRR/RAP - SRF 7/14/18 $HRRR_EXT = array("00", "06", "12", "18"); if (($modelname == "HRRR") && (in_array($model_init_hour, $HRRR_EXT))) { $num_entries = 37; } $RAP_EXT = array("03", "09", "15", "21"); if (($modelname == "RAP") && (in_array($model_init_hour, $RAP_EXT))) { $num_entries = 40; } } } // Grab Station Elevation $result = explode(" ",$lines[$i+1]); $STNELEV = $result[8]; //echo $STNELEV; $STNELEV_FT = $STNELEV * 3.28084; //echo $STNELEV_FT; // Grab Lat and Lon for Site $result = explode(" ",$lines[$i+1]); $STNLAT = $result[2]; $STNLON = $result[5]; // Showalter, Lifted Index, SWEAT,K Index $i = $i + 4; $result = explode(" ",$lines[$i]); $SHO[$ruc_counter-1] = round($result[2],2); $LI[$ruc_counter-1] = round($result[5],2); $SWEAT[$ruc_counter-1] = round($result[8],2); $KIndex[$ruc_counter-1] = round($result[11],2); // Pressure @ LCL, PWAT (precipitable H2O), Totals Total Index,CAPE $i = $i + 1; $result = explode(" ",$lines[$i]); $LCLP[$ruc_counter-1] = round($result[2],1); $PWAT[$ruc_counter-1] = round($result[5] *.04,2); $TTI[$ruc_counter-1] = round($result[8],2); $CAPE[$ruc_counter-1] = $result[11]; if($result[11] <= 0 ){ $UVV[$ruc_counter-1] = '---'; $HAIL[$ruc_counter-1] = '---'; } else { $UVV[$ruc_counter-1] = round((sqrt($result[11] * 2)/2)/.5148); $HAIL[$ruc_counter-1] = 2*((3*0.55*1.0033*($UVV[$ruc_counter-1] *$UVV[$ruc_counter-1] ))/(8*9.8*900))*100; $HAIL[$ruc_counter-1] = round($HAIL[$ruc_counter-1],2); } // Temp @ LCL , CINS, EL,LFCT $i = $i + 1; $result = explode(" ",$lines[$i]); $LCLT[$ruc_counter-1] = round($result[2] - 273.16,2); $CINS[$ruc_counter-1] = $result[5]; $EL[$ruc_counter-1] = $result[8]; if($EL[$ruc_counter-1] < 0 ) $EL[$ruc_counter-1] = '---'; else{ $EL[$ruc_counter-1] = 15760.7 + (-25.7563*$EL[$ruc_counter-1])+0.0104482*($EL[$ruc_counter-1]*$EL[$ruc_counter-1]); $EL[$ruc_counter-1] = round($EL[$ruc_counter-1] * 3.28); } $LFCT[$ruc_counter-1] = $result[11]; if($LFCT[$ruc_counter-1] < 0) $LFCT[$ruc_counter-1] = '---'; else{ $LFCT[$ruc_counter-1] = 15760.7 + (-25.7563*$LFCT[$ruc_counter-1])+0.0104482*($LFCT[$ruc_counter-1]*$LFCT[$ruc_counter-1]); $LFCT[$ruc_counter-1] = round($LFCT[$ruc_counter-1] * 3.28); } // NCAPE if(( ($EL[$ruc_counter-1] /3.28) - ($LFCT[$ruc_counter-1]/3.28)) != 0 ) $NCAPE[$ruc_counter-1] = $CAPE[$ruc_counter-1]/( ($EL[$ruc_counter-1] /3.28) - ($LFCT[$ruc_counter-1]/3.28)); $NCAPE[$ruc_counter-1] = round($NCAPE[$ruc_counter-1],2); // Bulk Richardson $i = $i + 1; $result = explode(" ",$lines[$i]); $BRCH[$ruc_counter-1] = $result[2]; // Bulk Richardson SHEAR if(($BRCH[$ruc_counter-1] > 0) and ($CAPE[$ruc_counter-1] > 0)) $BRCHSHEAR[$ruc_counter-1] = round($CAPE[$ruc_counter-1] / $BRCH[$ruc_counter-1],1); // now grab rest of sounding info for wind stuff // U-V wind components // U = -(SPD * 0.5148) * Sin(DIR * (PI / 180)) // V = -(SPD * 0.5148) * Cos(DIR * (PI / 180)) $i = $i + 4; $got_wbz_height = 0; $got_wbz = 0; $got_surface = 0; $got_upper0_5K = 0; $got_upper1K = 0; $got_upper3K = 0; $got_upper6K = 0; $MaxTwAloft = -50; $MaxTAloft = -50; $got_ebwd_height = 0; $got_lcl_height = 0; $surf_u = 0; $surf_v = 0; $u_1000 = 0; $v_1000 = 0; $lcl_u = 0; $lcl_v = 0; $wbz_f = 0; $pressure_mb = 0; $height = 0; $height_AGL = 0; $old_pressure_mb = 0; $temp=0; $surface_pressure_mb = 0; $old_WBc = 0; $wb_temperature = 0; $old_wb_temperature = 0; $inc = 0; $Q = 0; $Qsw = 0; $Qwmax = 0; $old_wind_spd = 0; $old_wind_dir = 0; $wind_spd = 0; $wind_dir = 0; $old_height = 0; $temp_spd = 0; $temp_dir = 0; $temp_temp = 0; $temp = 0; $Usr = 0; $Vsr = 0; $got_950mb = 0; $got_925mb = 0; $got_850mb = 0; $got_700mb = 0; $got_500mb = 0; $got_250mb = 0; $got_0CHeight = 0; $got_20CHeight = 0; $Tc = -9999; $old_Tc = -9999; $old_Tdc = -9999; $mom_transfer = 0; $got_thickness_height = 0; $H1000_x = 0; $H1000_v = 0; $H1000_cm = 0; // variables for slope and intercept for line equations $m =0; $b = 0; $Qsw = 0; $Qwmax = 0; while((trim($lines[$i]) <> "") && (substr($lines[$i],0,3) <> "STN")){ $result = explode(" ",$lines[$i]); $temp = $result[0]; if ($pressure_mb == 0){ $pressure_mb = $temp; $old_pressure_mb = $temp;} else{ $old_pressure_mb = $pressure_mb; $pressure_mb = $temp; } if(($wind_spd == 0 ) and ($wind_dir == 0 )){ $wind_spd = $result[6]; $wind_dir = $result[5]; $old_wind_spd = $wind_spd; $old_wind_dir = $wind_dir; } else { $old_wind_spd = $wind_spd; $old_wind_dir = $wind_dir; $wind_spd = $result[6]; $wind_dir = $result[5]; } if($got_surface == 0){ $got_surface = 1; $SURF_WSPD[$ruc_counter-1] = round($wind_spd); $SURF_WDIR[$ruc_counter-1] = round($wind_dir); $surf_u = get_U_comp($wind_spd,$wind_dir); $surf_v = get_V_comp($wind_spd,$wind_dir); $a_surf_u[$ruc_counter-1] = $surf_u; $a_surf_v[$ruc_counter-1] = $surf_v; // calculate LCL height in Ft here $surface_pressure_mb = $pressure_mb; $LCL[$ruc_counter-1] = round(($result[0] - $LCLP[$ruc_counter-1]) * 30); } if ($Tc == -9999) { $Tc = $result[1]; $old_Tc = $Tc; $Tdc = $result[3]; $old_Tdc = $Tdc; } else { $old_Tc = $Tc; $Tc = $result[1]; $old_Tdc = $Tdc; $Tdc = $result[3]; } $Es= 6.11* pow(10,(7.5*$Tc/(237.7+$Tc))); $E= 6.11* pow(10,(7.5*$Tdc/(237.7+$Tdc))); $RH = ($E/$Es)*100; $old_WBc = $WBc; $WBc = (((0.00066 * $result[0]) * $Tc) + ((4098 * $E) / (pow(($Tdc + 237.7) , 2)) * $Tdc)) / ((0.00066 * $pressure_mb) + (4098 * $E) / (pow(($Tdc + 237.7), 2))); $M= ((0.622*$E)/($result[0]-$E))*1000; $Q = ($WBc + 273.15) * pow(( 1000 / $result[0]), 0.286) + (3 * $M); if($pressure_mb > (500)){ // highest THETA-E in lowest 500 mb of atmosphere //$Q = ($result[2] + 273.15) * pow(( 1000 / $pressure_mb ), 0.286) + (3 * $MR); if($Q > $Qsw){ $Qsw= $Q; //echo "Qsw " . $pressure_mb . " " . $Qsw . "
"; } } if($pressure_mb > ($surface_pressure_mb-100)){ // highest THETA-E in lowest 100 mb of atmosphere //$Q = ($result[2] + 273.15) * pow(( 1000 / $pressure_mb ), 0.286) + (3 * $MR); if($Q > $Qwmax){ $Qwmax = $Q; //echo "Qwmax " . $pressure_mb . " " . $Qwmax . "
"; } } $wbz_f = $WBc ; // get wet bulb temp if($wbz_f < 0) { if($got_wbz == 0){ $got_wbz = 1; $old_wb_temperature = $wb_temperature; $wb_temperature = $wbz_f; } } $i = $i + 1; // get height and height AGL $result = explode(" ",$lines[$i]); $old_height = $height; $old_height_AGL = $height_AGL; if ($modelname == "GFS") { $height = $result[0]; $height_AGL = ($result[0] - $STNELEV); } else { $height = $result[1]; $height_AGL = ($result[1] - $STNELEV); } //Cal 1000mb Height //if ($ruc_counter == 1){ // $H1000_x = $Es * $RH; // $H1000_v = ($Tc + 273.15) / (1 - 0.379 * ($H1000_x / $pressure_mb)); // $H1000_cm = $H1000_v + 0.02774 * (1000 - $pressure_mb); // $MB1000_HEIGHT[$ruc_counter-1] = (($height * 3.28084) * 0.3048 - (67.422 * log10(1000 / $pressure_mb) * $H1000_cm) / 3.28084); // echo "1000H " . $MB1000_HEIGHT[$ruc_counter-1] . " "; //} //Get Pressure Levels for Mandatory Levels if ($pressure_mb < 950){ if($got_950mb == 0){ $got_950mb = 1; // extrapolate wind spd //$temp_spd = extrap_wind_spd($wind_spd,$old_wind_spd,$pressure_mb,$old_pressure_mb,950); // extrapolate wind dir //$temp_dir = extrap_wind_dir($wind_dir,$old_wind_dir,$pressure_mb,$old_pressure_mb,950); // Store 950mb Winds //$MB950_DIR[$ruc_counter-1] = $temp_dir; //$MB950_SPD[$ruc_counter-1] = $temp_spd; // extrapolate temp $temp_temp = extrap_wind_spd($Tc,$old_Tc,$pressure_mb,$old_pressure_mb,950); $MB950_TEMP[$ruc_counter-1] = round($temp_temp,1); // extrapolate height $temp_height = extrap_wind_spd($height,$old_height,$pressure_mb,$old_pressure_mb,950); $MB950_HEIGHT[$ruc_counter-1] = round($temp_height); } // got 950mb } // got pressure if ($pressure_mb < 925){ if($got_925mb == 0){ $got_925mb = 1; // extrapolate wind spd $temp_spd = extrap_wind_spd($wind_spd,$old_wind_spd,$pressure_mb,$old_pressure_mb,925); // extrapolate wind dir $temp_dir = extrap_wind_dir($wind_dir,$old_wind_dir,$pressure_mb,$old_pressure_mb,925); // Store 925mb Winds $MB925_DIR[$ruc_counter-1] = $temp_dir; $MB925_SPD[$ruc_counter-1] = $temp_spd; // extrapolate temp $temp_temp = extrap_wind_spd($Tc,$old_Tc,$pressure_mb,$old_pressure_mb,925); $MB925_TEMP[$ruc_counter-1] = round($temp_temp,1); // extrapolate height $temp_height = extrap_wind_spd($height,$old_height,$pressure_mb,$old_pressure_mb,925); $MB925_HEIGHT[$ruc_counter-1] = round($temp_height); } // got 925mb } // got pressure if ($pressure_mb < 850){ if($got_850mb == 0){ $got_850mb = 1; // extrapolate wind spd $temp_spd = extrap_wind_spd($wind_spd,$old_wind_spd,$pressure_mb,$old_pressure_mb,850); // extrapolate wind dir $temp_dir = extrap_wind_dir($wind_dir,$old_wind_dir,$pressure_mb,$old_pressure_mb,850); // Store 925mb Winds $MB850_DIR[$ruc_counter-1] = $temp_dir; $MB850_SPD[$ruc_counter-1] = $temp_spd; // extrapolate temp $temp_temp = extrap_wind_spd($Tc,$old_Tc,$pressure_mb,$old_pressure_mb,850); $MB850_TEMP[$ruc_counter-1] = round($temp_temp,1); // extrapolate dewpoint temp $temp_dewtemp = extrap_wind_spd($Tdc,$old_Tdc,$pressure_mb,$old_pressure_mb,850); $MB850_DEWTEMP[$ruc_counter-1] = round($temp_dewtemp,1); // extrapolate height $temp_height = extrap_wind_spd($height,$old_height,$pressure_mb,$old_pressure_mb,850); $MB850_HEIGHT[$ruc_counter-1] = round($temp_height); } // got 850mb } // got pressure if ($pressure_mb < 700){ if($got_700mb == 0){ $got_700mb = 1; // extrapolate wind spd $temp_spd = extrap_wind_spd($wind_spd,$old_wind_spd,$pressure_mb,$old_pressure_mb,700); // extrapolate wind dir $temp_dir = extrap_wind_dir($wind_dir,$old_wind_dir,$pressure_mb,$old_pressure_mb,700); // Store 700mb Winds $MB700_DIR[$ruc_counter-1] = $temp_dir; $MB700_SPD[$ruc_counter-1] = $temp_spd; // extrapolate temp $temp_temp = extrap_wind_spd($Tc,$old_Tc,$pressure_mb,$old_pressure_mb,700); $MB700_TEMP[$ruc_counter-1] = round($temp_temp,1); // extrapolate dewpoint temp $temp_dewtemp = extrap_wind_spd($Tdc,$old_Tdc,$pressure_mb,$old_pressure_mb,700); $MB700_DEWTEMP[$ruc_counter-1] = round($temp_dewtemp,1); // extrapolate height $temp_height = extrap_wind_spd($height,$old_height,$pressure_mb,$old_pressure_mb,700); $MB700_HEIGHT[$ruc_counter-1] = round($temp_height); // Calc 850-700mb Lapse Rate $MB850_MB700_LR[$ruc_counter-1] = round(($MB850_TEMP[$ruc_counter-1] - $MB700_TEMP[$ruc_counter-1]) / (($MB700_HEIGHT[$ruc_counter-1] - $MB850_HEIGHT[$ruc_counter-1]) / 1000),1); } // got 700mb } // got pressure if ($pressure_mb < 500){ if($got_500mb == 0){ $got_500mb = 1; // extrapolate wind spd $temp_spd = extrap_wind_spd($wind_spd,$old_wind_spd,$pressure_mb,$old_pressure_mb,500); // extrapolate wind dir $temp_dir = extrap_wind_dir($wind_dir,$old_wind_dir,$pressure_mb,$old_pressure_mb,500); // Store 500mb Winds $MB500_DIR[$ruc_counter-1] = $temp_dir; $MB500_SPD[$ruc_counter-1] = $temp_spd; // extrapolate temp $temp_temp = extrap_wind_spd($Tc,$old_Tc,$pressure_mb,$old_pressure_mb,500); $MB500_TEMP[$ruc_counter-1] = round($temp_temp,1); // extrapolate height $temp_height = extrap_wind_spd($height,$old_height,$pressure_mb,$old_pressure_mb,500); $MB500_HEIGHT[$ruc_counter-1] = round($temp_height); // Calc 850-700mb Lapse Rate $MB700_MB500_LR[$ruc_counter-1] = round(($MB700_TEMP[$ruc_counter-1] - $MB500_TEMP[$ruc_counter-1]) / (($MB500_HEIGHT[$ruc_counter-1] - $MB700_HEIGHT[$ruc_counter-1]) / 1000),1); } // got 500mb } // got pressure if ($pressure_mb < 250){ if($got_250mb == 0){ $got_250mb = 1; // extrapolate wind spd $temp_spd = extrap_wind_spd($wind_spd,$old_wind_spd,$pressure_mb,$old_pressure_mb,250); // extrapolate wind dir $temp_dir = extrap_wind_dir($wind_dir,$old_wind_dir,$pressure_mb,$old_pressure_mb,250); // Store 250mb Winds $MB250_DIR[$ruc_counter-1] = $temp_dir; $MB250_SPD[$ruc_counter-1] = $temp_spd; // extrapolate temp $temp_temp = extrap_wind_spd($Tc,$old_Tc,$pressure_mb,$old_pressure_mb,250); $MB250_TEMP[$ruc_counter-1] = round($temp_temp,1); } // got 250mb } // got pressure // Calc Thickness 850-700mb Thickness if($got_thickness_height == 0){ if ($MB850_HEIGHT[$ruc_counter-1] != 0 and $MB700_HEIGHT[$ruc_counter-1] != 0) { $MB850_MB700_THICK[$ruc_counter-1] = ($MB700_HEIGHT[$ruc_counter-1] - $MB850_HEIGHT[$ruc_counter-1]); $got_thickness_height = 1; //Calc of 1000MB Height and 1000-850mb/1000-500mb at bottom } } if($got_wbz_height == 0){ if($got_wbz == 1){ // inc=(wettemplast)/(wettemplast-wettemp) // htwbz=zz_S(i-1)+inc*(zz_S(i)-zz_S(i-1)) $inc = $old_wb_temperature / ($old_wb_temperature - $wb_temperature ); $temp = $old_pressure_mb + $inc * ($pressure_mb - $old_pressure_mb); $WBZ[$ruc_counter-1] = round(($surface_pressure_mb - $temp) * 30); $got_wbz_height = 1; } } if($height > $LCL[$ruc_counter-1]/3.28) { if($got_lcl_height == 0){ $got_lcl_height = 1; $temp = $LCL[$ruc_counter-1]/3.28; // extrapolate wind spd $temp_spd = extrap_wind_spd($wind_spd,$old_wind_spd,$height,$old_height,$temp); // extrapolate wind dir $temp_dir = extrap_wind_dir($wind_dir,$old_wind_dir,$height,$old_height,$temp); $lcl_u = get_U_comp($temp_spd,$temp_dir); $lcl_v = get_V_comp($temp_spd,$temp_dir); } // got_lcl_height } // got height if($height_AGL > 500) { if($got_upper0_5K == 0){ $got_upper0_5K = 1; // extrapolate wind spd $temp_spd = extrap_wind_spd($wind_spd,$old_wind_spd,$height_AGL,$old_height_AGL,500); // extrapolate wind dir $temp_dir = extrap_wind_dir($wind_dir,$old_wind_dir,$height_AGL,$old_height_AGL,500); // Store 0.5 km Winds $KM_0_5_DIR[$ruc_counter-1] = $temp_dir; $KM_0_5_SPD[$ruc_counter-1] = $temp_spd; } // got 0.5K } // got height if($height_AGL > 1000) { if($got_upper1K == 0){ $got_upper1K = 1; // extrapolate wind spd $temp_spd = extrap_wind_spd($wind_spd,$old_wind_spd,$height_AGL,$old_height_AGL,1000); // extrapolate wind dir $temp_dir = extrap_wind_dir($wind_dir,$old_wind_dir,$height_AGL,$old_height_AGL,1000); // calculate 1KM shear $u_1000 = get_U_comp($temp_spd,$temp_dir); $v_1000 = get_V_comp($temp_spd,$temp_dir); $a_1000_u[$ruc_counter-1] = $u_1000; $a_1000_v[$ruc_counter-1] = $v_1000; $uDiff = $u_1000 - $surf_u; $vDiff = $v_1000 - $surf_v; $shear_1KM = round(shear($uDiff,$vDiff)); if($ruc_counter <= $num_entries) $SHEAR1KM[$ruc_counter-1] = $shear_1KM; } // got upper1K } // got height if($height_AGL > 3000) { if($got_upper3K == 0){ $got_upper3K = 1; // extrapolate wind spd $temp_spd = extrap_wind_spd($wind_spd,$old_wind_spd,$height_AGL,$old_height_AGL,3000); // extrapolate wind dir $temp_dir = extrap_wind_dir($wind_dir,$old_wind_dir,$height_AGL,$old_height_AGL,3000); // calculate 3KM shear $uDiff = get_U_comp($temp_spd,$temp_dir) - $surf_u; $vDiff = get_V_comp($temp_spd,$temp_dir) - $surf_v; $shear_3KM = round(shear($uDiff,$vDiff)); if($ruc_counter <= $num_entries){ $SHEAR3KM[$ruc_counter-1] = $shear_3KM; } // extrapolate temp $temp_temp = extrap_wind_spd($Tc,$old_Tc,$height_AGL,$old_height_AGL,3000); $TEMP_3KM[$ruc_counter-1] = round($temp_temp,1); } // got upper3K } // got height if($height_AGL > 6000) { if($got_upper6K == 0){ $got_upper6K = 1; // extrapolate wind spd $temp_spd = extrap_wind_spd($wind_spd,$old_wind_spd,$height_AGL,$old_height_AGL,6000); // extrapolate wind dir $temp_dir = extrap_wind_dir($wind_dir,$old_wind_dir,$height_AGL,$old_height_AGL,6000); // calculate 6KM shear $uDiff = get_U_comp($temp_spd,$temp_dir) - $surf_u; $vDiff = get_V_comp($temp_spd,$temp_dir) - $surf_v; if($ruc_counter <= $num_entries){ $SHEAR6KM[$ruc_counter-1] = round(shear($uDiff,$vDiff)); $CravenSig[$ruc_counter-1] = round(($CAPE[$ruc_counter-1] * $SHEAR6KM[$ruc_counter-1] * 0.5148 ) / 1000,2) ; } } // got upper6K } // got height // Calc MaxTwAloft //echo "Pressure is $pressure_mb "; //echo "Height is $height "; //echo "MaxTwAloft is $MaxTwAloft "; if($height_AGL > 610 && $pressure_mb >= 400) { //echo "Pressure is $pressure_mb "; //echo "Height is $height "; //echo "WBc is $WBc "; //echo "old_WBc is $old_WBc
"; if($WBc > $MaxTwAloft) { $MaxTwAloft = $WBc; } //echo "MaxTwAloft is $MaxTwAloft
"; } // got height //echo "
"; if ($pressure_mb < 400) { $MAXTWALOFT[$ruc_counter-1] = round($MaxTwAloft,1); } // Calc MaxTAloft if($height_AGL > 610 && $pressure_mb >= 400) { if($Tc > $MaxTAloft) { $MaxTAloft = $Tc; } } // got height if ($pressure_mb < 400) { $MAXTALOFT[$ruc_counter-1] = round($MaxTAloft,1); } //Calc AF SnowRatio (MaxTAloft) //If MaxTAloft > 271.16K, Ratio = 12.0 + 2 * (271.16-MaxTAloft) //If MaxTAloft < 271.16K, Ratio = 12.0 + (271.16-MaxTAloft) if ($MAXTALOFT[$ruc_counter-1] < 4) { if ($MAXTALOFT[$ruc_counter-1] <= -1.99) { $AFSnowRatio[$ruc_counter-1] = round((12.0 + (271.16 - ($MAXTALOFT[$ruc_counter-1] + 273.15))),1); //$AFSnowRatio[$ruc_counter-1] = 1; } else { $AFSnowRatio[$ruc_counter-1] = round((12.0 + 2*(271.16 - ($MAXTALOFT[$ruc_counter-1] + 273.15))),1); //$AFSnowRatio[$ruc_counter-1] = 2; } } else { $AFSnowRatio[$ruc_counter-1] = 0; } //Calc MaxTAloft SnowRatio based off Alaska Study. //y=4E-06x^5 + 0.0004x^4 + 0.0131x^3 + 0.0586x^2 - 1.8151x + 5.9806 $MaxTAloftSnowRatio[$ruc_counter-1] = round((0.000004*pow($MaxTAloft,5))+(0.0004*pow($MaxTAloft,4))+(0.0131*pow($MaxTAloft,3))+(0.0586*pow($MaxTAloft,2))-(1.8151*$MaxTAloft)+5.9806,1); if($Tc < 0) { if($got_0CHeight == 0){ $got_0CHeight = 1; // extrapolate height $temp_height = extrap_wind_spd($height,$old_height,$Tc,$old_Tc,0); $HEIGHT_0C[$ruc_counter-1] = round((($temp_height-$STNELEV)*3.28084)/1000,1); // Calc 50DBZ Height $temp_50DBZ = ($temp_height-$STNELEV); $HEIGHT_50DBZ[$ruc_counter-1] = round((((0.00053532*(pow($temp_50DBZ,2)))-(0.573634*$temp_50DBZ)+4468.4)*3.28084)/1000,1); } // got 0C Height } // got height if($Tc < -20) { if($got_20CHeight == 0){ $got_20CHeight = 1; // extrapolate height $temp_height = extrap_wind_spd($height,$old_height,$Tc,$old_Tc,-20); $HEIGHT_20C[$ruc_counter-1] = round((($temp_height-$STNELEV)*3.28084)/1000,1); } // got -20C Height } // got height // get EBWD height from EL and LFC - close to inbound flow layer if($height > ($EL[$ruc_counter-1] / 3.28)/2) { if($got_ebwd_height == 0){ $got_ebwd_height = 1; $temp = ($EL[$ruc_counter-1] / 3.28)/2; // extrapolate wind spd $temp_spd = extrap_wind_spd($wind_spd,$old_wind_spd,$height,$old_height,$temp); // extrapolate wind dir $temp_dir = extrap_wind_dir($wind_dir,$old_wind_dir,$height,$old_height,$temp); // calculate EBWD $uDiff = get_U_comp($temp_spd,$temp_dir) - $lcl_u; $vDiff = get_V_comp($temp_spd,$temp_dir) - $lcl_v; if($ruc_counter <= $num_entries){ $EBWD[$ruc_counter-1] = round(shear($uDiff,$vDiff)); //echo $EBWD[$ruc_counter-1] . "
"; } } // got_ebwd_height } // $height > ($EL[$ruc_counter-1] / 3.28)/2 // Momentum Transfer and Mixed Layer Td Calculation - Added 6/6/2015 SRF if ($old_pressure_mb != $pressure_mb) { if ($mom_transfer == 0) { //Calculate Lapse Rate $LapseRate = (($old_Tc - $Tc) / (($height - $old_height)/1000)); if ($LapseRate > 7) { //Store Wind Speed in Direction into Array $MOMT_U[ ] = get_U_comp($wind_spd,$wind_dir); $MOMT_V[ ] = get_V_comp($wind_spd,$wind_dir); $A_ML_TDC[ ] = $Tdc; } else { // Reached the top of the mixed layer - Give the Max Momentum Wind $MIXHEIGHT[$ruc_counter-1] = round(($old_height-$STNELEV) * 3.28084); // Commented out lines below, as it did not provide much value. SRF 7/27/15 //$MIXDOWNTC = ((($old_height-$STNELEV)/1000) * 9.8) + $old_Tc; //$MIXDOWNTF = (($MIXDOWNTC * 9)/5)+32; //$MIXDOWNT[$ruc_counter-1] = round($MIXDOWNTF); $MOMT_MAX_WSPD[$ruc_counter-1] = $old_wind_spd; $MOMT_MAX_WDIR[$ruc_counter-1] = $old_wind_dir; //$ML_TDC[$ruc_counter-1] = (($old_Tdc * 9)/5)+32; if (count($MOMT_U) > 0) { //Calculate the Mean Momentum Transfer Wind $temp_MOMT_U = array_sum($MOMT_U); $temp_MOMT_V = array_sum($MOMT_V); //Grab Mean TD in Mixed Layer $temp_ML_TDC = array_sum($A_ML_TDC); //Count Values in Array $temp_MOMT_COUNT = count($MOMT_U); //Calc Average ML Values $avg_MOMT_U = $temp_MOMT_U / $temp_MOMT_COUNT; $avg_MOMT_V = $temp_MOMT_V / $temp_MOMT_COUNT; $avg_ML_TDC = $temp_ML_TDC / $temp_MOMT_COUNT; $avg_MOMT_DIR = get_wind_dir($avg_MOMT_U,$avg_MOMT_V); $avg_MOMT_SPD = round((sqrt(($avg_MOMT_U * $avg_MOMT_U) + ($avg_MOMT_V * $avg_MOMT_V))/.5148)); $MOMT_MEAN_WSPD[$ruc_counter-1] = $avg_MOMT_SPD; $MOMT_MEAN_WDIR[$ruc_counter-1] = $avg_MOMT_DIR; $ML_TDC_RAW[$ruc_counter-1] = $avg_ML_TDC; $ML_TDC[$ruc_counter-1] = round((($avg_ML_TDC * 9)/5)+32); $MOMT_U = array(); $MOMT_V = array(); $A_ML_TDC = array(); } else { //If there is no Momentum Transfer, give first model layer wind $MOMT_MEAN_WSPD[$ruc_counter-1] = $old_wind_spd; $MOMT_MEAN_WDIR[$ruc_counter-1] = $old_wind_dir; $ML_TDC_RAW[$ruc_counter-1] = $old_Tdc; $ML_TDC[$ruc_counter-1] = round((($old_Tdc * 9)/5)+32); } $mom_transfer = 1; } } } // Calculate Haines Index // // Haines Index = Stabilty Term (A) + Moisture Term (B) // A = Tp1 - Tp2 (High 700-500MB, Med 850-700, Low 950-850) // B = High (700 T-Td) or Med/Low (850 T-Td) // // Low Elevation $STABILTY_RAW[$ruc_counter-1] = $MB950_TEMP[$ruc_counter-1] - $MB850_TEMP[$ruc_counter-1]; if ($STABILTY_RAW[$ruc_counter-1] < 4) { $STABILTY_A[$ruc_counter-1] = 1; } elseif ($STABILTY_RAW[$ruc_counter-1] > 7) { $STABILTY_A[$ruc_counter-1] = 3; } else { $STABILTY_A[$ruc_counter-1] = 2; } $MOISTURE_RAW[$ruc_counter-1] = $MB850_TEMP[$ruc_counter-1] - $MB850_DEWTEMP[$ruc_counter-1]; if ($MOISTURE_RAW[$ruc_counter-1] < 6) { $MOISTURE_B[$ruc_counter-1] = 1; } elseif ($MOISTURE_RAW[$ruc_counter-1] > 9) { $MOISTURE_B[$ruc_counter-1] = 3; } else { $MOISTURE_B[$ruc_counter-1] = 2; } $HAINES_LOW[$ruc_counter-1] = $STABILTY_A[$ruc_counter-1] + $MOISTURE_B[$ruc_counter-1]; //High Elevation $STABILTY_RAW[$ruc_counter-1] = $MB700_TEMP[$ruc_counter-1] - $MB500_TEMP[$ruc_counter-1]; if ($STABILTY_RAW[$ruc_counter-1] < 18) { $STABILTY_A[$ruc_counter-1] = 1; } elseif ($STABILTY_RAW[$ruc_counter-1] > 21) { $STABILTY_A[$ruc_counter-1] = 3; } else { $STABILTY_A[$ruc_counter-1] = 2; } $MOISTURE_RAW[$ruc_counter-1] = $MB700_TEMP[$ruc_counter-1] - $MB700_DEWTEMP[$ruc_counter-1]; if ($MOISTURE_RAW[$ruc_counter-1] < 15) { $MOISTURE_B[$ruc_counter-1] = 1; } elseif ($MOISTURE_RAW[$ruc_counter-1] > 20) { $MOISTURE_B[$ruc_counter-1] = 3; } else { $MOISTURE_B[$ruc_counter-1] = 2; } $HAINES_HIGH[$ruc_counter-1] = $STABILTY_A[$ruc_counter-1] + $MOISTURE_B[$ruc_counter-1]; // Mid Elevation $STABILTY_RAW[$ruc_counter-1] = $MB850_TEMP[$ruc_counter-1] - $MB700_TEMP[$ruc_counter-1]; if ($STABILTY_RAW[$ruc_counter-1] < 6) { $STABILTY_A[$ruc_counter-1] = 1; } elseif ($STABILTY_RAW[$ruc_counter-1] > 10) { $STABILTY_A[$ruc_counter-1] = 3; } else { $STABILTY_A[$ruc_counter-1] = 2; } $MOISTURE_RAW[$ruc_counter-1] = $MB850_TEMP[$ruc_counter-1] - $MB850_DEWTEMP[$ruc_counter-1]; if ($MOISTURE_RAW[$ruc_counter-1] < 6) { $MOISTURE_B[$ruc_counter-1] = 1; } elseif ($MOISTURE_RAW[$ruc_counter-1] > 12) { $MOISTURE_B[$ruc_counter-1] = 3; } else { $MOISTURE_B[$ruc_counter-1] = 2; } $HAINES_MID[$ruc_counter-1] = $STABILTY_A[$ruc_counter-1] + $MOISTURE_B[$ruc_counter-1]; // if ($STNELEV < 305) { // $STABILTY_RAW[$ruc_counter-1] = $MB950_TEMP[$ruc_counter-1] - $MB850_TEMP[$ruc_counter-1]; // if ($STABILTY_RAW[$ruc_counter-1] < 4) { // $STABILTY_A[$ruc_counter-1] = 1; // } // elseif ($STABILTY_RAW[$ruc_counter-1] > 7) { // $STABILTY_A[$ruc_counter-1] = 3; // } // else { // $STABILTY_A[$ruc_counter-1] = 2; // } // $MOISTURE_RAW[$ruc_counter-1] = $MB850_TEMP[$ruc_counter-1] - $MB850_DEWTEMP[$ruc_counter-1]; // if ($MOISTURE_RAW[$ruc_counter-1] < 6) { // $MOISTURE_B[$ruc_counter-1] = 1; // } // elseif ($MOISTURE_RAW[$ruc_counter-1] > 9) { // $MOISTURE_B[$ruc_counter-1] = 3; // } // else { // $MOISTURE_B[$ruc_counter-1] = 2; // } // } // //High Elevation // elseif ($STNELEV > 914) { // $STABILTY_RAW[$ruc_counter-1] = $MB700_TEMP[$ruc_counter-1] - $MB500_TEMP[$ruc_counter-1]; // if ($STABILTY_RAW[$ruc_counter-1] < 18) { // $STABILTY_A[$ruc_counter-1] = 1; // } // elseif ($STABILTY_RAW[$ruc_counter-1] > 21) { // $STABILTY_A[$ruc_counter-1] = 3; // } // else { // $STABILTY_A[$ruc_counter-1] = 2; // } // $MOISTURE_RAW[$ruc_counter-1] = $MB700_TEMP[$ruc_counter-1] - $MB700_DEWTEMP[$ruc_counter-1]; // if ($MOISTURE_RAW[$ruc_counter-1] < 15) { // $MOISTURE_B[$ruc_counter-1] = 1; // } // elseif ($MOISTURE_RAW[$ruc_counter-1] > 20) { // $MOISTURE_B[$ruc_counter-1] = 3; // } // else { // $MOISTURE_B[$ruc_counter-1] = 2; // } // } // // Mid Elevation // else { // $STABILTY_RAW[$ruc_counter-1] = $MB850_TEMP[$ruc_counter-1] - $MB700_TEMP[$ruc_counter-1]; // if ($STABILTY_RAW[$ruc_counter-1] < 6) { // $STABILTY_A[$ruc_counter-1] = 1; // } // elseif ($STABILTY_RAW[$ruc_counter-1] > 10) { // $STABILTY_A[$ruc_counter-1] = 3; // } // else { // $STABILTY_A[$ruc_counter-1] = 2; // } // $MOISTURE_RAW[$ruc_counter-1] = $MB850_TEMP[$ruc_counter-1] - $MB850_DEWTEMP[$ruc_counter-1]; // if ($MOISTURE_RAW[$ruc_counter-1] < 6) { // $MOISTURE_B[$ruc_counter-1] = 1; // } // elseif ($MOISTURE_RAW[$ruc_counter-1] > 12) { // $MOISTURE_B[$ruc_counter-1] = 3; // } // else { // $MOISTURE_B[$ruc_counter-1] = 2; // } // } // $HAINES[$ruc_counter-1] = $STABILTY_A[$ruc_counter-1] + $MOISTURE_B[$ruc_counter-1]; $i = $i + 1; } $LID[$ruc_counter-1] = round(($Qsw - $Qwmax),1); } if (preg_match("/STN YYMMDD/i", $lines[$i])) { // found time line - now process rest of info if ($modelname == "GFS") { // Helicity $i = $i + 4; $ruc_counter = 0; for($k=0;$k<$num_entries;$k++){ // First grab Surface T/Td/RH $result = explode(" ",$lines[$i+2]); $TcSurf = $result[1]; $SURF_TC[$ruc_counter] = $TcSurf; $result = explode(" ",$lines[$i+3]); $TdcSurf = $result[2]; $Es= 6.11* pow(10,(7.5*$TcSurf/(237.7+$TcSurf))); $E= 6.11* pow(10,(7.5*$TdcSurf/(237.7+$TdcSurf))); $RH = ($E/$Es)*100; $SURF_RH[$ruc_counter] = round($RH); $TcSurf = (($TcSurf * 9)/5)+32; $SURF_T[$ruc_counter] = round($TcSurf); $TdcSurf = (($TdcSurf * 9)/5)+32; $SURF_TD[$ruc_counter] = round($TdcSurf); // 10M Winds $result = explode(" ",$lines[$i+1]); $TEN_M_U = $result[5]; $result = explode(" ",$lines[$i+2]); $TEN_M_V = $result[0]; $TEN_M_speed[$ruc_counter] = round((sqrt(($TEN_M_U * $TEN_M_U) + ($TEN_M_V * $TEN_M_V))/.5148)); $TEN_M_dir = get_wind_dir($TEN_M_U, $TEN_M_V); if ($TEN_M_dir < 0){ $TEN_M_dir="VRB"; } else{ $TEN_M_dir=round($TEN_M_dir); } $TEN_M_direction[$ruc_counter] = round($TEN_M_dir); // Grab MSLP and Precip Data $result = explode(" ",$lines[$i]); $MSLP = $result[2]; $MSLP_MB[$ruc_counter] = round($MSLP,1); //Calc 3hr MSLP Change if ($ruc_counter>=121) { $MSLP_CH_3HR[$ruc_counter] = round(($MSLP - $MSLP_MB[$ruc_counter-1]),1); } elseif ($ruc_counter>=3) { $MSLP_CH_3HR[$ruc_counter] = round(($MSLP - $MSLP_MB[$ruc_counter-3]),1); } else { $MSLP_CH_3HR[$ruc_counter] = "N/A"; } //Calc 6hr MSLP Change if ($ruc_counter>121) { $MSLP_CH_6HR[$ruc_counter] = round(($MSLP - $MSLP_MB[$ruc_counter-2]),1); } elseif ($ruc_counter==121) { $MSLP_CH_6HR[$ruc_counter] = round(($MSLP - $MSLP_MB[$ruc_counter-4]),1); } elseif ($ruc_counter>=6) { $MSLP_CH_6HR[$ruc_counter] = round(($MSLP - $MSLP_MB[$ruc_counter-6]),1); } else { $MSLP_CH_6HR[$ruc_counter] = "N/A"; } // Calc Apparent Temperature if ($TcSurf<=50) { $SURF_TA[$ruc_counter] = round(35.74 + (0.6215 * $TcSurf) - (35.75 * pow(($TEN_M_speed[$ruc_counter] * 1.15078),0.16)) + (0.4275 * $TcSurf * pow(($TEN_M_speed[$ruc_counter] * 1.15078),0.16))); if ($TEN_M_speed[$ruc_counter] <= 2) { $SURF_TA[$ruc_counter] = round($TcSurf); } } elseif ($TcSurf>80) { $SURF_TA[$ruc_counter] = round((-42.38) + (2.049 * $TcSurf) + (10.14 * $RH) + ((-0.2248) * $TcSurf * $RH) + ((-0.006838) * pow($TcSurf,2)) + ((-0.05482) * pow($RH,2)) + (0.001228 * pow($TcSurf,2) * $RH) + (0.0008528 * $TcSurf * pow($RH,2)) + ((-0.00000199) * pow($TcSurf,2) * pow($RH,2))); } else { $SURF_TA[$ruc_counter] = round($TcSurf); } //Calculate ML RH $ML_Es[$ruc_counter]= 6.11* pow(10,(7.5*$SURF_TC[$ruc_counter]/(237.7+$SURF_TC[$ruc_counter]))); $ML_E[$ruc_counter]= 6.11* pow(10,(7.5*$ML_TDC_RAW[$ruc_counter]/(237.7+$ML_TDC_RAW[$ruc_counter]))); $ML_RH[$ruc_counter] = round(($ML_E[$ruc_counter]/$ML_Es[$ruc_counter])*100); // Calc Thickness 1000 Height and 1000-850mb/1000-500mb Thicknesses //echo "MSLP " . $MSLP . " "; //$MB1000_HEIGHT[$ruc_counter] = ($MSLP - 1000) * 8; //echo "1000MB Height " . $MB1000_HEIGHT[$ruc_counter] . " "; //$MB1000_MB850_THICK[$ruc_counter] = round(($MB850_HEIGHT[$ruc_counter] - $MB1000_HEIGHT[$ruc_counter])); //$MB1000_MB500_THICK[$ruc_counter] = round(($MB500_HEIGHT[$ruc_counter] - $MB1000_HEIGHT[$ruc_counter])); //if ($ruc_counter == 1){ // $H1000_x = $Es * $RH; // $H1000_v = ($Tc + 273.15) / (1 - 0.379 * ($H1000_x / $pressure_mb)); // $H1000_cm = $H1000_v + 0.02774 * (1000 - $pressure_mb); // $MB1000_HEIGHT[$ruc_counter-1] = (($height * 3.28084) * 0.3048 - (67.422 * log10(1000 / $pressure_mb) * $H1000_cm) / 3.28084); // echo "1000H " . $MB1000_HEIGHT[$ruc_counter-1] . " "; //} // Calc Various Lapse Rates $SFC_MB925_LR[$ruc_counter] = round(($SURF_TC[$ruc_counter] - $MB925_TEMP[$ruc_counter]) / (($MB925_HEIGHT[$ruc_counter] - $STNELEV) / 1000),1); $SFC_MB850_LR[$ruc_counter] = round(($SURF_TC[$ruc_counter] - $MB850_TEMP[$ruc_counter]) / (($MB850_HEIGHT[$ruc_counter] - $STNELEV) / 1000),1); $SFC_3KM_LR[$ruc_counter] = round(($SURF_TC[$ruc_counter] - $TEMP_3KM[$ruc_counter]) / ((3000 - $STNELEV) / 1000),1); // Calc SHERBS3 $SHERBS3[$ruc_counter] = round((($SHEAR3KM[$ruc_counter]*0.514444)/26)*($SFC_3KM_LR[$ruc_counter] / 5.2)*($MB700_MB500_LR[$ruc_counter] / 5.6),1); //Using Hypsometric Equation - SRF 6/8/15 - Diff from Bufkit by around 2m. $result = explode(" ",$lines[$i+2]); $Q_SURF = ($result[2] / 1000); //echo "Q " . $Q_SURF . " "; $HE_Tv = (1 + (0.61 * $Q_SURF)) * ($SURF_TC[$ruc_counter] + 273.15); //echo "Tv " . $HE_Tv . " "; $MB1000_HEIGHT[$ruc_counter] = -(((287 * $HE_Tv) / 9.81) * log(1000 / $MSLP)); //echo "H " . $MB1000_HEIGHT . " "; $MB1000_MB850_THICK[$ruc_counter] = round(($MB850_HEIGHT[$ruc_counter] - $MB1000_HEIGHT[$ruc_counter])); $MB1000_MB500_THICK[$ruc_counter] = round(($MB500_HEIGHT[$ruc_counter] - $MB1000_HEIGHT[$ruc_counter])); $MB1000_MB700_THICK[$ruc_counter] = round(($MB700_HEIGHT[$ruc_counter] - $MB1000_HEIGHT[$ruc_counter])); //Thickness SnowRatio //Craven 1000-500 mb method - > 4kft // From Brian Hurley's presentation High correlation between 850-700mb - < 4kft if ($STNELEV < 1219) { $ThickSnowRatio[$ruc_counter] = round((-0.1621 * $MB850_MB700_THICK[$ruc_counter]) + 257.98,1); if ($ThickSnowRatio[$ruc_counter] < 0) { $ThickSnowRatio[$ruc_counter] = 0; } } else { //$ThickSnowRatio[$ruc_counter] = 100; if ($MB1000_MB500_THICK[$ruc_counter] > 5460 && $MB1000_MB500_THICK[$ruc_counter] <= 5490) { $ThickSnowRatio[$ruc_counter] = 2.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5400 && $MB1000_MB500_THICK[$ruc_counter] <= 5460) { $ThickSnowRatio[$ruc_counter] = 5.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5370 && $MB1000_MB500_THICK[$ruc_counter] <= 5400) { $ThickSnowRatio[$ruc_counter] = 8.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5340 && $MB1000_MB500_THICK[$ruc_counter] <= 5370) { $ThickSnowRatio[$ruc_counter] = 10.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5310 && $MB1000_MB500_THICK[$ruc_counter] <= 5340) { $ThickSnowRatio[$ruc_counter] = 12.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5280 && $MB1000_MB500_THICK[$ruc_counter] <= 5310) { $ThickSnowRatio[$ruc_counter] = 15.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5220 && $MB1000_MB500_THICK[$ruc_counter] <= 5280) { $ThickSnowRatio[$ruc_counter] = 17.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5160 && $MB1000_MB500_THICK[$ruc_counter] <= 5220) { $ThickSnowRatio[$ruc_counter] = 20.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 20 && $MB1000_MB500_THICK[$ruc_counter] <= 5160) { $ThickSnowRatio[$ruc_counter] = 25.0; } else { $ThickSnowRatio[$ruc_counter] = 0.0; } } // Set PotSnow Values // Calculations based off PoWT calculations if ($MAXTWALOFT[$ruc_counter] >= 3){ $PotSnow[$ruc_counter] = 0; } elseif ($MAXTWALOFT[$ruc_counter] <= 0){ $PotSnow[$ruc_counter]=100; } else { $PotSnow[$ruc_counter]=round((10.889*pow($MAXTWALOFT[$ruc_counter],3) - 49.041*pow($MAXTWALOFT[$ruc_counter],2) + 16.138*$MAXTWALOFT[$ruc_counter] + 99.599),0); } if ($SURF_T[$ruc_counter] > 32 && $MAXTWALOFT[$ruc_counter] > 0 && $MAXTWALOFT[$ruc_counter] < 1 && $SURF_T[$ruc_counter] < 37){ $PotSnow[$ruc_counter] = 100; } elseif ($SURF_T[$ruc_counter] > 32 && $MAXTWALOFT[$ruc_counter] >= 1){ $PotSnow[$ruc_counter] = 0; } if ( $SURF_TC[$ruc_counter] > $MAXTWALOFT[$ruc_counter] && $MAXTWALOFT[$ruc_counter] < 1 && $SURF_T[$ruc_counter] < 37){ $PotSnow[$ruc_counter] = 100; } if ( $SURF_TC[$ruc_counter] > $MAXTWALOFT[$ruc_counter] && $MAXTWALOFT[$ruc_counter] < 1 && $SURF_T[$ruc_counter] >= 37){ $PotSnow[$ruc_counter] = 0; } if ($PotSnow[$ruc_counter] > 100){ $PotSnow[$ruc_counter] = 100; } elseif ($PotSnow[$ruc_counter] < 0){ $PotSnow[$ruc_counter] = 0; } // Sleet Probability // Calculations based off PoWT calculations if ($MAXTWALOFT[$ruc_counter] > 0 && $MAXTWALOFT[$ruc_counter] < 2){ $PotSleet[$ruc_counter] = round((30.857*pow($MAXTWALOFT[$ruc_counter],2) - 12.114*$MAXTWALOFT[$ruc_counter] + 0.2286),0); } elseif ($MAXTWALOFT[$ruc_counter] >= 2 && $MAXTWALOFT[$ruc_counter] <= 3){ $PotSleet[$ruc_counter] = 100; } elseif ($MAXTWALOFT[$ruc_counter] > 3 && $MAXTWALOFT[$ruc_counter] < 4){ $PotSleet[$ruc_counter] = round((40*pow($MAXTWALOFT[$ruc_counter],2) - 380*$MAXTWALOFT[$ruc_counter] + 880),0); } if ($SURF_T[$ruc_counter] > 32 && $MAXTWALOFT[$ruc_counter] > 0 && $MAXTWALOFT[$ruc_counter] < 1 && $SURF_T[$ruc_counter] < 37){ $PotSleet[$ruc_counter] = 100; } elseif ($SURF_T[$ruc_counter] > 32 && $MAXTWALOFT[$ruc_counter] >= 1){ $PotSleet[$ruc_counter] = 0; } if ($MAXTWALOFT[$ruc_counter] <= 0){ $PotSleet[$ruc_counter] = 0; } if ($PotSleet[$ruc_counter] > 100){ $PotSleet[$ruc_counter] = 100; } elseif ($PotSleet[$ruc_counter] < 0){ $PotSleet[$ruc_counter] = 0; } // Rain Probability // Calculations based off PoWT calculations $PotRain[$ruc_counter] = 0; if ($MAXTWALOFT[$ruc_counter] > 2.4 && $MAXTWALOFT[$ruc_counter] < 4){ $PotRain[$ruc_counter] = round((6.4286*pow($MAXTWALOFT[$ruc_counter],2) - 1.7143*$MAXTWALOFT[$ruc_counter] + 1.8571),0); } elseif ($MAXTWALOFT[$ruc_counter] >= 4){ $PotRain[$ruc_counter] = 100; } if ($SURF_T[$ruc_counter] > 32 && $MAXTWALOFT[$ruc_counter] > 0 ){ $PotRain[$ruc_counter] = 100; } if ( $SURF_TC[$ruc_counter] > $MAXTWALOFT[$ruc_counter] && $MAXTWALOFT[$ruc_counter] < 0.5 && $SURF_T[$ruc_counter] > 34){ $PotRain[$ruc_counter] = 100; } if ( $SURF_TC[$ruc_counter] > $MAXTWALOFT[$ruc_counter] && $MAXTWALOFT[$ruc_counter] < 0.5 && $SURF_T[$ruc_counter] <34){ $PotRain[$ruc_counter] = 0; } if ($MAXTWALOFT[$ruc_counter] <= 0){ $PotRain[$ruc_counter] = 0; } if ($PotRain[$ruc_counter] > 100){ $PotRain[$ruc_counter] = 100; } elseif ($PotRain[$ruc_counter] < 0){ $PotRain[$ruc_counter] = 0; } //Blended SnowRatio $BlendSR[$ruc_counter] = round(($AFSnowRatio[$ruc_counter]+$MaxTAloftSnowRatio[$ruc_counter]+$ThickSnowRatio[$ruc_counter])/3,1); $result = explode(" ",$lines[$i]); $PCPN = $result[7]; if($PCPN == -9999) { $PCPN = 0; $PCPN_TOT[$ruc_counter] = 0; } $PCPN = $PCPN * 0.0393701; $PCPN_HR[$ruc_counter] = round($PCPN,2); $PCPN_TOT[$ruc_counter] = $PCPN_TOT[$ruc_counter-1] + $PCPN_HR[$ruc_counter]; //Calculate the ratio of precip that goes to Snow //Then determine hourly snowfall that goes to snow. $PCPN_SN_RATIO[$ruc_counter] = $PotSnow[$ruc_counter] / ($PotSnow[$ruc_counter] + $PotSleet[$ruc_counter] + $PotRain[$ruc_counter]); $PCPN_HR_SN[$ruc_counter] = round(($PCPN_HR[$ruc_counter] * $PCPN_SN_RATIO[$ruc_counter]),2); $PCPN_TOT_SN[$ruc_counter] = $PCPN_TOT_SN[$ruc_counter-1] + $PCPN_HR_SN[$ruc_counter]; //Snow Placeholder $SNRATIO[$ruc_counter] = "MM"; $SN1HR[$ruc_counter] = "MM"; $SN_TOT[$ruc_counter] = "MM"; //AF Snowfall Amounts $AF_SN1HR[$ruc_counter] = round(($PCPN_HR_SN[$ruc_counter]*$AFSnowRatio[$ruc_counter]),1); // * 0.0393701 $AF_SN_TOT[$ruc_counter] = $AF_SN_TOT[$ruc_counter-1] + $AF_SN1HR[$ruc_counter]; //MaxTAloft Snowfall Amounts $MaxTAloftSnowRatio_SN1HR[$ruc_counter] = round(($PCPN_HR_SN[$ruc_counter]*$MaxTAloftSnowRatio[$ruc_counter]),1); // * 0.0393701 $MaxTAloftSnowRatio_SN_TOT[$ruc_counter] = $MaxTAloftSnowRatio_SN_TOT[$ruc_counter-1] + $MaxTAloftSnowRatio_SN1HR[$ruc_counter]; //Thickness Snowfall Amounts $Thick_SN1HR[$ruc_counter] = round(($PCPN_HR_SN[$ruc_counter]*$ThickSnowRatio[$ruc_counter]),1); // * 0.0393701 $Thick_SN_TOT[$ruc_counter] = $Thick_SN_TOT[$ruc_counter-1] + $Thick_SN1HR[$ruc_counter]; //Blend Snowfall Amounts $BlendSR_SN1HR[$ruc_counter] = round(($PCPN_HR_SN[$ruc_counter]*$BlendSR[$ruc_counter]),1); $BlendSR_SN1HR_COMP[$ruc_counter] = round(($PCPN_HR_SN[$ruc_counter]*$BlendSR[$ruc_counter])*exp(((-0.08)*pow($num_entries-$ruc_counter,0.5))),1); $BlendSR_SN_TOT[$ruc_counter] = $BlendSR_SN_TOT[$ruc_counter-1] + $BlendSR_SN1HR[$ruc_counter]; $BlendSR_SN_TOT_COMP[$ruc_counter] = round(($BlendSR_SN_TOT_COMP[$ruc_counter-1] + $BlendSR_SN1HR_COMP[$ruc_counter]),1); //Model Wx Type $result = explode(" ",$lines[$i+2]); $WXSN[$ruc_counter] = $result[3]; $WXPL[$ruc_counter] = $result[4]; $WXZR[$ruc_counter] = $result[5]; $result = explode(" ",$lines[$i+3]); $WXRA[$ruc_counter] = $result[0]; //VSBY Placeholder $VSBY[$ruc_counter] = "MM"; // Grab Cloud Data $result = explode(" ",$lines[$i+1]); $LCLD[$ruc_counter] = round($result[2]); $MCLD[$ruc_counter] = round($result[3]); $HCLD[$ruc_counter] = round($result[4]); //Grab rest of data //$result = explode(" ",$lines[$i]); //$ustm = $result[5]; //$result = explode(" ",$lines[$i+1]); //$vstm = $result[0]; //$storm_speed = round((sqrt(($ustm * $ustm) + ($vstm * $vstm))/.5148)); // calculate storm direction //if( $vstm > 0) // $ANG = 180; //elseif ( ($ustm < 0) && ($vstm < 0)) // $ANG = 0; //elseif ( ($ustm > 0) && ($vstm < 0)) // $ANG = 360; //if($vstm == 0) // $vstm = .00000001; //$storm_direction = (180 / pi()) * atan($ustm / $vstm) + $ANG; //$storm_direction = round($storm_direction); //$STMOTION[$ruc_counter] = $storm_direction . ' at ' . $storm_speed; $STMOTION[$ruc_counter] = 'MMM at MM'; // 0 -1KM Helicity for STP parameter // grab data for 1K helicity //echo "Surf u - " . $a_surf_u[$ruc_counter] . " Surf v - " . $a_surf_v[$ruc_counter] . "
"; //echo "1000 u - " . $a_1000_u[$ruc_counter] . " 1000 v - " . $a_1000_v[$ruc_counter] . "
"; //$uDelta[$ruc_counter] = $a_1000_u[$ruc_counter] - $a_surf_u[$ruc_counter]; //$vDelta[$ruc_counter] = $a_1000_v[$ruc_counter] - $a_surf_v[$ruc_counter]; //echo " uDelta - " . $uDelta[$ruc_counter]; //echo " vDelta - " . $vDelta[$ruc_counter] . "
"; //$uMean[$ruc_counter] = ($a_1000_u[$ruc_counter] + $a_surf_u[$ruc_counter]) / 2; //$vMean[$ruc_counter] = ($a_1000_v[$ruc_counter] + $a_surf_v[$ruc_counter]) / 2; ////echo "uMean - " . $uMean[$ruc_counter]; ////echo " vMean - " . $vMean[$ruc_counter] . "

"; //$uDiff = $ustm; // get_U_comp($storm_speed, $storm_direction); //$vDiff = $vstm; //get_V_comp($storm_speed, $storm_direction); ////echo "Storm u - " . $uDiff . "
"; ////echo "Storm v - " . $vDiff . "
"; //$Usr = $uMean[$ruc_counter] - $uDiff; //$Vsr = $vMean[$ruc_counter] - $vDiff; ////echo " Usr " . $Usr . "
"; ////echo " Vsr " . $Vsr . "

"; ////echo "( " . $Vsr . " * " . $uDelta[$ruc_counter] . ") - (" . $Usr . " * " . $vDelta[$ruc_counter] . ")

"; //$HLCY1K[$ruc_counter] = round(($Vsr* $uDelta[$ruc_counter]) - ($Usr*$vDelta[$ruc_counter]),2); $HLCY1K[$ruc_counter] = "MM"; ////echo $HLCY1K[$ruc_counter] . "


"; // get HELICITY //$SRH[$ruc_counter] = round($result[1],1); $SRH[$ruc_counter] = "MM"; // now we have helicity and cape, compute EHI //$EHI[$ruc_counter] = round(($CAPE[$ruc_counter] * $SRH[$ruc_counter])/160000,2); $EHI[$ruc_counter] = "MM"; //if($EHI[$ruc_counter] == -0) // $EHI[$ruc_counter] = 0; // now calculate SCP // shear is in knots - convert to m/s by * by .5148 //$SCP[$ruc_counter] = ($CAPE[$ruc_counter]/1000) * ($SRH[$ruc_counter]/50) ; $SCP[$ruc_counter] = "MM" ; ////echo $EBWD[$ruc_counter] . "
"; //$EBWD[$ruc_counter] = $EBWD[$ruc_counter] *.5148; // convert to m/s $EBWD[$ruc_counter] = "MM"; // convert to m/s //if($EBWD[$ruc_counter] < 10) // $EBWD[$ruc_counter] = 0; //elseif ($EBWD[$ruc_counter] > 20) // $EBWD[$ruc_counter] = 1; //else // $EBWD[$ruc_counter] = $EBWD[$ruc_counter] /20; //$SCP[$ruc_counter] = round($SCP[$ruc_counter] * $EBWD[$ruc_counter],1); $SCP[$ruc_counter] = "MM"; //if($SCP[$ruc_counter] == -0) // $SCP[$ruc_counter] = 0; //$STP[$ruc_counter] = $CAPE[$ruc_counter]/1000 * ($HLCY1K[$ruc_counter]/100) * ((2000 - ($LCL[$ruc_counter]/3.28))/1500) * $EBWD[$ruc_counter]; $STP[$ruc_counter] = "MM"; //$STP[$ruc_counter] = round($STP[$ruc_counter],1); //if($STP[$ruc_counter] == -0) // $STP[$ruc_counter] = 0; $ruc_counter = $ruc_counter +1; $i = $i + 4; } } else { //1 hour Models // Helicity $i = $i + 9; $ruc_counter = 0; for($k=0;$k<$num_entries;$k++){ // First grab Surface T/Td/RH/Wind $result = explode(" ",$lines[$i-1]); $TcSurf = $result[5]; $SURF_TC[$ruc_counter] = $TcSurf; // 10M Winds $TEN_M_U = $result[1]; $TEN_M_V = $result[2]; $TEN_M_speed[$ruc_counter] = round((sqrt(($TEN_M_U * $TEN_M_U) + ($TEN_M_V * $TEN_M_V))/.5148)); $TEN_M_dir = get_wind_dir($TEN_M_U, $TEN_M_V); if ($TEN_M_dir < 0){ $TEN_M_dir="VRB"; } else{ $TEN_M_dir=round($TEN_M_dir); } $TEN_M_direction[$ruc_counter] = $TEN_M_dir; $result = explode(" ",$lines[$i+2]); $TdcSurf = $result[0]; $Es= 6.11* pow(10,(7.5*$TcSurf/(237.7+$TcSurf))); $E= 6.11* pow(10,(7.5*$TdcSurf/(237.7+$TdcSurf))); $RH = ($E/$Es)*100; $SURF_RH[$ruc_counter] = round($RH); $TcSurf = (($TcSurf * 9)/5)+32; $SURF_T[$ruc_counter] = round($TcSurf); $TdcSurf = (($TdcSurf * 9)/5)+32; $SURF_TD[$ruc_counter] = round($TdcSurf); // Grab MSLP and Precip Data $result = explode(" ",$lines[$i-3]); $MSLP = $result[2]; $MSLP_MB[$ruc_counter] = round($MSLP,1); //Calc 3hr MSLP Change if ($ruc_counter>=3) { $MSLP_CH_3HR[$ruc_counter] = round(($MSLP - $MSLP_MB[$ruc_counter-3]),1); } else { $MSLP_CH_3HR[$ruc_counter] = "N/A"; } // Calc 6hr MSLP Change if ($ruc_counter>=6) { $MSLP_CH_6HR[$ruc_counter] = round(($MSLP - $MSLP_MB[$ruc_counter-6]),1); } else { $MSLP_CH_6HR[$ruc_counter] = "N/A"; } // Calc Apparent Temperature if ($TcSurf<=50) { $SURF_TA[$ruc_counter] = round(35.74 + (0.6215 * $TcSurf) - (35.75 * pow(($TEN_M_speed[$ruc_counter] * 1.15078),0.16)) + (0.4275 * $TcSurf * pow(($TEN_M_speed[$ruc_counter] * 1.15078),0.16))); if ($TEN_M_speed[$ruc_counter] <= 2) { $SURF_TA[$ruc_counter] = round($TcSurf); } } elseif ($TcSurf>80) { $SURF_TA[$ruc_counter] = round((-42.38) + (2.049 * $TcSurf) + (10.14 * $RH) + ((-0.2248) * $TcSurf * $RH) + ((-0.006838) * pow($TcSurf,2)) + ((-0.05482) * pow($RH,2)) + (0.001228 * pow($TcSurf,2) * $RH) + (0.0008528 * $TcSurf * pow($RH,2)) + ((-0.00000199) * pow($TcSurf,2) * pow($RH,2))); } else { $SURF_TA[$ruc_counter] = round($TcSurf); } //Calculate ML RH $ML_Es[$ruc_counter]= 6.11* pow(10,(7.5*$SURF_TC[$ruc_counter]/(237.7+$SURF_TC[$ruc_counter]))); $ML_E[$ruc_counter]= 6.11* pow(10,(7.5*$ML_TDC_RAW[$ruc_counter]/(237.7+$ML_TDC_RAW[$ruc_counter]))); $ML_RH[$ruc_counter] = round(($ML_E[$ruc_counter]/$ML_Es[$ruc_counter])*100); // Calc Thickness 1000 Height and 1000-850mb/1000-500mb Thicknesses // Basic Assumption - Diff from Bufkit by 6m //echo "MSLP " . $MSLP . " "; //$MB1000_HEIGHT[$ruc_counter] = ($MSLP - 1000) * 8.0; //echo "1000MB Height " . $MB1000_HEIGHT[$ruc_counter] . " "; //$MB1000_MB850_THICK[$ruc_counter] = round(($MB850_HEIGHT[$ruc_counter] - $MB1000_HEIGHT[$ruc_counter])); //$MB1000_MB500_THICK[$ruc_counter] = round(($MB500_HEIGHT[$ruc_counter] - $MB1000_HEIGHT[$ruc_counter])); //if ($ruc_counter == 1){ //$H1000_x = $Es * $RH; //$H1000_v = ($SURF_TC[$ruc_counter] + 273.15) / (1 - 0.379 * ($H1000_x / $MSLP)); //$H1000_cm = $H1000_v + 0.02774 * (1000 - $MSLP); //$MB1000_HEIGHT[$ruc_counter-1] = ($STNELEV_FT * 0.3048 - (67.422 * log10(1000 / $MSLP) * $H1000_cm)); //$MB1000_HEIGHT_SFC = $MB1000_HEIGHT[$ruc_counter-1] - $STNELEV; //echo "1000H " . $MB1000_HEIGHT_SFC . " "; //} // Calc Various Lapse Rates $SFC_MB925_LR[$ruc_counter] = round(($SURF_TC[$ruc_counter] - $MB925_TEMP[$ruc_counter]) / (($MB925_HEIGHT[$ruc_counter] - $STNELEV) / 1000),1); $SFC_MB850_LR[$ruc_counter] = round(($SURF_TC[$ruc_counter] - $MB850_TEMP[$ruc_counter]) / (($MB850_HEIGHT[$ruc_counter] - $STNELEV) / 1000),1); $SFC_3KM_LR[$ruc_counter] = round(($SURF_TC[$ruc_counter] - $TEMP_3KM[$ruc_counter]) / ((3000 - $STNELEV) / 1000),1); // Calc SHERBS3 $SHERBS3[$ruc_counter] = round((($SHEAR3KM[$ruc_counter]*0.514444)/26)*($SFC_3KM_LR[$ruc_counter] / 5.2)*($MB700_MB500_LR[$ruc_counter] / 5.6),1); //Using Hypsometric Equation - SRF 6/8/15 - Diff from Bufkit by around 2m. $result = explode(" ",$lines[$i]); $Q_SURF = ($result[0] / 1000); //echo "Q " . $Q_SURF . " "; $HE_Tv = (1 + (0.61 * $Q_SURF)) * ($SURF_TC[$ruc_counter] + 273.15); //echo "Tv " . $HE_Tv . " "; $MB1000_HEIGHT[$ruc_counter] = -(((287 * $HE_Tv) / 9.81) * log(1000 / $MSLP)); //echo "H " . $MB1000_HEIGHT . " "; $MB1000_MB850_THICK[$ruc_counter] = round(($MB850_HEIGHT[$ruc_counter] - $MB1000_HEIGHT[$ruc_counter])); $MB1000_MB500_THICK[$ruc_counter] = round(($MB500_HEIGHT[$ruc_counter] - $MB1000_HEIGHT[$ruc_counter])); $MB1000_MB700_THICK[$ruc_counter] = round(($MB700_HEIGHT[$ruc_counter] - $MB1000_HEIGHT[$ruc_counter])); // End Thickness Calc //Thickness SnowRatio //Craven 1000-500 mb method - > 4kft // From Brian Hurley's presentation High correlation between 850-700mb - < 4kft if ($STNELEV < 1219) { $ThickSnowRatio[$ruc_counter] = round((-0.1621 * $MB850_MB700_THICK[$ruc_counter]) + 257.98,1); if ($ThickSnowRatio[$ruc_counter] < 0) { $ThickSnowRatio[$ruc_counter] = 0; } } else { //$ThickSnowRatio[$ruc_counter] = 100; if ($MB1000_MB500_THICK[$ruc_counter] > 5460 && $MB1000_MB500_THICK[$ruc_counter] <= 5490) { $ThickSnowRatio[$ruc_counter] = 2.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5400 && $MB1000_MB500_THICK[$ruc_counter] <= 5460) { $ThickSnowRatio[$ruc_counter] = 5.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5370 && $MB1000_MB500_THICK[$ruc_counter] <= 5400) { $ThickSnowRatio[$ruc_counter] = 8.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5340 && $MB1000_MB500_THICK[$ruc_counter] <= 5370) { $ThickSnowRatio[$ruc_counter] = 10.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5310 && $MB1000_MB500_THICK[$ruc_counter] <= 5340) { $ThickSnowRatio[$ruc_counter] = 12.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5280 && $MB1000_MB500_THICK[$ruc_counter] <= 5310) { $ThickSnowRatio[$ruc_counter] = 15.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5220 && $MB1000_MB500_THICK[$ruc_counter] <= 5280) { $ThickSnowRatio[$ruc_counter] = 17.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 5160 && $MB1000_MB500_THICK[$ruc_counter] <= 5220) { $ThickSnowRatio[$ruc_counter] = 20.0; } elseif ($MB1000_MB500_THICK[$ruc_counter] > 20 && $MB1000_MB500_THICK[$ruc_counter] <= 5160) { $ThickSnowRatio[$ruc_counter] = 25.0; } else { $ThickSnowRatio[$ruc_counter] = 0.0; } } //Blended SnowRatio $BlendSR[$ruc_counter] = round(($AFSnowRatio[$ruc_counter]+$MaxTAloftSnowRatio[$ruc_counter]+$ThickSnowRatio[$ruc_counter])/3,1); // Set PotSnow Values // Calculations based off PoWT calculations if ($MAXTWALOFT[$ruc_counter] >= 3){ $PotSnow[$ruc_counter] = 0; } elseif ($MAXTWALOFT[$ruc_counter] <= 0){ $PotSnow[$ruc_counter]=100; } else { $PotSnow[$ruc_counter]=round((10.889*pow($MAXTWALOFT[$ruc_counter],3) - 49.041*pow($MAXTWALOFT[$ruc_counter],2) + 16.138*$MAXTWALOFT[$ruc_counter] + 99.599),0); } if ($SURF_T[$ruc_counter] > 32 && $MAXTWALOFT[$ruc_counter] > 0 && $MAXTWALOFT[$ruc_counter] < 1 && $SURF_T[$ruc_counter] < 37){ $PotSnow[$ruc_counter] = 100; } elseif ($SURF_T[$ruc_counter] > 32 && $MAXTWALOFT[$ruc_counter] >= 1){ $PotSnow[$ruc_counter] = 0; } if ( $SURF_TC[$ruc_counter] > $MAXTWALOFT[$ruc_counter] && $MAXTWALOFT[$ruc_counter] < 1 && $SURF_T[$ruc_counter] < 37){ $PotSnow[$ruc_counter] = 100; } if ( $SURF_TC[$ruc_counter] > $MAXTWALOFT[$ruc_counter] && $MAXTWALOFT[$ruc_counter] < 1 && $SURF_T[$ruc_counter] >= 37){ $PotSnow[$ruc_counter] = 0; } if ($PotSnow[$ruc_counter] > 100){ $PotSnow[$ruc_counter] = 100; } elseif ($PotSnow[$ruc_counter] < 0){ $PotSnow[$ruc_counter] = 0; } // Sleet Probability // Calculations based off PoWT calculations if ($MAXTWALOFT[$ruc_counter] > 0 && $MAXTWALOFT[$ruc_counter] < 2){ $PotSleet[$ruc_counter] = round((30.857*pow($MAXTWALOFT[$ruc_counter],2) - 12.114*$MAXTWALOFT[$ruc_counter] + 0.2286),0); } elseif ($MAXTWALOFT[$ruc_counter] >= 2 && $MAXTWALOFT[$ruc_counter] <= 3){ $PotSleet[$ruc_counter] = 100; } elseif ($MAXTWALOFT[$ruc_counter] > 3 && $MAXTWALOFT[$ruc_counter] < 4){ $PotSleet[$ruc_counter] = round((40*pow($MAXTWALOFT[$ruc_counter],2) - 380*$MAXTWALOFT[$ruc_counter] + 880),0); } if ($SURF_T[$ruc_counter] > 32 && $MAXTWALOFT[$ruc_counter] > 0 && $MAXTWALOFT[$ruc_counter] < 1 && $SURF_T[$ruc_counter] < 37){ $PotSleet[$ruc_counter] = 100; } elseif ($SURF_T[$ruc_counter] > 32 && $MAXTWALOFT[$ruc_counter] >= 1){ $PotSleet[$ruc_counter] = 0; } if ($MAXTWALOFT[$ruc_counter] <= 0){ $PotSleet[$ruc_counter] = 0; } if ($PotSleet[$ruc_counter] > 100){ $PotSleet[$ruc_counter] = 100; } elseif ($PotSleet[$ruc_counter] < 0){ $PotSleet[$ruc_counter] = 0; } // Rain Probability // Calculations based off PoWT calculations $PotRain[$ruc_counter] = 0; if ($MAXTWALOFT[$ruc_counter] > 2.4 && $MAXTWALOFT[$ruc_counter] < 4){ $PotRain[$ruc_counter] = round((6.4286*pow($MAXTWALOFT[$ruc_counter],2) - 1.7143*$MAXTWALOFT[$ruc_counter] + 1.8571),0); } elseif ($MAXTWALOFT[$ruc_counter] >= 4){ $PotRain[$ruc_counter] = 100; } if ($SURF_T[$ruc_counter] > 32 && $MAXTWALOFT[$ruc_counter] > 0 ){ $PotRain[$ruc_counter] = 100; } if ( $SURF_TC[$ruc_counter] > $MAXTWALOFT[$ruc_counter] && $MAXTWALOFT[$ruc_counter] < 0.5 && $SURF_T[$ruc_counter] > 34){ $PotRain[$ruc_counter] = 100; } if ( $SURF_TC[$ruc_counter] > $MAXTWALOFT[$ruc_counter] && $MAXTWALOFT[$ruc_counter] < 0.5 && $SURF_T[$ruc_counter] <34){ $PotRain[$ruc_counter] = 0; } if ($MAXTWALOFT[$ruc_counter] <= 0){ $PotRain[$ruc_counter] = 0; } if ($PotRain[$ruc_counter] > 100){ $PotRain[$ruc_counter] = 100; } elseif ($PotRain[$ruc_counter] < 0){ $PotRain[$ruc_counter] = 0; } $result = explode(" ",$lines[$i-2]); $PCPN = $result[0]; if($PCPN == -9999) { $PCPN = 0; $PCPN_TOT[$ruc_counter] = 0; } $PCPN = $PCPN * 0.0393701; $PCPN_HR[$ruc_counter] = round($PCPN,2); $PCPN_TOT[$ruc_counter] = $PCPN_TOT[$ruc_counter-1] + $PCPN_HR[$ruc_counter]; //Calculate the ratio of precip that goes to Snow //Then determine hourly snowfall that goes to snow. $PCPN_SN_RATIO[$ruc_counter] = $PotSnow[$ruc_counter] / ($PotSnow[$ruc_counter] + $PotSleet[$ruc_counter] + $PotRain[$ruc_counter]); $PCPN_HR_SN[$ruc_counter] = round(($PCPN_HR[$ruc_counter] * $PCPN_SN_RATIO[$ruc_counter]),2); $PCPN_TOT_SN[$ruc_counter] = $PCPN_TOT_SN[$ruc_counter-1] + $PCPN_HR_SN[$ruc_counter]; //Grab Winter Surface Data //SnowRatio % $result = explode(" ",$lines[$i-1]); $SNRATIO[$ruc_counter] = round($result[0],1); //1hr Snowfall $result = explode(" ",$lines[$i-3]); if ($result[6] > -9999) { if ($modelname == "RAP" OR $modelname == "HRRR") { //$SN1HR[$ruc_counter] = round(($result[6] * 0.00393701),1); } $SN1HR[$ruc_counter] = "MM";} else { $SN1HR[$ruc_counter] = round(($result[6]),1); }// * 0.0393701 $SN_TOT[$ruc_counter] = $SN_TOT[$ruc_counter-1] + $SN1HR[$ruc_counter]; } else { $SN1HR[$ruc_counter] = "MM"; $SN_TOT[$ruc_counter] = 0; } //AF Snowfall Amounts $AF_SN1HR[$ruc_counter] = round(($PCPN_HR_SN[$ruc_counter]*$AFSnowRatio[$ruc_counter]),1); // * 0.0393701 $AF_SN_TOT[$ruc_counter] = $AF_SN_TOT[$ruc_counter-1] + $AF_SN1HR[$ruc_counter]; //MaxTAloft Snowfall Amounts $MaxTAloftSnowRatio_SN1HR[$ruc_counter] = round(($PCPN_HR_SN[$ruc_counter]*$MaxTAloftSnowRatio[$ruc_counter]),1); // * 0.0393701 $MaxTAloftSnowRatio_SN_TOT[$ruc_counter] = $MaxTAloftSnowRatio_SN_TOT[$ruc_counter-1] + $MaxTAloftSnowRatio_SN1HR[$ruc_counter]; //Thickness Snowfall Amounts $Thick_SN1HR[$ruc_counter] = round(($PCPN_HR_SN[$ruc_counter]*$ThickSnowRatio[$ruc_counter]),1); // * 0.0393701 $Thick_SN_TOT[$ruc_counter] = $Thick_SN_TOT[$ruc_counter-1] + $Thick_SN1HR[$ruc_counter]; //Blend Snowfall Amounts $BlendSR_SN1HR[$ruc_counter] = round(($PCPN_HR_SN[$ruc_counter]*$BlendSR[$ruc_counter]),1); $BlendSR_SN1HR_COMP[$ruc_counter] = round(($PCPN_HR_SN[$ruc_counter]*$BlendSR[$ruc_counter]),1); $BlendSR_SN_TOT[$ruc_counter] = $BlendSR_SN_TOT[$ruc_counter-1] + $BlendSR_SN1HR[$ruc_counter]; $BlendSR_SN_TOT_COMP[$ruc_counter] = $BlendSR_SN_TOT_COMP[$ruc_counter-1] + $BlendSR_SN1HR_COMP[$ruc_counter]; //Model Wx Type $result = explode(" ",$lines[$i]); $WXSN[$ruc_counter] = $result[1]; $WXPL[$ruc_counter] = $result[2]; $WXZR[$ruc_counter] = $result[3]; $WXRA[$ruc_counter] = $result[4]; //Grab VSBY Data $result = explode(" ",$lines[$i+1]); $VSBY[$ruc_counter] = $result[5]; // Grab Cloud Data $result = explode(" ",$lines[$i-2]); $LCLD[$ruc_counter] = round($result[3]); $MCLD[$ruc_counter] = round($result[4]); $HCLD[$ruc_counter] = round($result[5]); //Grab rest of data $result = explode(" ",$lines[$i]); $ustm = $result[5]; $result = explode(" ",$lines[$i+1]); $vstm = $result[0]; $storm_speed = round((sqrt(($ustm * $ustm) + ($vstm * $vstm))/.5148)); // calculate storm direction if( $vstm > 0) $ANG = 180; elseif ( ($ustm < 0) && ($vstm < 0)) $ANG = 0; elseif ( ($ustm > 0) && ($vstm < 0)) $ANG = 360; if($vstm == 0) $vstm = .00000001; $storm_direction = (180 / pi()) * atan($ustm / $vstm) + $ANG; $storm_direction = round($storm_direction); $STMOTION[$ruc_counter] = $storm_direction . ' at ' . $storm_speed; $STMOTION_DIR[$ruc_counter] = $storm_direction; $STMOTION_SPD[$ruc_counter] = $storm_speed; // 0 -1KM Helicity for STP parameter // grab data for 1K helicity //echo "Surf u - " . $a_surf_u[$ruc_counter] . " Surf v - " . $a_surf_v[$ruc_counter] . "
"; //echo "1000 u - " . $a_1000_u[$ruc_counter] . " 1000 v - " . $a_1000_v[$ruc_counter] . "
"; $uDelta[$ruc_counter] = $a_1000_u[$ruc_counter] - $a_surf_u[$ruc_counter]; $vDelta[$ruc_counter] = $a_1000_v[$ruc_counter] - $a_surf_v[$ruc_counter]; //echo " uDelta - " . $uDelta[$ruc_counter]; //echo " vDelta - " . $vDelta[$ruc_counter] . "
"; $uMean[$ruc_counter] = ($a_1000_u[$ruc_counter] + $a_surf_u[$ruc_counter]) / 2; $vMean[$ruc_counter] = ($a_1000_v[$ruc_counter] + $a_surf_v[$ruc_counter]) / 2; //echo "uMean - " . $uMean[$ruc_counter]; //echo " vMean - " . $vMean[$ruc_counter] . "

"; $uDiff = $ustm; // get_U_comp($storm_speed, $storm_direction); $vDiff = $vstm; //get_V_comp($storm_speed, $storm_direction); //echo "Storm u - " . $uDiff . "
"; //echo "Storm v - " . $vDiff . "
"; $Usr = $uMean[$ruc_counter] - $uDiff; $Vsr = $vMean[$ruc_counter] - $vDiff; //echo " Usr " . $Usr . "
"; //echo " Vsr " . $Vsr . "

"; //echo "( " . $Vsr . " * " . $uDelta[$ruc_counter] . ") - (" . $Usr . " * " . $vDelta[$ruc_counter] . ")

"; $HLCY1K[$ruc_counter] = round(($Vsr* $uDelta[$ruc_counter]) - ($Usr*$vDelta[$ruc_counter]),2); //echo $HLCY1K[$ruc_counter] . "


"; // get HELICITY $SRH[$ruc_counter] = round($result[1],1); // now we have helicity and cape, compute EHI $EHI[$ruc_counter] = round(($CAPE[$ruc_counter] * $SRH[$ruc_counter])/160000,2); if($EHI[$ruc_counter] == -0) $EHI[$ruc_counter] = 0; // now calculate SCP // shear is in knots - convert to m/s by * by .5148 $SCP[$ruc_counter] = ($CAPE[$ruc_counter]/1000) * ($SRH[$ruc_counter]/50) ; //echo $EBWD[$ruc_counter] . "
"; $EBWD[$ruc_counter] = $EBWD[$ruc_counter] *.5148; // convert to m/s if($EBWD[$ruc_counter] < 10) $EBWD[$ruc_counter] = 0; elseif ($EBWD[$ruc_counter] > 20) $EBWD[$ruc_counter] = 1; else $EBWD[$ruc_counter] = $EBWD[$ruc_counter] /20; $SCP[$ruc_counter] = round($SCP[$ruc_counter] * $EBWD[$ruc_counter],1); if($SCP[$ruc_counter] == -0) $SCP[$ruc_counter] = 0; $STP[$ruc_counter] = $CAPE[$ruc_counter]/1000 * ($HLCY1K[$ruc_counter]/100) * ((2000 - ($LCL[$ruc_counter]/3.28))/1500) * $EBWD[$ruc_counter]; $STP[$ruc_counter] = round($STP[$ruc_counter],1); if($STP[$ruc_counter] == -0) $STP[$ruc_counter] = 0; $ruc_counter = $ruc_counter +1; $i = $i + 6; } } } $i++; endwhile; //------------------------------------------------------------------------------------------ function fetchUrlWithoutHanging($url,$cacheurl) { global $Status; // Set maximum number of seconds (can have floating-point) to wait for feed before displaying page without feed $numberOfSeconds=10; // Suppress error reporting so Web site visitors are unaware if the feed fails error_reporting(0); // Extract resource path and domain from URL ready for fsockopen $url = str_replace("http://","",$url); $urlComponents = explode("/",$url); $domain = $urlComponents[0]; $resourcePath = str_replace($domain,"",$url); // Establish a connection $socketConnection = fsockopen($domain, 21, $errno, $errstr, $numberOfSeconds); if (!$socketConnection) { $Status .= ""; $html = implode('', file($cacheurl)); return($html); // You may wish to remove the following debugging line on a live Web site } // end if else { $xml = ''; fputs($socketConnection, "GET $resourcePath HTTP/1.0\r\nHost: $domain\r\nCache-Control: no-cache, must-revalidate\r\nCache-control: max-age=0\r\n\r\n"); // Loop until end of file while (!feof($socketConnection)) { $xml .= fgets($socketConnection, 8192); } // end while fclose ($socketConnection); } // end else return($xml); } // end fetchUrlWithoutHanging function //------------------------------------------------------------------------------------------ // Create CSV file for Graphs // //Initial array // $csvarray = array(); // for($j=0;$j<$num_entries;$j++){ // $csvarray [] = $REPORT_DAY[$j] . " " . $REPORT_TIME[$j]; // } //Header info //$csvheader = array("Date-Time","T"); //$header=null; //Start combining features that we want to grab // $csvarray = array_combine($csvarray,$SURF_T); //Export CSV of array // $csvfile = fopen("modeldata/".$rapstation."-".$modelname.".csv","w"); //Export array examples: https://stackoverflow.com/questions/45896610/send-array-keys-and-values-to-csv-using-php //fputcsv($csvfile, array_keys($csvarray['0'])); // foreach($csvarray as $csvvalues){ // fputcsv($csvfile, $csvvalues); // } // fclose($csvfile); //Initial array $csvarray = array(); for($j=0;$j<$num_entries;$j++){ $csvdatearray [] = $REPORT_DAY[$j] . " " . $REPORT_TIME[$j]; //$csvdatearray [] = mktime($MODEL_RUN_HOUR[$j],0,0,$REPORT_MONTH[$j],$REPORT_DAY_MONTH[$j],$REPORT_YEAR[$j]); } //$csvarray=array($csvdatearray,$SURF_T); $csvfile = fopen("modeldata/".$rapstation."-".$modelname.".csv","w"); // save the column headers fputcsv($csvfile, array('Date', 'Temp', 'Dew', 'PcpnHR', 'PcpnTot','PWAT', 'MSLP', '850T','MaxTwAloft','Cape','0-6kmShear','CravenSigSvr','BlendSLR','BlendSLRTotalSN','10mWindDir','10mWindSpeed','MeanMomTrans','MaxMomTrans','RH','MLRH','925T','700T','500T')); //Add the array values foreach ($csvdatearray as $key => $value) { fputcsv($csvfile, array($value, $SURF_T[$key], $SURF_TD[$key], $PCPN_HR[$key], $PCPN_TOT[$key], $PWAT[$key], $MSLP_MB[$key],$MB850_TEMP[$key],$MAXTWALOFT[$key],$CAPE[$key],$SHEAR6KM[$key],$CravenSig[$key],$BlendSR[$key],$BlendSR_SN_TOT[$key],$TEN_M_direction[$key],$TEN_M_speed[$key],$MOMT_MEAN_WSPD[$key],$MOMT_MAX_WSPD[$key],$SURF_RH[$key],$ML_RH[$key],$MB925_TEMP[$key],$MB700_TEMP[$key],$MB500_TEMP[$key])); } fclose($csvfile); //print_r($csvarray); ?>
LATEST MODEL RUN FOR
SOUNDING STATION (Choose BUFKIT site) : size="4" style="width: 40px">  Model:  
" . $REPORT_DAY_WEEK[$j] . ''; } ?> " . $REPORT_DAY[$j] . ''; } ?> '; // Pivotal Weather Sounding echo "'; } elseif (($modelname == "NAMNEST") AND in_array($REPORT_TIME_RAW[$j], $Sounding3hr) AND ($j <=60)) { // Twisterdata Sounding // echo "'; // Pivotal Weather Sounding echo "'; } elseif ($modelname == "RAP" OR $modelname == "HRRR") { // Twisterdata Sounding // echo "'; // Pivotal Weather Sounding echo "'; } elseif (($modelname == "GFS") AND ($j <= 48) AND in_array($REPORT_TIME_RAW[$j], $Sounding3hr)) { // Twisterdata Sounding // echo "'; // Pivotal Weather Sounding echo "'; } elseif (($modelname == "GFS") AND ($j > 48) AND ($j <= 120) AND in_array($REPORT_TIME_RAW[$j], $Sounding6hr)) { // Twisterdata Sounding // echo "'; // Pivotal Weather Sounding echo "'; } elseif (($modelname == "GFS") AND ($j > 120) AND in_array($REPORT_TIME_RAW[$j], $Sounding6hr)) { // Twisterdata Sounding // echo "'; // Pivotal Weather Sounding echo "'; } else { echo "'; } } ?> -----"; } ?> = 90){ echo "'; } elseif ($SURF_T[$j] >= 80){ echo "'; } elseif ($SURF_T[$j] >= 70){ echo "'; } elseif ($SURF_T[$j] >= 40){ echo "'; } elseif ($SURF_T[$j] >= 33){ echo "'; } elseif ($SURF_T[$j] >= 28){ echo "'; } elseif ($SURF_T[$j] > 0){ echo "'; } else echo "'; } ?> = 105){ echo "'; } elseif ($SURF_TA[$j] >= 100){ echo "'; } elseif ($SURF_TA[$j] >= 95){ echo "'; } elseif ($SURF_TA[$j] >= 10){ echo "'; } elseif ($SURF_TA[$j] >= 0){ echo "'; } elseif ($SURF_TA[$j] > -25){ echo "'; } elseif ($SURF_TA[$j] > -35){ echo "'; } else echo "'; } ?> = 70){ echo "'; } elseif ($SURF_TD[$j] >= 60){ echo "'; } elseif ($SURF_TD[$j] >= 50){ echo "'; } else echo "'; } ?> = 70){ echo "'; } elseif ($ML_TDC[$j] >= 60){ echo "'; } elseif ($ML_TDC[$j] >= 50){ echo "'; } else echo "'; } ?> = 95){ echo "'; } elseif ($SURF_RH[$j] >= 90){ echo "'; } elseif ($SURF_RH[$j] >= 75){ echo "'; } elseif ($SURF_RH[$j] <= 25){ echo "'; } elseif ($SURF_RH[$j] <= 40){ echo "'; } else echo "'; } ?> = 95){ echo "'; } elseif ($ML_RH[$j] >= 90){ echo "'; } elseif ($ML_RH[$j] >= 75){ echo "'; } elseif ($ML_RH[$j] <= 25){ echo "'; } elseif ($ML_RH[$j] <= 40){ echo "'; } else echo "'; } ?> VRB " . $TEN_M_speed[$j] . ''; } elseif($TEN_M_direction[$j] >= 349 and $TEN_M_direction[$j] <= 360){ echo "'; } elseif ($TEN_M_direction[$j] >= 0 and $TEN_M_direction[$j] <= 11){ echo "'; } elseif ($TEN_M_direction[$j] > 11 and $TEN_M_direction[$j] <= 34){ echo "'; } elseif ($TEN_M_direction[$j] > 34 and $TEN_M_direction[$j] <= 56){ echo "'; } elseif ($TEN_M_direction[$j] > 56 and $TEN_M_direction[$j] <= 78){ echo "'; } elseif ($TEN_M_direction[$j] > 78 and $TEN_M_direction[$j] <= 101){ echo "'; } elseif ($TEN_M_direction[$j] > 101 and $TEN_M_direction[$j] <= 124){ echo "'; } elseif ($TEN_M_direction[$j] > 124 and $TEN_M_direction[$j] <= 146){ echo "'; } elseif ($TEN_M_direction[$j] > 146 and $TEN_M_direction[$j] <= 169){ echo "'; } elseif ($TEN_M_direction[$j] > 169 and $TEN_M_direction[$j] <= 191){ echo "'; } elseif ($TEN_M_direction[$j] > 191 and $TEN_M_direction[$j] <= 214){ echo "'; } elseif ($TEN_M_direction[$j] > 214 and $TEN_M_direction[$j] <= 236){ echo "'; } elseif ($TEN_M_direction[$j] > 236 and $TEN_M_direction[$j] <= 259){ echo "'; } elseif ($TEN_M_direction[$j] > 259 and $TEN_M_direction[$j] <= 281){ echo "'; } elseif ($TEN_M_direction[$j] > 281 and $TEN_M_direction[$j] <= 304){ echo "'; } elseif ($TEN_M_direction[$j] > 304 and $TEN_M_direction[$j] <= 326){ echo "'; } elseif ($TEN_M_direction[$j] > 326 and $TEN_M_direction[$j] <= 349){ echo "'; } else // echo "'; // echo "'; echo ""; } ?> " . $MIXHEIGHT[$j] . ''; } ?> = 1035){ echo "'; } elseif($MSLP_MB[$j] >= 1020){ echo "'; } elseif ($MSLP_MB[$j] < 990){ echo "'; } elseif ($MSLP_MB[$j] < 1000){ echo "'; } else echo "'; } ?> = 4){ echo "'; } elseif($MSLP_CH_3HR[$j] >= 2){ echo "'; } elseif ($MSLP_CH_3HR[$j] <= -4){ echo "'; } elseif ($MSLP_CH_3HR[$j] <= -2){ echo "'; } else echo "'; } ?> = 6){ echo "'; } elseif($MSLP_CH_6HR[$j] >= 3){ echo "'; } elseif ($MSLP_CH_6HR[$j] <= -6){ echo "'; } elseif ($MSLP_CH_6HR[$j] <= -3){ echo "'; } else echo "'; } ?> = 7.01){ echo "'; } elseif ($VSBY[$j] >= 5.01){ echo "'; } elseif ($VSBY[$j] >=3){ echo "'; } elseif ($VSBY[$j] >=1){ echo "'; } elseif ($VSBY[$j] >=0.50){ echo "'; } elseif ($VSBY[$j] >=0.01){ echo "'; } else echo "'; } ?> " . $REPORT_DAY_WEEK[$j] . ''; } ?> " . $REPORT_DAY[$j] . ''; } ?> '; } ?> -----"; } ?> = 0.3){ echo "'; } elseif ($PCPN_HR[$j] >= 0.2){ echo "'; } elseif ($PCPN_HR[$j] >= 0.1){ echo "'; } elseif ($PCPN_HR[$j] >= 0.05){ echo "'; } elseif ($PCPN_HR[$j] >= 0.01){ echo "'; } else echo "'; } ?> = 2){ echo "'; } elseif ($PCPN_TOT[$j] >= 1){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.75){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.5){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.25){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.1){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.05){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.01){ echo "'; } else echo "'; } ?> SN"; elseif ($WXPL[$j] == 1){ echo ""; } elseif ($WXZR[$j] == 1){ echo ""; } elseif ($WXRA[$j] == 1){ echo ""; } else echo ""; } ?> = 2) echo "'; elseif ($SN1HR[$j] >= 1){ echo "'; } elseif ($SN1HR[$j] >= 0.5){ echo "'; } elseif ($SN1HR[$j] >= 0.3){ echo "'; } elseif ($SN1HR[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 24) echo "'; elseif ($SN_TOT[$j] >= 18){ echo "'; } elseif ($SN_TOT[$j] >= 12){ echo "'; } elseif ($SN_TOT[$j] >= 8){ echo "'; } elseif ($SN_TOT[$j] >= 6){ echo "'; } elseif ($SN_TOT[$j] >= 4){ echo "'; } elseif ($SN_TOT[$j] >= 3){ echo "'; } elseif ($SN_TOT[$j] >= 2){ echo "'; } elseif ($SN_TOT[$j] >= 1){ echo "'; } elseif ($SN_TOT[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 90){ echo "'; } elseif ($LCLD[$j] >= 80){ echo "'; } elseif ($LCLD[$j] >= 60){ echo "'; } elseif ($LCLD[$j] >=40){ echo "'; } elseif ($LCLD[$j] >=20){ echo "'; } elseif ($LCLD[$j] == -9999){ echo ""; } else echo "'; } ?> = 90){ echo "'; } elseif ($MCLD[$j] >= 80){ echo "'; } elseif ($MCLD[$j] >= 60){ echo "'; } elseif ($MCLD[$j] >=40){ echo "'; } elseif ($MCLD[$j] >=20){ echo "'; } elseif ($MCLD[$j] == -9999){ echo ""; } else echo "'; } ?> = 90){ echo "'; } elseif ($HCLD[$j] >= 80){ echo "'; } elseif ($HCLD[$j] >= 60){ echo "'; } elseif ($HCLD[$j] >=40){ echo "'; } elseif ($HCLD[$j] >=20){ echo "'; } elseif ($HCLD[$j] == -9999){ echo ""; } else echo "'; } ?> = 2.00){ echo "'; } elseif ($PWAT[$j] >= 1.5){ echo "'; } elseif ($PWAT[$j] >= 1.25){ echo "'; } elseif ($PWAT[$j] >= 1.00){ echo "'; } elseif ($PWAT[$j] >= 0.75){ echo "'; } elseif ($PWAT[$j] <= 0.25){ echo "'; } elseif ($PWAT[$j] <= 0.50){ echo "'; } else echo "'; } ?> " . $REPORT_DAY_WEEK[$j] . ''; } ?> " . $REPORT_DAY[$j] . ''; } ?> '; } ?> -----"; } ?> = 5410){ echo "'; } elseif ($MB1000_MB500_THICK[$j] >= 5390){ echo "'; } else echo "'; } ?> = 1310){ echo "'; } elseif ($MB1000_MB850_THICK[$j] >= 1300){ echo "'; } else echo "'; } ?> = 2860){ echo "'; } elseif ($MB1000_MB700_THICK[$j] >= 2840){ echo "'; } elseif ($MB1000_MB700_THICK[$j] >= 2820){ echo "'; } else echo "'; } ?> = 1555){ echo "'; } elseif ($MB850_MB700_THICK[$j] >= 1540){ echo "'; } elseif ($MB850_MB700_THICK[$j] >= 1530){ echo "'; } else echo "'; } ?> -----"; } ?> = 3.25) echo "'; elseif ($MAXTWALOFT[$j] >= 1.5){ echo "'; } elseif ($MAXTWALOFT[$j] >= 0.7){ echo "'; } elseif ($MAXTWALOFT[$j] >= 0.1){ echo "'; } else echo "'; } ?> " . $PotSnow[$j] . ""; } ?> " . $PotSleet[$j] . ""; } ?> " . $PotRain[$j] . ""; } ?> = 3.25) echo "'; elseif ($MAXTALOFT[$j] >= 1.5){ echo "'; } elseif ($MAXTALOFT[$j] >= 0.7){ echo "'; } elseif ($MAXTALOFT[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 3) echo "'; elseif ($MB700_TEMP[$j] >= 1.5){ echo "'; } elseif ($MB700_TEMP[$j] >= 0.7){ echo "'; } elseif ($MB700_TEMP[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 3) echo "'; elseif ($MB850_TEMP[$j] >= 1.5){ echo "'; } elseif ($MB850_TEMP[$j] >= 0.7){ echo "'; } elseif ($MB850_TEMP[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 3) echo "'; elseif ($MB925_TEMP[$j] >= 1.5){ echo "'; } elseif ($MB925_TEMP[$j] >= 0.7){ echo "'; } elseif ($MB925_TEMP[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 1500) echo "'; elseif ($WBZ[$j] >= 1200){ echo "'; } elseif ($WBZ[$j] >= 1000){ echo "'; } elseif ($WBZ[$j] >= 700){ echo "'; } else echo "'; } ?> = 90){ echo "'; } elseif ($SURF_T[$j] >= 80){ echo "'; } elseif ($SURF_T[$j] >= 70){ echo "'; } elseif ($SURF_T[$j] >= 40){ echo "'; } elseif ($SURF_T[$j] >= 33){ echo "'; } elseif ($SURF_T[$j] >= 28){ echo "'; } elseif ($SURF_T[$j] > 0){ echo "'; } else echo "'; } ?> -----"; } ?> SN"; elseif ($WXPL[$j] == 1){ echo ""; } elseif ($WXZR[$j] == 1){ echo ""; } elseif ($WXRA[$j] == 1){ echo ""; } else echo ""; } ?> = 0.3){ echo "'; } elseif ($PCPN_HR[$j] >= 0.2){ echo "'; } elseif ($PCPN_HR[$j] >= 0.1){ echo "'; } elseif ($PCPN_HR[$j] >= 0.05){ echo "'; } elseif ($PCPN_HR[$j] >= 0.01){ echo "'; } else echo "'; } ?> = 2){ echo "'; } elseif ($PCPN_TOT[$j] >= 1){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.75){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.5){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.25){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.1){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.05){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.01){ echo "'; } else echo "'; } ?> = 0.3){ echo "'; } elseif ($PCPN_HR_SN[$j] >= 0.2){ echo "'; } elseif ($PCPN_HR_SN[$j] >= 0.1){ echo "'; } elseif ($PCPN_HR_SN[$j] >= 0.05){ echo "'; } elseif ($PCPN_HR_SN[$j] >= 0.01){ echo "'; } else echo "'; } ?> = 2){ echo "'; } elseif ($PCPN_TOT_SN[$j] >= 1){ echo "'; } elseif ($PCPN_TOT_SN[$j] >= 0.75){ echo "'; } elseif ($PCPN_TOT_SN[$j] >= 0.5){ echo "'; } elseif ($PCPN_TOT_SN[$j] >= 0.25){ echo "'; } elseif ($PCPN_TOT_SN[$j] >= 0.1){ echo "'; } elseif ($PCPN_TOT_SN[$j] >= 0.05){ echo "'; } elseif ($PCPN_TOT_SN[$j] >= 0.01){ echo "'; } else echo "'; } ?> = 20) echo "'; elseif ($AFSnowRatio[$j] >= 15){ echo "'; } elseif ($AFSnowRatio[$j] >= 10){ echo "'; } elseif ($AFSnowRatio[$j] >= 5){ echo "'; } else echo "'; } ?> = 2) echo "'; elseif ($AF_SN1HR[$j] >= 1){ echo "'; } elseif ($AF_SN1HR[$j] >= 0.5){ echo "'; } elseif ($AF_SN1HR[$j] >= 0.3){ echo "'; } elseif ($AF_SN1HR[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 24) echo "'; elseif ($AF_SN_TOT[$j] >= 18){ echo "'; } elseif ($AF_SN_TOT[$j] >= 12){ echo "'; } elseif ($AF_SN_TOT[$j] >= 8){ echo "'; } elseif ($AF_SN_TOT[$j] >= 6){ echo "'; } elseif ($AF_SN_TOT[$j] >= 4){ echo "'; } elseif ($AF_SN_TOT[$j] >= 3){ echo "'; } elseif ($AF_SN_TOT[$j] >= 2){ echo "'; } elseif ($AF_SN_TOT[$j] >= 1){ echo "'; } elseif ($AF_SN_TOT[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 20) echo "'; elseif ($MaxTAloftSnowRatio[$j] >= 15){ echo "'; } elseif ($MaxTAloftSnowRatio[$j] >= 10){ echo "'; } elseif ($MaxTAloftSnowRatio[$j] >= 5){ echo "'; } else echo "'; } ?> = 2) echo "'; elseif ($MaxTAloftSnowRatio_SN1HR[$j] >= 1){ echo "'; } elseif ($MaxTAloftSnowRatio_SN1HR[$j] >= 0.5){ echo "'; } elseif ($MaxTAloftSnowRatio_SN1HR[$j] >= 0.3){ echo "'; } elseif ($MaxTAloftSnowRatio_SN1HR[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 24) echo "'; elseif ($MaxTAloftSnowRatio_SN_TOT[$j] >= 18){ echo "'; } elseif ($MaxTAloftSnowRatio_SN_TOT[$j] >= 12){ echo "'; } elseif ($MaxTAloftSnowRatio_SN_TOT[$j] >= 8){ echo "'; } elseif ($MaxTAloftSnowRatio_SN_TOT[$j] >= 6){ echo "'; } elseif ($MaxTAloftSnowRatio_SN_TOT[$j] >= 4){ echo "'; } elseif ($MaxTAloftSnowRatio_SN_TOT[$j] >= 3){ echo "'; } elseif ($MaxTAloftSnowRatio_SN_TOT[$j] >= 2){ echo "'; } elseif ($MaxTAloftSnowRatio_SN_TOT[$j] >= 1){ echo "'; } elseif ($MaxTAloftSnowRatio_SN_TOT[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 20) echo "'; elseif ($ThickSnowRatio[$j] >= 15){ echo "'; } elseif ($ThickSnowRatio[$j] >= 10){ echo "'; } elseif ($ThickSnowRatio[$j] >= 5){ echo "'; } else echo "'; } ?> = 2) echo "'; elseif ($Thick_SN1HR[$j] >= 1){ echo "'; } elseif ($Thick_SN1HR[$j] >= 0.5){ echo "'; } elseif ($Thick_SN1HR[$j] >= 0.3){ echo "'; } elseif ($Thick_SN1HR[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 24) echo "'; elseif ($Thick_SN_TOT[$j] >= 18){ echo "'; } elseif ($Thick_SN_TOT[$j] >= 12){ echo "'; } elseif ($Thick_SN_TOT[$j] >= 8){ echo "'; } elseif ($Thick_SN_TOT[$j] >= 6){ echo "'; } elseif ($Thick_SN_TOT[$j] >= 4){ echo "'; } elseif ($Thick_SN_TOT[$j] >= 3){ echo "'; } elseif ($Thick_SN_TOT[$j] >= 2){ echo "'; } elseif ($Thick_SN_TOT[$j] >= 1){ echo "'; } elseif ($Thick_SN_TOT[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 20) echo "'; elseif ($BlendSR[$j] >= 15){ echo "'; } elseif ($BlendSR[$j] >= 10){ echo "'; } elseif ($BlendSR[$j] >= 5){ echo "'; } else echo "'; } ?> = 2) echo "'; elseif ($BlendSR_SN1HR[$j] >= 1){ echo "'; } elseif ($BlendSR_SN1HR[$j] >= 0.5){ echo "'; } elseif ($BlendSR_SN1HR[$j] >= 0.3){ echo "'; } elseif ($BlendSR_SN1HR[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 24) echo "'; elseif ($BlendSR_SN_TOT[$j] >= 18){ echo "'; } elseif ($BlendSR_SN_TOT[$j] >= 12){ echo "'; } elseif ($BlendSR_SN_TOT[$j] >= 8){ echo "'; } elseif ($BlendSR_SN_TOT[$j] >= 6){ echo "'; } elseif ($BlendSR_SN_TOT[$j] >= 4){ echo "'; } elseif ($BlendSR_SN_TOT[$j] >= 3){ echo "'; } elseif ($BlendSR_SN_TOT[$j] >= 2){ echo "'; } elseif ($BlendSR_SN_TOT[$j] >= 1){ echo "'; } elseif ($BlendSR_SN_TOT[$j] >= 0.1){ echo "'; } else echo "'; } ?>  "; } ?> " . $REPORT_DAY_WEEK[$j] . ''; } ?> " . $REPORT_DAY[$j] . ''; } ?> '; } ?> -----"; } ?> -----"; } ?> " . $MB500_TEMP[$j] . ''; } ?> = 14) echo "'; elseif ($MB700_TEMP[$j] >= 10){ echo "'; } else echo "'; } ?> = 30) echo "'; elseif ($MB850_TEMP[$j] >= 25){ echo "'; } elseif ($MB850_TEMP[$j] >= 20){ echo "'; } elseif ($MB850_TEMP[$j] >= 10){ echo "'; } elseif ($MB850_TEMP[$j] >= 5){ echo "'; } elseif ($MB850_TEMP[$j] >= 0){ echo "'; } elseif ($MB850_TEMP[$j] >= -5){ echo "'; } elseif ($MB850_TEMP[$j] >= -10){ echo "'; } elseif ($MB850_TEMP[$j] >= -20){ echo "'; } else echo "'; } ?> = 30) echo "'; elseif ($MB925_TEMP[$j] >= 25){ echo "'; } elseif ($MB925_TEMP[$j] >= 20){ echo "'; } elseif ($MB925_TEMP[$j] >= 10){ echo "'; } elseif ($MB925_TEMP[$j] >= 5){ echo "'; } elseif ($MB925_TEMP[$j] >= 0){ echo "'; } elseif ($MB925_TEMP[$j] >= -5){ echo "'; } elseif ($MB925_TEMP[$j] >= -10){ echo "'; } elseif ($MB925_TEMP[$j] >= -20){ echo "'; } else echo "'; } ?> -----"; } ?> = 8){ echo "'; } elseif ($MB700_MB500_LR[$j] >= 7){ echo "'; } elseif ($MB700_MB500_LR[$j] >= 6){ echo "'; } else echo "'; } ?> = 8){ echo "'; } elseif ($MB850_MB700_LR[$j] >= 7){ echo "'; } elseif ($MB850_MB700_LR[$j] >= 6){ echo "'; } else echo "'; } ?> = 8){ echo "'; } elseif ($SFC_MB850_LR[$j] >= 7){ echo "'; } elseif ($SFC_MB850_LR[$j] >= 6){ echo "'; } else echo "'; } ?> = 8){ echo "'; } elseif ($SFC_MB925_LR[$j] >= 7){ echo "'; } elseif ($SFC_MB925_LR[$j] >= 6){ echo "'; } else echo "'; } ?> -----"; } ?> " . $REPORT_DAY_WEEK[$j] . ''; } ?> " . $REPORT_DAY[$j] . ''; } ?> '; } ?> -----"; } ?> -----"; } ?> = 81){ echo "'; } elseif ($UVV[$j] >= 61){ echo "'; } elseif ($UVV[$j] >=41){ echo "'; } elseif ($UVV[$j] >=10){ echo "'; } else echo "'; } ?> =4000){ echo "'; } elseif ($CAPE[$j] >= 3500){ echo "'; } elseif ($CAPE[$j] >= 3000){ echo "'; } elseif ($CAPE[$j] >= 2500){ echo "'; } elseif ($CAPE[$j] >= 2000){ echo "'; } elseif ($CAPE[$j] >= 1500){ echo "'; } elseif ($CAPE[$j] >= 1000){ echo "'; } elseif ($CAPE[$j] >= 750){ echo "'; } elseif ($CAPE[$j] >= 500){ echo "'; } elseif ($CAPE[$j] >= 250){ echo "'; } elseif ($CAPE[$j] >= 100){ echo "'; } else echo "'; } ?> = .30){ echo "'; } elseif ($NCAPE[$j] >= .20){ echo "'; } elseif ($NCAPE[$j] >= .10){ echo "'; } elseif ($NCAPE[$j] >= .05){ echo "'; } else echo "'; } ?> " . $CINS[$j] . ''; } elseif ($CINS[$j] <= -50){ echo "'; } elseif ($CINS[$j] <= -0.01){ echo "'; } else echo "'; } ?> = 1) and ($LID[$j] <= 3)) echo "'; elseif ($LID[$j] > 6){ echo "'; } elseif ($LID[$j] > 3){ echo "'; } else echo "'; } ?> 5){ echo "'; } elseif ($SHO[$j] >= 2){ echo "'; } elseif ($SHO[$j] >= 0){ echo "'; } elseif ($SHO[$j] >= -3.5){ echo "'; } elseif ($SHO[$j] >=-6.5){ echo "'; } elseif ($SHO[$j] >-9999){ echo "'; } else echo "'; } ?> 6){ echo "'; } elseif ($LI[$j] >= 3){ echo "'; } elseif ($LI[$j] >= 1){ echo "'; } elseif ($LI[$j] >=0){ echo "'; } elseif ($LI[$j] >=-4){ echo "'; } elseif ($LI[$j] >=-7){ echo "'; } elseif ($LI[$j] >-9999){ echo "'; } else { echo "'; } } ?> 800){ echo "'; } elseif ($SWEAT[$j]>= 600){ echo "'; } elseif ($SWEAT[$j]>=500){ echo "'; } elseif ($SWEAT[$j]>=400){ echo "'; } elseif ($SWEAT[$j]>=300){ echo "'; } elseif ($SWEAT[$j]>=150){ echo "'; } elseif ($SWEAT[$j]>-9999){ echo "'; } else echo "'; } ?> =40){ echo "'; } elseif ($KIndex[$j] >= 26){ echo "'; } elseif ($KIndex[$j] >=15){ echo "'; } else echo "'; } ?> 55){ echo "'; } elseif ($TTI[$j] >=53){ echo "'; } elseif ($TTI[$j] >=50){ echo "'; } elseif ($TTI[$j] >=45){ echo "'; } elseif ($TTI[$j] >=40){ echo "'; } elseif ($TTI[$j] >-9999){ echo "'; } else echo "'; } ?> =60){ echo "'; } elseif ($SHEAR6KM[$j] >= 50){ echo "'; } elseif ($SHEAR6KM[$j] >= 30){ echo "'; } elseif ($SHEAR6KM[$j] >=15){ echo "'; } else echo "'; } ?> 500){ if ($BRCH[$j] >=45){ echo "'; } elseif ($BRCH[$j] >20){ echo "'; } elseif ($BRCH[$j] >10){ echo "'; } else { echo "'; } } // CAPE else echo ""; } ?> " . $EL[$j] . ''; } ?> 20) echo "'; elseif ($CravenSig[$j] >= 9){ echo "'; } else echo "'; } ?> = 10){ echo "'; } elseif (abs($SCP[$j])>=5.7){ echo "'; } elseif (abs($SCP[$j])>=3.2){ echo "'; } elseif (abs($SCP[$j])>=1.2){ echo "'; } elseif (abs($SCP[$j])>-9999){ echo "'; } else echo "'; } ?> -----"; } ?> -----"; } ?> = 30){ echo "'; } elseif ($SHEAR1KM[$j] >= 20){ echo "'; } elseif ($SHEAR1KM[$j] >= 15){ echo "'; } elseif ($SHEAR1KM[$j] >= 10){ echo "'; } else echo "'; } ?> 500){ if ($BRCHSHEAR[$j] >=40){ echo "'; } elseif ($BRCHSHEAR[$j] >35){ echo "'; } elseif ($BRCHSHEAR[$j] >20){ echo "'; } else { echo "'; } } // CAPE else echo ""; } //for ?> 400){ echo "'; } elseif ($HLCY1K[$j] >= 300){ echo "'; } elseif ($HLCY1K[$j] >=150){ echo "'; } elseif ($HLCY1K[$j] >=100){ echo "'; } elseif ($HLCY1K[$j] >-9999){ echo "'; } else echo "'; } ?> 400){ echo "'; } elseif ($SRH[$j] >= 250){ echo "'; } elseif ($SRH[$j] >=150){ echo "'; } elseif ($SRH[$j] >=100){ echo "'; } elseif ($SRH[$j] >-9999){ echo "'; } else echo "'; } ?> 5){ echo "'; } elseif ($EHI[$j] >= 2){ echo "'; } elseif ($EHI[$j] >=1){ echo "'; } elseif ($EHI[$j] >=0.5){ echo "'; } elseif ($EHI[$j] >-9999){ echo "'; } else echo "'; } ?> = 1.8) echo "'; elseif ($STP[$j] >= 0.5){ echo "'; } elseif ($STP[$j] >= 0.1){ echo "'; } else echo "'; } ?> = 1){ echo "'; } elseif ($SHERBS3[$j] >= 0.5){ echo "'; } else echo "'; } ?> = 9800) echo "'; elseif ($LFCT[$j] >= 8200){ echo "'; } elseif ($LFCT[$j] >= 6550){ echo "'; } elseif ($LFCT[$j] == "---"){ echo "'; } else echo "'; } ?> 45){ if(round($LCL[$j]/3.28,0) >= 1200) echo "'; elseif (round($LCL[$j]/3.28,0) >= 1000){ echo "'; } elseif (round($LCL[$j]/3.28,0) >= 700){ echo "'; } else echo "'; } // CAPE else echo "'; } ?> " . $LCLP[$j] . ''; } ?> " . $LCLT[$j] . ''; } ?> -----"; } ?> " . $HEIGHT_0C[$j] . ''; } ?> " . $HEIGHT_20C[$j] . ''; } ?> " . $HEIGHT_50DBZ[$j] . ''; } ?> = 12000) echo "'; elseif ($WBZ[$j] >= 11000){ echo "'; } elseif ($WBZ[$j] >= 9000){ echo "'; } elseif ($WBZ[$j] >= 8000){ echo "'; } else echo "'; } ?> = 40){ echo "'; } elseif ($SHEAR3KM[$j] >= 30){ echo "'; } elseif ($SHEAR3KM[$j] >= 15){ echo "'; } else echo "'; } ?> " . $REPORT_DAY_WEEK[$j] . ''; } ?> " . $REPORT_DAY[$j] . ''; } ?> '; } ?> -----"; } ?> " . $REPORT_DAY_WEEK[$j] . ''; } ?> " . $REPORT_DAY[$j] . ''; } ?> '; } ?> = 90){ echo "'; } elseif ($SURF_T[$j] >= 80){ echo "'; } elseif ($SURF_T[$j] >= 70){ echo "'; } elseif ($SURF_T[$j] >= 40){ echo "'; } elseif ($SURF_T[$j] >= 33){ echo "'; } elseif ($SURF_T[$j] >= 28){ echo "'; } elseif ($SURF_T[$j] > 0){ echo "'; } else echo "'; } ?> = 70){ echo "'; } elseif ($SURF_TD[$j] >= 60){ echo "'; } elseif ($SURF_TD[$j] >= 50){ echo "'; } else echo "'; } ?> = 70){ echo "'; } elseif ($ML_TDC[$j] >= 60){ echo "'; } elseif ($ML_TDC[$j] >= 50){ echo "'; } else echo "'; } ?> = 95){ echo "'; } elseif ($SURF_RH[$j] >= 90){ echo "'; } elseif ($SURF_RH[$j] >= 75){ echo "'; } elseif ($SURF_RH[$j] <= 25){ echo "'; } elseif ($SURF_RH[$j] <= 40){ echo "'; } else echo "'; } ?> = 95){ echo "'; } elseif ($ML_RH[$j] >= 90){ echo "'; } elseif ($ML_RH[$j] >= 75){ echo "'; } elseif ($ML_RH[$j] <= 25){ echo "'; } elseif ($ML_RH[$j] <= 40){ echo "'; } else echo "'; } ?> = 349 and $TEN_M_direction[$j] <= 360){ echo "'; } elseif ($TEN_M_direction[$j] >= 0 and $TEN_M_direction[$j] <= 11){ echo "'; } elseif ($TEN_M_direction[$j] > 11 and $TEN_M_direction[$j] <= 34){ echo "'; } elseif ($TEN_M_direction[$j] > 34 and $TEN_M_direction[$j] <= 56){ echo "'; } elseif ($TEN_M_direction[$j] > 56 and $TEN_M_direction[$j] <= 78){ echo "'; } elseif ($TEN_M_direction[$j] > 78 and $TEN_M_direction[$j] <= 101){ echo "'; } elseif ($TEN_M_direction[$j] > 101 and $TEN_M_direction[$j] <= 124){ echo "'; } elseif ($TEN_M_direction[$j] > 124 and $TEN_M_direction[$j] <= 146){ echo "'; } elseif ($TEN_M_direction[$j] > 146 and $TEN_M_direction[$j] <= 169){ echo "'; } elseif ($TEN_M_direction[$j] > 169 and $TEN_M_direction[$j] <= 191){ echo "'; } elseif ($TEN_M_direction[$j] > 191 and $TEN_M_direction[$j] <= 214){ echo "'; } elseif ($TEN_M_direction[$j] > 214 and $TEN_M_direction[$j] <= 236){ echo "'; } elseif ($TEN_M_direction[$j] > 236 and $TEN_M_direction[$j] <= 259){ echo "'; } elseif ($TEN_M_direction[$j] > 259 and $TEN_M_direction[$j] <= 281){ echo "'; } elseif ($TEN_M_direction[$j] > 281 and $TEN_M_direction[$j] <= 304){ echo "'; } elseif ($TEN_M_direction[$j] > 304 and $TEN_M_direction[$j] <= 326){ echo "'; } elseif ($TEN_M_direction[$j] > 326 and $TEN_M_direction[$j] <= 349){ echo "'; } else echo "'; } ?> = 0.3){ echo "'; } elseif ($PCPN_HR[$j] >= 0.2){ echo "'; } elseif ($PCPN_HR[$j] >= 0.1){ echo "'; } elseif ($PCPN_HR[$j] >= 0.05){ echo "'; } elseif ($PCPN_HR[$j] >= 0.01){ echo "'; } else echo "'; } ?> = 2){ echo "'; } elseif ($PCPN_TOT[$j] >= 1){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.75){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.5){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.25){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.1){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.05){ echo "'; } elseif ($PCPN_TOT[$j] >= 0.01){ echo "'; } else echo "'; } ?> " . $MIXHEIGHT[$j] . ''; } ?> Haines Index - Low"; } else { echo ""; } for($j=0;$j<$num_entries;$j++){ if($HAINES_LOW[$j]>6){ echo "'; } elseif ($HAINES_LOW[$j]>= 5){ echo "'; } elseif ($HAINES_LOW[$j]>=4){ echo "'; } elseif ($HAINES_LOW[$j]>=3){ echo "'; } else echo "'; } ?> = 305 || $STNELEV <= 914) { echo ""; } else { echo ""; } for($j=0;$j<$num_entries;$j++){ if($HAINES_MID[$j]>6){ echo "'; } elseif ($HAINES_MID[$j]>= 5){ echo "'; } elseif ($HAINES_MID[$j]>=4){ echo "'; } elseif ($HAINES_MID[$j]>=3){ echo "'; } else echo "'; } ?> 914){ echo ""; } else { echo ""; } for($j=0;$j<$num_entries;$j++){ if($HAINES_HIGH[$j]>6){ echo "'; } elseif ($HAINES_HIGH[$j]>= 5){ echo "'; } elseif ($HAINES_HIGH[$j]>=4){ echo "'; } elseif ($HAINES_HIGH[$j]>=3){ echo "'; } else echo "'; } ?> 150000){ echo "'; } elseif ($VENTRATE[$j] >= 100000){ echo "'; } elseif ($VENTRATE[$j] >= 60000){ echo "'; } elseif ($VENTRATE[$j] >= 40000){ echo "'; } else echo "'; } ?> " . $REPORT_DAY_WEEK[$j] . ''; } ?> " . $REPORT_DAY[$j] . ''; } ?> '; } ?>
Click group to view data
Date
"; $Sounding3hr = array(0,3,6,9,12,15,18,21); $Sounding6hr = array(0,6,12,18); for($j=0;$j<$num_entries;$j++){ if (($modelname == "NAM") AND in_array($REPORT_TIME_RAW[$j], $Sounding3hr)) { // Twisterdata Sounding // echo "' . $REPORT_TIME_RAW[$j] . 'Z' . $REPORT_TIME_RAW[$j] . 'Z' . $REPORT_TIME_RAW[$j] . 'Z' . $REPORT_TIME_RAW[$j] . 'Z' . $REPORT_TIME_RAW[$j] . 'Z' . $REPORT_TIME_RAW[$j] . 'Z' . $REPORT_TIME_RAW[$j] . 'Z' . $REPORT_TIME_RAW[$j] . 'Z' . $REPORT_TIME_RAW[$j] . 'Z' . $REPORT_TIME_RAW[$j] . 'Z' . $REPORT_TIME_RAW[$j] . 'Z' . $REPORT_TIME_RAW[$j] . 'Z" . $REPORT_TIME[$j] . '
Surface Weather Data
Precipitation and Clouds
Winter Weather Data
Upper Air Data
Severe Weather Data (General)
Severe Parms (TOR/Wind/Hail)
Fire Weather Data

* Move Mouse Over Colored Cells For Further Details

Sites available for Model Data

Date: 7/7/18 - 3.02 - Added HIRESW (ARW) Window. - Steve Fleegel

7/14/18 - 3.03 - Allow for extended runs of the HRRR/RAP.

Original page based off Code from PHP Severe Script Developed By Jim Wyman
 SOUTHERN MARYLAND WEATHER - www.somdweather.com

WXForecasting.com