Jump to content

Template talk:Bbl to t

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Unsatisfactory results

[edit]

I found the template display unsatisfactory for {{bbl to t | 126493936 | precision= -5|}}

126,493,936 {{{3}}} barrels (~Expression error: Unexpected < operatorExpression error)

While it looked okay the first and third time I previewed it here, the second time the preview looked like it did on the page where it was used it displayed as

126,493,936 barrels (~2.16E+7 t)

Let's see what happens when I save it. Don't know if anything can be done about that. Gene Nygaard 15:49, 16 October 2007 (UTC)[reply]

I've introduced {{rnd}} to fix this problem (it still won't work if you plug in astronomically large numbers). I've also made some other changes. Gene, there was another problem with the code you had entered. That final pipe in {{bbl to t | 126493936 | precision= -5|}} was setting API to zero (with the old version). With the old version API could be entered as the second unnamed parameter. You were entering a blank, a zero. This explains the ~17,300,000 t as opposed to ~21,600,000 t. The current version uses the second unnamed parameter for precision; there is no precision parameter any more (I commented this out in the above). Jɪmp 09:18, 6 March 2008 (UTC)[reply]
The template is in the middle of another reworking. No longer can you specify precision. The second (fourth in the case of ranges) unnamed parameter now give the number of significant figures.
e.g. {{bbl to t|126493936|3}} gives "126,493,936 barrels (~1.73×10^7 t)".
JЇѦρ 02:03, 7 April 2008 (UTC)[reply]

National varieties of English

[edit]

It also imposes spelling that might violate Wikipedia:Manual of Style#National varieties of English in "full notation" by imposing a spelling of "tonnes" rather than "metric tons". (And it probably doesn't account for numbers which should be expressed in singular form in full notation, either, does it). Gene Nygaard 15:56, 16 October 2007 (UTC)[reply]

Well, I was not trying to "impose" anything when creating this template. The reason why the template supports neither national varieties nor singular/plural forms is because it was created as a barebones example to polish its principal function (which is, of course, the actual conversion). The two features you mentioned are first in line to be added once I find time to continue working on the conversion templates. On that note, if you or anyone else beat me to improving this template, I'd be more than happy to scratch this particular task off my to-do list :)—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); 17:45, 17 October 2007 (UTC)[reply]
I think I'm beating you to it. I've got a solution. I'll be implimenting it when I've got the time. Jɪmp 09:18, 6 March 2008 (UTC)[reply]
What I had in mind was
  1. making it such that abbr would control the barrel display only and
  2. introducing a new parameter to control the tonne display.
The default would be to use the abbreviation "t" but if you should want "tonnes" or "metric tons", you'd type that in explicitely. You could even use "thousand kilograms" or "megagrams" if you like. This input would be checked against a synonym list (in the form of a switch) to weed out nonsense.
I've done part 1 but I'm having second thoughts about 2. Is there much worth in allowing users to violate the manual of style via this template? If an editor really must have the unit spelt out, can we not let them type it out by hand? I began to wonder in which context spelling "tonne", "metric ton", etc. out would be desireable. None sprang to mind. None of the current transculsions spelt it out.
If needed part 2 can be done later. There are more useful features to add to this template.
Jɪmp 15:32, 6 March 2008 (UTC)[reply]
Thanks, Jimp. Much appreciate your help, as usual.—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); 16:48, 6 March 2008 (UTC)[reply]
No worries. Jɪmp 17:17, 6 March 2008 (UTC)[reply]

New features

[edit]

I've added/changed the following features:

  • support for adjective form
    adj=on will make barrel singular & insert hyphens.
    input-sensitive default rounding
    if the rounding factor is not specified the template now defaults to a rounding scheme based on the number of significant figures in the input. Specifically, the number of significant figures in the first unnamed parameter is calculated and compared the number of significant figures in 131.5 + API, then the minimum of these two is compared to 2, maximum of those two numbers is taken, the conversion is rounded to that many significant figures. Jɪmp 18:55, 6 March 2008 (UTC)[reply]
    support for (production) rates
    the new parameter per can be used to produce a rate as opposed to a straight quantity. The abbreviations "h", "d" and "a" are spelt out as "hour", "day" and "annum". With lk=on annum links to Annum (day and hour do not currently link since these are such every-day words ... though abbreviations always link). Jɪmp 00:37, 7 March 2008 (UTC) To use a different time unit for tonnes, use t_per JЇѦρ 04:17, 7 April 2008 (UTC)[reply]
    support for ranges dual conversions
    setting the second unnamed parameter to to will put the template into range mode. The first unnamed parameter will be the lower end & the third the upper. Precision is moved to the fourth unnamed parameter. Jɪmp 01:36, 7 March 2008 (UTC) set the second parameter to any word, parameters 1 and 3 give the 1st and 2nd values, parameter 2 gives the conjunction, parameter 4 (if specified) gives the number of sig figs JЇѦρ 04:16, 7 April 2008 (UTC)[reply]
    sig figs not precision
    the second/fourth parameter no longer gives precision but number of significant figures. JЇѦρ 01:54, 7 April 2008 (UTC)[reply]
    large numbers
    you can add thousand, ... trillion by setting mlt to the appropriate SI prefix. The conversion to tonnes is given in scientific notation for 100,000 and above. JЇѦρ 04:12, 7 April 2008 (UTC)[reply]

More examples

[edit]
ranges rounded to three significant figures
{{bbl to t|100|to|200|3}} gives 100 to 200 barrels (~13.6 to ~27.3 t)
rate ranges
{{bbl to t|100|and|200|per=a}} gives 100 and 200 barrels per annum (~14 and ~27 t/a)
range adjectives
{{bbl to t|100|to|200|adj=on}} gives 100-to−200-barrel (~14 to ~27 t)
rate adjectives
{{bbl to t|100|per=h|adj=on}} gives 100-barrel-per-hour (~14 t/h)
rate range adjectives
{{bbl to t|100|or|200|per=a|adj=on}} gives 100-or−200-barrel-per-annum (~14 or ~27 t/a)
linked ranges
{{bbl to t|100|and|200|lk=on}} gives 100 and 200 barrels (~14 and ~27 t)
linked rates
{{bbl to t|100|per=h|lk=on}} gives 100 barrels per hour (~14 t/h)
linked rate ranges
{{bbl to t|100|to|200|per=a|lk=on}} gives 100 to 200 barrels per annum (~14 to ~27 t/a)
linked abbreviated rate ranges
{{bbl to t|100|to|200|per=a|lk=on|abbr=on}} gives 100 to 200 bbl/a (~14 to ~27 t/a)
linked abbreviated rate ranges rounded to three significant figures
{{bbl to t|100|to|200|3|per=d|lk=on|abbr=on}} gives 100 to 200 bbl/d (~13.6 to ~27.3 t/d)
linked abbreviated rate ranges with specified density
{{bbl to t|100|to|200|per=h|lk=on|abbr=on|API=22}} gives 100 to 200 bbl/h (~15 to ~29 t/h)
linked adjectives
{{bbl to t|100|adj=on|lk=on}} gives 100-barrel (~14 t)
linked adjectives with specified density
{{bbl to t|100|adj=on|lk=on|API=22}} gives 100-barrel (~15 t)
linked range adjectives
{{bbl to t|100|to|200|adj=on|lk=on}} gives 100-to−200-barrel (~14 to ~27 t)
linked rate adjectives
{{bbl to t|100|per=h|adj=on|lk=on}} gives 100-barrel-per-day (~14 t/d)
rate range adjectives
{{bbl to t|100|to|200|per=d|adj=on}} gives 100-to−200-barrel-per-day (~14 to ~27 t/d)
linked rate range adjectives
{{bbl to t|100|to|200|per=a|adj=on|lk=on}} gives 100-to−200-barrel-per-annum (~14 to ~27 t/a)
linked abbreviated rate ranges with specified density rounded to three significant figures
{{bbl to t|100|to|200|3|per=a|lk=on|abbr=on|API=22}}
gives 100 to 200 bbl/a (~14.7 to ~29.3 t/a)

Enhancement to allow use of MMTPA

[edit]

I am trying to use this template to represent the capacity of refineries in India. The output produced is difficult to read (and apparently irritating to certain people) because of the use of scientific notation for numbers larger than 100,000. Could this template be enhanced to produce an output using SI prefixes for numbers up to 100,000,000? This is important as most refineries have a capacity that exceeds 100,000 t/a. As an example:

124,200 bbl/d (~6.00 Mt/a) is far more readable than 124,200 bbl/d (~6.00×10^6 t/a)

This would be an enhancement along the lines outlined in the parameter to control the tonne display, as outlined in the previous section Template talk:Bbl to t#National varieties of English.

Albeit not essential, it would be even better if one could (as previously suggested) specify the text of the unit name, so that I could get MMTPA instead of Mt/a for my example. This is because the Indian government has chosen MMTPA as their standard unit of measure. My Gussie (talk) 22:55, 10 December 2018 (UTC)[reply]

For the intended purpose, it would be even better to have a conversion from tonne to bbl, but I suspect that this has not been developed, yet. My Gussie (talk) 22:58, 10 December 2018 (UTC)[reply]

Errors

[edit]

With the recent move of the Template:Rnd to Template:Round the bbl to t conversion no longer works. Please adjust. Thanks. Crook1 (talk) 16:17, 22 April 2019 (UTC)[reply]