User Tools

Site Tools


howtos:workwithdata:importing_exporting_time_slices_using_a_for_loop

There are occasions when one wants to import/export data to/from a time-sub-scripted object using separate “slices” for each time point. The code below implements the import and inserting of time slices to an object; a similar structure works for extract() and export(). This method can be applied to any object informed and sliced by a sequence - not just time informants.

integer $t
string $filePath
for $t from 1976 upto 2001 by 5
	buildstring ($filePath, $importDir, "/occDU", $t, ".txt")
	say ("    ", $filePath)
	occDUx[th,tt,dt,hhs9+] = import (; rowTitles=on, dataFile=$filePath)
	occDU[tt,hhs9+,dt,th][$index] = insert (occDUx[th,tt,dt,hhs9+]; time:$t)
endfor
howtos/workwithdata/importing_exporting_time_slices_using_a_for_loop.txt · Last modified: 2009/12/08 20:06 by marcus.williams