Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.

  >  Docs Center  >  Libraries  >  Galloy  >  mg_ascii_template


mg_ascii_template.pro (mglib)

Programmatically creates a structure of the type returned by ASCII_TEMPLATE.


result = mg_ascii_template( [data_start=integer] [, delimiter=byte] [, missing_value=float] [, comment_symbol=string] [, example_row=structure])

Return value



data_start in optional type=integer default=0

offset of where dat begins

delimiter in optional type=byte default=44B

delimiter between values

missing_value in optional type=float default=!values.f_nan

value to replace missing data with

comment_symbol in optional type=string

prefix to comment lines

example_row in optional type=structure

structure defining the data values in a row


For example, read an ASCII file from the IDL distribution:

filename = file_which('ascii.txt')
The first few rows of the file looks like:
This file contains ASCII format weather data in a comma delimited table with comments prefaced by the "%" character. The columns represent: Longitude, latitude, elevation (in feet), temperature (in degrees F), dew point (in degrees F), wind speed (knots), wind direction (degrees) -156.9500, 20.7833, 399, 68, 64, 10, 60 -116.9667, 33.9333, 692, 77, 50, 8, 270 -104.2545, 32.3340, 1003, 87, 50, 10, 340
Define the row using a structure to specify the names, types, and sizes of the fields:
row = { fdata: fltarr(2), ldata: lonarr(5) }
Use the row definition and where the data starts to define the template:
t = mg_ascii_template(data_start=5, example_row=row)
Finally, read the data with the template:
d = read_ascii(filename, template=t)

© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us