This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
howtos:workwithdata:createsetsfromdatafile [2011/05/13 12:37] shona.weldon |
howtos:workwithdata:createsetsfromdatafile [2011/05/13 12:47] shona.weldon |
||
---|---|---|---|
Line 29: | Line 29: | ||
<file> | <file> | ||
- | Region,,,ALBERTA,,,,,,,,,,, | + | Region,,,ALBERTA,,,,,,,,,, |
- | Year,,,2006,,,,,,,,,,, | + | Year,,,2006,,,,,,,,,, |
- | Table 10:,,,Sectoral Greenhouse Gas Emission Summary,,,,,,,,,,, | + | Table 10:,,,Sectoral Greenhouse Gas Emission Summary,,,,,,,,,, |
- | ,,,,,,,,,,,,,, | + | |
- | Greenhouse Gas Categories,,,,,Greenhouse Gases,,,,,,,,, | + | Greenhouse Gas Categories,,,,,Greenhouse Gases,,,,,,,, |
- | ,,,a,b,CO2,CH4,CH4e,N2O,N2Oe, HFCs , PFCs ,SF6,TOTAL, | + | ,,a,b,c,CO2,CH4,CH4e,N2O,N2Oe, HFCs , PFCs ,SF6,TOTAL |
- | ,,,,Global Warming Potential,,,21,,310,,,,, | + | ,,,,Global Warming Potential,,,21,,310,,,, |
- | ,,,,Unit,kt,kt,kt CO2 equivalent, kt ,kt CO2 equivalent,kt CO2 equivalent,kt CO2 equivalent,kt CO2 equivalent,kt CO2 equivalent, | + | ,,,,Unit,kt,kt,kt CO2 equivalent, kt ,kt CO2 equivalent,kt CO2 equivalent,kt CO2 equivalent,kt CO2 equivalent,kt CO2 equivalent |
- | TOTAL,,,,," 179,823 "," 1,921 "," 40,339 ", 43.0 ," 13,328 ", 674 , - , - ,"234,163", | + | ,,,,,,,,,,,,, |
- | ENERGY,,,,," 167,914 "," 1,402.0 "," 29,443 ", 7.8 ," 2,429 ",,,,"199,786", | + | ,,,,,,,,,,,,, |
- | a.,Stationary Combustion Sources,,,," 123,801 ", 74 ," 1,557 ", 3 , 819 ,,,,"126,177", | + | ,Stationary Combustion Sources,,,,"123,801",74,"1,557",3,819,,,,"126,177" |
- | ,Electricity and Heat Generation,,,," 53,600 ", 2 , 31.7 , 1 , 304.3 ,,,,"53,936", | + | ,Electricity and Heat Generation,,,,"53,600",2,31.7,1,304.3,,,,"53,936" |
- | ,Fossil Fuel Production and Refining,,,," 38,618 ", 70 ," 1,475.0 ", 1 , 287.4 ,,,,"40,380", | + | ,Fossil Fuel Production and Refining,,,,"38,618",70,"1,475.00",1,287.4,,,,"40,380" |
- | ,Mining & Oil and Gas Extraction,,,," 11,408 ", 0 , 4.5 , 0 , 83.5 ,,,,"11,496", | + | ,Mining & Oil and Gas Extraction,,,,"11,408",0,4.5,0,83.5,,,,"11,496" |
- | ,Manufacturing Industries,,,," 6,978 ", 0 , 5.9 , 0 , 56.6 ,,,,"7,041", | + | ,Manufacturing Industries,,,,"6,978",0,5.9,0,56.6,,,,"7,041" |
</file> | </file> | ||
Line 89: | Line 89: | ||
===== Example Test Load ===== | ===== Example Test Load ===== | ||
- | Once you have code for reading the sets it's often useful to do a quick test load of the data | + | Once you have code for reading the sets it's often useful to do a quick test load of the data. This file pulls together all the pieces: |
+ | |||
+ | <file> | ||
+ | $informPath = $home + "/V4/informants" | ||
+ | |||
+ | string $importPath, $fileName | ||
+ | buildstring ($importPath, $home, "/testScripts") | ||
+ | |||
+ | buildstring ($fileName, $importPath, "/emtestfile.csv") | ||
+ | |||
+ | localinformant ECemRowTitles[] = create (; object=set, delimiter=",", \ | ||
+ | allowDuplicate=on, \ | ||
+ | elemNamesFromColNum=2, firstLine=11, \ | ||
+ | searchElemName1="", replaceElemName1="blank", \ | ||
+ | searchElemName2="&", replaceElemName2="and", \ | ||
+ | replaceWhiteSpaceInElemName="_" , \ | ||
+ | file=$fileName) | ||
+ | display (ECemRowTitles[]) | ||
+ | export (ECemRowTitles[]; file=$importPath/ECemRowTitles.txt) | ||
+ | |||
+ | |||
+ | localinformant GHGInvEmType[] = create (; object=set, delimiter=",", \ | ||
+ | allowDuplicate=on, \ | ||
+ | elemNamesFromLineNum=6, firstCol=3, \ | ||
+ | searchElemName1="", replaceElemName1="blank", \ | ||
+ | searchElemName2="&", replaceElemName2="and", \ | ||
+ | replaceWhiteSpaceInElemName="_" , \ | ||
+ | file=$fileName) | ||
+ | |||
+ | display (GHGInvEmType[]) | ||
+ | export (GHGInvEmType[]; file=$importPath/GHGInvEmType.txt) | ||
+ | |||
+ | local data[rows,cols] = create (; dim=ECemRowTitles, dim=GHGInvEmType, \ | ||
+ | dataFormat="coordinate", fileFormat="text", allCoord=off, delimiter=",", \ | ||
+ | firstLine=11, firstCol=2, ignoreExtraCols=on, ignoreMissingCols=on, \ | ||
+ | searchData=",", replaceData="" , \ | ||
+ | searchElemName1="", replaceElemName1="blank", \ | ||
+ | searchElemName2="&", replaceElemName2="and", \ | ||
+ | replaceWhiteSpaceInElemName="_" , \ | ||
+ | file=$fileName) | ||
+ | |||
+ | table (data[rows,cols]) | ||
+ | </file> |