YOU CAN EDIT THIS PAGE! Just click any blue "Edit" link and start writing!

Template talk:ClimateFahrenheit

From Wikitravel
Jump to: navigation, search



To use this template copy and paste the following code and fill in the respective values. The template should only be used in the "Understand" section, possibly under a "Climate" sub header, of a destination's guide. It's possible to leave fields blank. If a field is left blank a cell no information will appear on the finished template. If an entire set of information is left blank the row will not appear.

See the right side of the screen for an example of what the template will look like.

These are the following parameters that may be used. Any explanation of the parameter will be contained below.

This parameter is to indicate the maximum high temperature in a given month.
This parameter is to indicate the mean temperature in a given month.
This parameter is to indicate the minimum low temperature in a given month.
This parameter is to indicate the average amount of precipitation that falls on the destination in a given month. We consider precipitation to be any H2O based thingamig that falls from the sky. This can include rain, snow, or hail.
This parameter is to indicate the average number of sunlight hours per day in a given month
This parameter is to indicate the average temperature of a body of water in the destination during a given month. If there is more than one body of water use the temperatures for the most visited body of water.

| janhigh =
| febhigh =
| marhigh =
| aprhigh =
| mayhigh =
| junhigh =
| julhigh =
| aughigh =
| sephigh =
| octhigh =
| novhigh =
| dechigh =
| janmean =
| febmean =
| marmean =
| aprmean =
| maymean =
| junmean =
| julmean =
| augmean =
| sepmean =
| octmean =
| novmean =
| decmean =
| janlow =
| feblow =
| marlow =
| aprlow =
| maylow =
| junlow =
| jullow =
| auglow =
| seplow =
| octlow =
| novlow =
| declow =
| janprecip =
| febprecip =
| marprecip =
| aprprecip =
| mayprecip =
| junprecip =
| julprecip =
| augprecip =
| sepprecip =
| octprecip =
| novprecip =
| decprecip =
| jansun =
| febsun =
| marsun =
| aprsun =
| maysun =
| junsun =
| julsun =
| augsun =
| sepsun =
| octsun =
| novsun =
| decsun =
| janh2o =
| febh2o =
| marh2o =
| aprh2o =
| mayh2o =
| junh2o =
| julh2o =
| augh2o =
| seph2o =
| octh2o =
| novh2o =
| dech2o =


I unilaterally decided that cm should not be used on this template for measuring the amount of precipitation and that inches should be used instead. The figuring is that since really only one country (The U.S.) use the Fahrenheit system that the unit for measuring snow and other water based droppings from the sky should be inches, which is familiar for most Americans. I'm not sure what Canadians do so they may benefit from this too. -- Sapphire 03:05, 16 February 2007 (EST)


See discussion at Template_talk:ClimateCelsius and the Wikitravel:Climate Expedition


The NOAA forecast link rocks (see it on Cincinnati page). Nice work Sapphire. Clean. Relevant. Required data parameters easy to add to template instances. Thanks. --Rogerhc 14:11, 26 May 2007 (EDT)

I like it. I occurs to me that since this forecast feature is a US-only thing, and the use of Fahrenheit is a US-only thing, that it might still make sense to have multiple templates, such as a Template:Climate (°C, no forecast) and a Template:ClimateUS (°F, with forecast). If forecast sources for other countries/regions are found, we could create additional with-forecast templates for them. - Todd VerBeek 09:13, 27 May 2007 (EDT) Add: Ah, I see you've already thought of this. - Todd VerBeek 09:16, 27 May 2007 (EDT)


I had to revert the change to parser functions, because it messed up the display of negative numbers. I also reverted the change to the Celsius template. -- Sapphire(Talk) • 18:50, 21 October 2007 (EDT)

Template:If was supposed to have been deleted since Mediawiki uses the parser function #if instead now, although for some reason it still seems to be available. What page specifically was breaking? -- Ryan • (talk) • 20:39, 21 October 2007 (EDT)
Yeah, I have reverted this template back to include the parser functions you inserted. Problem is, if you look at the template on this page, the negative numbers (i.e. for "Jan") don't display, but they do when the template incorporates Template:If. -- Sapphire(Talk) • 14:44, 22 October 2007 (EDT)
I'll take a look again tonight. The problem is due to the #if expression interpreting any negative number to be "false". If anyone else can fix it please go for it. -- Ryan • (talk) • 15:12, 22 October 2007 (EDT)
I just replicated and partially traced this issue on my local wiki (MediaWiki: 1.8.5, Paserfunctions with no version specified) and the problems seems to be with mediawiki itself. The negative temperatures are correctly interpreted by the #if operation in function ifHook in extensions/ParserFunctions/ParserFunctions.php and is correctly returned to function braceSubstitution in mediawiki's Parser.php, but at some point after that it seems to get lost. I resolved the issue locally by modifying ParserFunctions.php to encode the minus sign as follows:
Origional Modified
        function ifHook( &$parser, $test = '', $then = '', $else = '' ) {
                if ( $test !== '' ) {
                        return $then;
                } else {
                        return $else;

        function ifHook( &$parser, $test = '', $then = '', $else = '' ) {
                if ( $test !== '' ) {
                        $then = str_replace("-", "-", $then);
                        return $then;
                } else {
                        return $else;

My reading of spec is that the parser functions will first try to evaluate an expression as a conditional expression. In this case any negative number is a valid conditional that evaluates to false, so it seems that the Mediawiki behavior is OK. I don't have a Mediawiki install to verify on, however, so I may have misunderstood your analysis above. I think that if we just modify the template to view numbers as strings we should be able to resolve the issue. -- Ryan • (talk) • 17:50, 22 October 2007 (EDT)
Found another solution and have modified the template accordingly...looks like it is acting correct now --NJR_ZA 17:53, 22 October 2007 (EDT)
The spec states that the condition it tests for is the string is non-empty. It was doing that correctly and returning the -3 from the example at the top to mediawiki, but mediawiki was dropping it somewhere. I got interrupted during the trace (woman just don't understand the complexity of debugging!), but will rerun it sometime and log a mediawiki bug report --NJR_ZA 18:10, 22 October 2007 (EDT)

This issue seems to have been resolved as negative numbers display properly, so I've completed the deletion of the "If" template. -- Ryan • (talk) • 00:51, 15 June 2010 (EDT)