ASCII_TEMPLATE needs to be updated to include the ULL and UL and LL data types. As you've found, they are not an option when using ASCII_TEMPLATE. However there is a way around this.
If you fire up ASCII_TEMPLATE:
IDL>template = ascii_template()
Then go through the motions and create your template, at first setting the field4 type to 'long', even though you know it won't work.
Then you can alter it programatically once it's been created. If you examine the structure that is created:
IDL> help, template, /struct
** Structure , 10 tags, length=224, data length=221, refs=1:
VERSION FLOAT 1.00000
DATASTART LONG 0
DELIMITER BYTE 32
MISSINGVALUE FLOAT NaN
COMMENTSYMBOL STRING ''
FIELDCOUNT LONG 8
FIELDTYPES LONG Array[8]
FIELDNAMES STRING Array[8]
FIELDLOCATIONS LONG Array[8]
FIELDGROUPS LONG Array[8]
you'll see that the template is an IDL structure with the above fields. You can now change the values in the FIELDTYPES field to whatever you want. In this case we know that the fourth column should be ULL, so you can do this:
IDL> template.fieldtypes[3] = 15
15 is the ULL data type (see the IDL help on the SIZE function for a full list of data type numbers). Now when you do this:
IDL> data = read_ascii('test.txt', template=template)
IDL> help, data, /struct
** Structure , 8 tags, length=56, data length=52, refs=1:
FIELD1 LONG Array[1]
FIELD2 STRING Array[1]
FIELD3 STRING Array[1]
FIELD4 ULONG64 Array[1]
FIELD5 FLOAT Array[1]
FIELD6 FLOAT Array[1]
FIELD7 FLOAT Array[1]
FIELD8 LONG Array[1]
IDL> print, data
{ 901
2006/07/04
12:29:25.014385
1152016165014385
48.0082
-65.2851
-998.000
33
}
you can see that now the number is read in correctly.
|