Page 1 of 1

documentation around index calculations

Posted: Thu Apr 14, 2022 12:36 pm
by IngemarS
Hi,

I have seen that f ex Heat index and Chill indexes are a bit off (lower resp higher) in MT than the SMHI indexes.
So, I suppose MT uses one of the other many versions of these indexes that are around. I remember using my data and comparing nearly a dozen of them some 10-15 years ago.

Possibly, there are other indexes besides these that exists - I do not know - I haven't had much time to dive into the finer parts of MT, so far.

So which type of indexes are used, are they EU specific? Their names please, or links to description. I need to start documenting what's behind the curtains of MT.

Thanks,

IngemarS

Re: documentation around index calculations

Posted: Thu Apr 14, 2022 1:26 pm
by davidefa
I assume you are referring to the block 'current'.
In this block heat index is calculated by this function:

Code: Select all

	// Heat Index (U.S.) - https://en.wikipedia.org/wiki/Heat_index
	function getHI($HI_T,$HI_H){
		global $displayTempUnits;
		if($HI_T < 26.7){
			return "--";
		}
		else{
			$HI_T = convertor($HI_T,"C","F");
			$c1 = -42.379;
			$c2 = 2.04901523;
			$c3 = 10.14333127;
			$c4 = -0.22475541;
			$c5 = -6.83783 * pow(10, -3);
			$c6 = -5.481717 * pow(10, -2);
			$c7 = 1.22874 * pow(10, -3);
			$c8 = 8.5282 * pow(10, -4);
			$c9 = -1.99 * pow(10, -6);
			$HI = $c1 + $c2 * $HI_T + $c3 * $HI_H + $c4 * $HI_T * $HI_H + $c5 * $HI_T * $HI_T + $c6 * $HI_H * $HI_H + $c7 * $HI_T * $HI_T * $HI_H + $c8 * $HI_T * $HI_H * $HI_H + $c9 * $HI_T * $HI_T * $HI_H * $HI_H;
			$HI = convertor($HI,"F",$displayTempUnits);
			return number_format($HI,1,".","");
		}
	}
Wind chill is calculated by this function:

Code: Select all

	// Wind Chill - https://en.wikipedia.org/wiki/Wind_chill
	function getWCh($WCh_T,$WCh_W){
		global $displayTempUnits;
		// wind chill only valid for T<=10C and W>4.8km/h
		if($WCh_T <= 10 && $WCh_W > 4.8){
			$WCh = 13.12 + 0.6215 * $WCh_T - 11.37 * pow($WCh_W,0.16) + 0.3965 * $WCh_T * pow($WCh_W,0.16);
			$WCh = convertor($WCh,"C",$displayTempUnits);
			return number_format($WCh,1,".","");
		}
		else{
			return "-- ";
		}
	}
The formulas are those described in the wikipedia links

Re: documentation around index calculations

Posted: Thu Apr 14, 2022 3:21 pm
by IngemarS
Thanks,

Ah, most have forgotten those points from when I read the wiki almost 9 months ago!

I will only have to match those codes to indexes I know of, and their names.

Again Thank You

IngemarS