The LAMP Application

Generated by IDLdoc

single page | use frames     summary     class     fields     routine details     file attributes

lamp_mac/periodic_table/

io_utilities.pro


NAME: LAMP_READ_CSV PURPOSE: Reads a comma-separated-variables (CSV) file into a structure. CATEGORY: I/O CALLING SEQUENCE: Result = READ_CSV(Filename) INPUTS: Filename: Name of CSV file. The file must contain a header line of the form "# COL1,COL2,COL3...". KEYWORD PARAMETERS: ULON64: A comma-separated list of column names that are to be treated as unsigned long 64-bit integers. STRING: A comma-separated list of column names that are to be treated as strings. DOUBLE: A comma-separated list of column names that are to be treated as doubles. NULL: If there are null fields in the file, they will be assigned to the string specified by the NULL keyword before being cast to the appropriate type. OUTPUTS: The function returns a structure containing one field for each column in the file, named by the entry in the file header. All fields are assumed to be doubles unless their name contains the string 'OBJID', in which case they are assumed to be unsigned long 64-bit integers, or 'NAME', in which case they are assumed to be strings (this comparison is case-insensitive). These defaults can all be over-ridden by using the ULON64, STRING, and DOUBLE keywords. EXAMPLE: If the file 'galaxies.csv' consists of: # NAME,OBJID,RA,DEC M31,493,10.68,41.27 NGC 1068,92,40.67,-0.01 Then reading it in produces: IDL> Galstruct = READ_CSV('galaxies.csv') IDL> HELP, /STRUCT, Galstruct ** Structure <8237564>, 6 tags, length=80, data length=80, refs=1: NAME STRING Array[2] OBJID ULONG64 Array[2] RA DOUBLE Array[2] DEC DOUBLE Array[2] MODIFICATION HISTORY: Modified by: Jeremy Bailin 12 August 2008 Use IDL 5.6 FILE_LINES to count number of lines. Modified by: Vittorio Brando 12 August 2008 added function get_nlines to count lines in not unix OS added function valid_tag_name to ensure that the tag names are IDL compliant Written by: Jeremy Bailin 10 June 2008 Public release in JBIU jbiu@astroconst.org

Routines

result = valid_tag_name(tmp_name)
result = lamp_read_csv(filename, ulon64=ulon64, string=string, double=double, null=null)
lamp_write_csv, filename, csvstruct

io_utilities

Routine details

top valid_tag_name

result = valid_tag_name(tmp_name)

Parameters

tmp_name

top lamp_read_csv

result = lamp_read_csv(filename, ulon64=ulon64, string=string, double=double, null=null)

Parameters

filename

Keywords

ulon64
string
double
null

top lamp_write_csv

lamp_write_csv, filename, csvstruct

NAME: LAMP_WRITE_CSV PURPOSE: Writes a comma-separated-variables (CSV) file from a CSV-style structure as read in by READ_CSV. CATEGORY: I/O CALLING SEQUENCE: WRITE_CSV, Filename, Csvstruct INPUTS: Filename: Name of CSV file to write to. Csvstruct: Structure containing data. If there are N fields, then the first N tags in the structure must be the data fields followed by 2 longs containing NROWS and NCOLS. OUTPUTS: Writes out a comma-separated-variables (CSV) file with a one-line header of the form '# COL1,COL2,COL3....'. EXAMPLE: Write back a CSV structure: IDL> HELP, /STRUCT, Galstruct ** Structure <8237564>, 6 tags, length=80, data length=80, refs=1: NAME STRING Array[2] OBJID ULONG64 Array[2] RA DOUBLE Array[2] DEC DOUBLE Array[2] NROWS LONG 2 NCOLS LONG 4 IDL> WRITE_CSV, 'galaxies.csv', Galstruct MODIFICATION HISTORY: Written by: Jeremy Bailin 11 June 2008 Public release in JBIU

Parameters

filename
csvstruct

top io_utilities

io_utilities

File attributes

Modification date: Tue Oct 1 14:38:51 2013
Lines: 274