This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorials:tool_quick_reference_card [2013/02/12 16:14] marcus.williams |
tutorials:tool_quick_reference_card [2020/09/08 16:12] (current) marcus.williams [TOOL commands] |
||
---|---|---|---|
Line 33: | Line 33: | ||
map1[x,y] = create (; dim=x, dim=y, format=mapping, y1->x1,..,yi->xi,...) | map1[x,y] = create (; dim=x, dim=y, format=mapping, y1->x1,..,yi->xi,...) | ||
map2[x,y] = import (; dataFormat=mapping, y1->x1,..,yi->xi,...) | map2[x,y] = import (; dataFormat=mapping, y1->x1,..,yi->xi,...) | ||
+ | </code> | ||
+ | |||
+ | Note the syntax for one-to-many: | ||
+ | <code> | ||
+ | map1[x,y] = create (; dim=x, dim=y, format=mapping, \ | ||
+ | y1->"x1,x2,x3", ..,yi->xi,...) | ||
</code> | </code> | ||
Line 39: | Line 45: | ||
which matches up element names in Y with those in X. | which matches up element names in Y with those in X. | ||
+ | {{ :howtos:toolcoding:mappingtemplate.xls |Mapping Template}} | ||
==== N ==== | ==== N ==== | ||
**norm()** examples: | **norm()** examples: | ||
Line 55: | Line 62: | ||
a[s,t] = sum (b[s->c,t]; dim=stateCOcounty@state) | a[s,t] = sum (b[s->c,t]; dim=stateCOcounty@state) | ||
a[] = sum (b[s,a]; dim=all) | a[] = sum (b[s,a]; dim=all) | ||
+ | </code> | ||
+ | |||
+ | **shrink()** examples: | ||
+ | <code> | ||
+ | a[t] = shrink (b[byrs,a]) | ||
+ | a[t] = shrink (b[byrs,a]; time) | ||
</code> | </code> | ||
Line 74: | Line 87: | ||
</code> | </code> | ||
- | Navigation and display: ''where(), moveto("pathName"), up(), look(), showenv()'' | + | Navigation and display: ''where()'', ''moveto("pathName")'', ''up()'', ''look()'', ''showenv()'' |
Line 101: | Line 114: | ||
listen (" What is your elec start year? {2007..2090}[2010] ",$elec_startYear) | listen (" What is your elec start year? {2007..2090}[2010] ",$elec_startYear) | ||
if $elec_startYear == 0 | if $elec_startYear == 0 | ||
- | $elec_startYear = 2010 | + | $elec_startYear = 2010 |
endif | endif | ||
</code> | </code> | ||
Line 114: | Line 127: | ||
endif | endif | ||
</code> | </code> | ||
- | |||
- | |||
**menu()** syntax: | **menu()** syntax: | ||
Line 125: | Line 136: | ||
Example1: using variable strings, defaults and one choice only paramters | Example1: using variable strings, defaults and one choice only paramters | ||
<code> | <code> | ||
- | integer $numChoices = 3 | + | integer $numChoices = 3 |
- | boolean $choices[$numChoices] | + | boolean $choices[$numChoices] |
- | string $choiceStrs[$numChoices] | + | string $choiceStrs[$numChoices] |
- | + | ||
- | $choiceStrs[1] = "ON Ministry of Finance - low scenario" | + | |
- | $choiceStrs[2] = "ON Ministry of Finance - reference scenario" | + | |
- | $choiceStrs[3] = "ON Ministry of Finance - high scenario" | + | |
- | + | ||
- | menu ("Which result do you you want to see? ", $numChoices, \ | + | |
- | $choiceStrs[], $choices[]; defaultChoice=1, oneChoice=true) | + | |
- | + | ||
- | if ($choices[1] == true) | + | |
- | say ($choiceStrs[1]) | + | |
- | ... | + | |
- | endif | + | |
- | if ($choices[2] == true) | + | |
- | say ($choiceStrs[2]) | + | |
- | ... | + | |
- | endif | + | |
- | if ($choices[3] == true) | + | |
- | say ($choiceStrs[3]) | + | |
- | ... | + | |
- | endif | + | |
- | etc. | + | $choiceStrs[1] = "ON Ministry of Finance - low scenario" |
+ | $choiceStrs[2] = "ON Ministry of Finance - reference scenario" | ||
+ | $choiceStrs[3] = "ON Ministry of Finance - high scenario" | ||
+ | |||
+ | menu ("Which result do you you want to see? ", $numChoices, \ | ||
+ | $choiceStrs[], $choices[]; defaultChoice=1, oneChoice=true) | ||
+ | |||
+ | if ($choices[1] == true) | ||
+ | say ($choiceStrs[1]) | ||
+ | ... | ||
+ | endif | ||
+ | if ($choices[2] == true) | ||
+ | say ($choiceStrs[2]) | ||
+ | ... | ||
+ | endif | ||
+ | if ($choices[3] == true) | ||
+ | say ($choiceStrs[3]) | ||
+ | ... | ||
+ | endif | ||
</code> | </code> | ||
**If-Else** syntax: | **If-Else** syntax: | ||
Line 177: | Line 186: | ||
</code> | </code> | ||
+ | **Boolean** operators: ''>'', ''<'', ''>='', ''<='', ''=='', ''!='', ''AND'', ''OR'' | ||
===== Object Creation and Shaping ===== | ===== Object Creation and Shaping ===== | ||
Line 319: | Line 329: | ||
kingLear | kingLear | ||
</file> | </file> | ||
+ | |||
+ | Or creation with category definition using parameters: | ||
+ | |||
+ | <code> | ||
+ | localinformant vwcCOvpshd[] = create (; object=category, groups=vehWeightClass, members=vehPowerSrcHD, \ | ||
+ | 4_5andUnder="ICE_Gas ICE_Diesel ICE_NGL", \ | ||
+ | 4_5-14_9="ICE_Gas ICE_Diesel", \ | ||
+ | 15andOver="ICE_Diesel") | ||
+ | </code> | ||
**mapcat()** syntax: | **mapcat()** syntax: | ||
Line 355: | Line 374: | ||
</code> | </code> | ||
- | Variable types: ''integer, real, boolean, string'' | + | Variable types: ''integer'', ''real'', ''boolean'', ''string'' |
+ | TOOL operators by order of precedence: | ||
+ | <code> | ||
+ | * / | ||
+ | + - | ||
+ | > < >= <= | ||
+ | == != | ||
+ | AND OR | ||
+ | assign | ||
+ | </code> | ||
===== Object Display ===== | ===== Object Display ===== | ||
Line 400: | Line 428: | ||
where objectTypes are: ''view, creview, localview'' | where objectTypes are: ''view, creview, localview'' | ||
- | [List reserved TOOL variables] | + | Reserved TOOL variables: ''$numScns'', ''$numVars'', ''$scnNumbers[]'', ''$scnNames[]'', ''$scnColours[]'', ''$scnDescs[]'', ''$createView'', ''$history'', ''$background'' |
**quit()** is called as ''quit (return code)'' | **quit()** is called as ''quit (return code)'' |