This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
howtos:workwithdata:import_quick_reference [2011/08/25 14:55] marcus.williams |
howtos:workwithdata:import_quick_reference [2017/05/18 14:50] marcus.williams [advanced import examples] |
||
---|---|---|---|
Line 4: | Line 4: | ||
<code> | <code> | ||
- | string $importDir= $home + "/V1/primaryData" | + | string $importDir= $modelHome + "/V1/primaryData" |
</code> | </code> | ||
Line 14: | Line 14: | ||
===== csv file ===== | ===== csv file ===== | ||
+ | |||
+ | ==== basic import ==== | ||
This is an example of importing into a very simple mask variable, //zoneMask[z]//, indexed by a single pre-defined informant, //zone//. Here is the top of the source data file //zonesMask.csv//: | This is an example of importing into a very simple mask variable, //zoneMask[z]//, indexed by a single pre-defined informant, //zone//. Here is the top of the source data file //zonesMask.csv//: | ||
Line 49: | Line 51: | ||
file=$importDir/zonesMask.csv) | file=$importDir/zonesMask.csv) | ||
</code> | </code> | ||
+ | |||
+ | ==== advanced import examples ==== | ||
+ | |||
+ | <code> | ||
+ | local occPrivDwellCustSC_1[pzans,dtd] = create (; \ | ||
+ | dim=PLUMzoneAllNS, dim=dwellType_data, \ | ||
+ | entityFrom=occPrivDwellCustSC[pzans,dt,byrs][$index], \ | ||
+ | dataFormat=coordinate, fileFormat=text, \ | ||
+ | allCoord=off, delimiter=",", firstLine=2, \ | ||
+ | searchElemName1=",", replaceElemName1="", \ | ||
+ | searchElemName2="/", replaceElemName2="_", \ | ||
+ | searchElemName3="-", replaceElemName3="_", \ | ||
+ | replaceWhiteSpaceInElemName="_", \ | ||
+ | stripLeadingWhiteSpace=off, \ | ||
+ | searchData=",", replaceData="" , \ | ||
+ | file=$importDir/dwellUnitsByType.csv) | ||
+ | </code> | ||
+ | ==== read localinformants ==== | ||
+ | |||
+ | Read informant definition from column: | ||
+ | |||
+ | <code> | ||
+ | localinformant age_0510002[] = create (; object=set, delimiter=",", \ | ||
+ | allowDuplicate=on, \ | ||
+ | elemNamesFromColNum=3, firstLine=2, \ | ||
+ | searchElemName1=",", replaceElemName1="", \ | ||
+ | searchElemName2="/", replaceElemName2="_", \ | ||
+ | searchElemName3="-", replaceElemName3="_", \ | ||
+ | replaceWhiteSpaceInElemName="_", \ | ||
+ | stripLeadingWhiteSpace=off, \ | ||
+ | file=$importDir/051-0002.csv) | ||
+ | </code> | ||
+ | |||
+ | Read informant definition from line: | ||
+ | |||
+ | <code> | ||
+ | localinformant date_0510002[] = create (; object=set, delimiter=",", \ | ||
+ | allowDuplicate=off, \ | ||
+ | elemNamesFromLineNum=1, firstCol=4, \ | ||
+ | searchElemName1=",", replaceElemName1="", \ | ||
+ | searchElemName2="/", replaceElemName2="_", \ | ||
+ | searchElemName3="-", replaceElemName3="_", \ | ||
+ | replaceWhiteSpaceInElemName="_", \ | ||
+ | stripLeadingWhiteSpace=off, \ | ||
+ | file=$importDir/051-0002.csv) | ||
+ | </code> | ||
+ | |||
===== tab delimited text odometer (block) format ===== | ===== tab delimited text odometer (block) format ===== | ||
Line 69: | Line 118: | ||
</file> | </file> | ||
- | Note the use of the ''firstCol=2'', which is asymmetric to the corresponding export call. | + | Note the use of the ''firstCol=2'' for objects of rank 2 or greater. See the [[howtos:workwithdata:export_quick_reference#tab_delimited_text_odometer_block_format|corresponding export call]]. |
===== TOOL file ===== | ===== TOOL file ===== |