This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
howtos:workwithdata:export_quick_reference [2010/11/16 16:33] marcus.williams created |
howtos:workwithdata:export_quick_reference [2013/01/31 16:52] (current) marcus.williams |
||
---|---|---|---|
Line 4: | Line 4: | ||
<code> | <code> | ||
- | string $exportDir= $home + "/exportData" | + | string $exportDir= $modelHome + "/exportData" |
</code> | </code> | ||
- | ===== tool file ===== | + | |
+ | ===== csv coordinate format ===== | ||
+ | |||
+ | This code exports a 2-dimensional population TOOL object (by age, by time) to a csv file with age in the rows and time in the columns. | ||
+ | <code> | ||
+ | export (refPop[a,ts]; dataFormat=coordinate, fileFormat=text, allCoord=off, delimiter=",", \ | ||
+ | heading=on, file=$exportDir/refPop.csv) | ||
+ | </code> | ||
+ | |||
+ | ===== tab delimited text odometer (block) format ===== | ||
+ | This format is useful for migrating data between models in a human-readable format, as opposed to binary //tool//-format files. Note the use of ''expForm'' and ''decimals'' parameters to preserve precision. | ||
+ | |||
+ | <code> | ||
+ | export (immigration[s,ts1,a]; dataFormat=odometer, fileFormat=text, \ | ||
+ | expForm=on, decimals=6, \ | ||
+ | file=$exportDir/immigration.txt) | ||
+ | </code> | ||
+ | |||
+ | produces the following (header not shown): | ||
+ | |||
+ | <file> | ||
+ | ! sex=male | ||
+ | ! 0 1 2 | ||
+ | "1977" 1.049407e+02 1.314661e+02 1.317941e+02 | ||
+ | "1978" 9.129648e+01 1.133035e+02 1.212180e+02 | ||
+ | "1979" 8.643492e+01 9.573391e+01 9.366822e+01 | ||
+ | "1980" 9.673356e+01 9.806976e+01 9.806976e+01 | ||
+ | </file> | ||
+ | |||
+ | See the [[howtos:workwithdata:import_quick_reference#tab_delimited_text_odometer_block_format|corresponding import call]]. | ||
+ | |||
+ | ===== TOOL format ===== | ||
This is an example of exporting to whatIf's native (binary) TOOL file format: | This is an example of exporting to whatIf's native (binary) TOOL file format: | ||
<code> | <code> | ||
- | export (customCensusPop[pzce,s,byrs,acc]; file=$exportDir/customCensusPop, \ | + | export (customCensusPop[pzce,s,byrs,acc]; format=tool, file=$exportDir/customCensusPop) |
- | format=tool) | + | |
</code> | </code> | ||