<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.opendap.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Yuan</id>
	<title>OPeNDAP Documentation - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.opendap.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Yuan"/>
	<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php/Special:Contributions/Yuan"/>
	<updated>2026-05-31T08:42:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/adding-appa&amp;diff=2083</id>
		<title>Wiki Testing/adding-appa</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/adding-appa&amp;diff=2083"/>
		<updated>2008-02-07T13:54:31Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* DODS Names */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=DODS Names=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a list of the currently used DODS variable names.   The most&lt;br /&gt;
up-to-date list is available at&lt;br /&gt;
[http://unidata.ucar.edu/packages/dods/names.dat &amp;lt;cite&amp;gt;http://unidata.ucar.edu/packages/dods/names.dat&amp;lt;/cite&amp;gt;]&lt;br /&gt;
Where one exists, the GCMD parameter name follows the DODS variable&lt;br /&gt;
name.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/adding-attr&amp;diff=2077</id>
		<title>Wiki Testing/adding-attr</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/adding-attr&amp;diff=2077"/>
		<updated>2008-02-07T12:44:23Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* A Worked Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Adding Data Attributes=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One of the original design goals of DODS was to permit data providers&lt;br /&gt;
to use DODS with as little work as possible.  A corollary to this&lt;br /&gt;
requirement is that if ancillary information about a dataset is&lt;br /&gt;
required, it must be very easy to provide.  The DODS architecture&lt;br /&gt;
allows a data provider to add attribute information to a dataset&lt;br /&gt;
without modifying the data files at all.  All that is required is a&lt;br /&gt;
separate file, stored in the same directory as the data.&lt;br /&gt;
&lt;br /&gt;
This chapter shows how you can easily add attribute information to an&lt;br /&gt;
existing dataset to comply with the DODS data standard.  We start by&lt;br /&gt;
creating a small dataset and serving it with DODS FreeForm .  A similar&lt;br /&gt;
example is presented in [http://docs.opendap.org/index.php/Wiki_Testing/dpref&amp;lt;cite&amp;gt;FreeForm Guide&amp;lt;/cite&amp;gt;] , highlighting different aspects.&lt;br /&gt;
&lt;br /&gt;
All the files used in this chapter are available on the [http://www.opendap.org/examples/ffsimple.dat&amp;lt;cite&amp;gt;DODS examples&amp;lt;/cite&amp;gt;] .&lt;br /&gt;
&lt;br /&gt;
==A Worked Example==&lt;br /&gt;
&lt;br /&gt;
Consider the following table of numbers:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101  1.17125&lt;br /&gt;
-25.928001   -0.777265  2.07288&lt;br /&gt;
-28.286662   35.591879  2.36377&lt;br /&gt;
&lt;br /&gt;
12.588231  149.408117 -100.000&lt;br /&gt;
-63.223548   55.319598  0.04503&lt;br /&gt;
&lt;br /&gt;
54.118314 -136.940570  1.04085&lt;br /&gt;
-38.818812   91.411330  1.39978&lt;br /&gt;
-34.577065   30.172129  2.09096&lt;br /&gt;
&lt;br /&gt;
27.331551 -155.233735  2.30917&lt;br /&gt;
&lt;br /&gt;
11.624981 -113.660611  2.75036&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This table represents a series of temperature measurements at ten&lt;br /&gt;
different geographical locations.  The latitudes and longitudes are&lt;br /&gt;
given in decimal degrees, and the temperatures are given in units of&lt;br /&gt;
ten degrees.  That is, the temperature as recorded, times ten, equals&lt;br /&gt;
the temperature in Celsius.  There is one temperature measurement&lt;br /&gt;
missing, and its place is marked with a value of &amp;lt;font color=&#039;green&#039;&amp;gt;-100.0&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(This dataset, and the ancillary files discussed in this chapter, are&lt;br /&gt;
in the DODS examples directory, and is available at the DODS examples ,&lt;br /&gt;
under &amp;lt;font color=&#039;green&#039;&amp;gt;dasex.*&amp;lt;/font&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
The dataset shown here can be served as is, with the FreeForm NDs , using&lt;br /&gt;
the following format file (&amp;lt;font color=&#039;green&#039;&amp;gt;dasex.fmt&amp;lt;/font&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ASCII_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
t 24 31 double 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put both of these files in your &amp;lt;font color=&#039;green&#039;&amp;gt;htdocs&amp;lt;/font&amp;gt; directory (refer to the&lt;br /&gt;
documentation for your web server to locate this directory).  After&lt;br /&gt;
installing the FreeForm ND , you can issue data requests on this&lt;br /&gt;
dataset.  Use a web browser like netscape, and enter the following&lt;br /&gt;
URL (Use your own server&#039;s name instead of &amp;lt;font color=&#039;green&#039;&amp;gt;machine.edu&amp;lt;/font&amp;gt;.):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://machine.edu/cgi-bin/nph-ff/dasex.dat.dds&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Sequence {&lt;br /&gt;
&lt;br /&gt;
Float64 latitude;&lt;br /&gt;
&lt;br /&gt;
Float64 longitude;&lt;br /&gt;
&lt;br /&gt;
Float64 t;&lt;br /&gt;
&lt;br /&gt;
} lat/lon;&lt;br /&gt;
} dasex;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The is the DDS (Data Description Structure) of the dasex dataset.  (See&lt;br /&gt;
[http://docs.opendap.org/index.php/Wiki_Testing/OpeNDAP_User%27s_Guide&amp;lt;cite&amp;gt;DODS User Guide&amp;lt;/cite&amp;gt;] for more information about the DDS and what it means, as&lt;br /&gt;
well as a description of what a Sequence is.)  Instead of &amp;lt;font color=&#039;green&#039;&amp;gt;.dds&amp;lt;/font&amp;gt; at&lt;br /&gt;
the end of the URL, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;.asc&amp;lt;/font&amp;gt; to see the data itself.&lt;br /&gt;
Try that.&lt;br /&gt;
&lt;br /&gt;
To see data attributes, try the same URL, ending with &amp;lt;font color=&#039;green&#039;&amp;gt;.das&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://machine.edu/cgi-bin/nph-ff/dasex.dat.das&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
FF_GLOBAL {&lt;br /&gt;
&lt;br /&gt;
String Server &amp;quot;DODS FFND release 4.2.3&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String Native_file &amp;quot; ...&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS is a list of the dataset&#039;s attributes.  This dataset has two,&lt;br /&gt;
and they are global ones.  That is, they describe the entire dataset,&lt;br /&gt;
and don&#039;t correspond to any of the data variables listed in the DDS.&lt;br /&gt;
They are also in a container called &amp;lt;font color=&#039;green&#039;&amp;gt;FF_GLOBAL&amp;lt;/font&amp;gt;, which is another&lt;br /&gt;
hint that they are global attributes.  The &amp;lt;font color=&#039;green&#039;&amp;gt;Server&amp;lt;/font&amp;gt; string&lt;br /&gt;
describes the actual DODS server that sent the data, and the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;Native_file&amp;lt;/font&amp;gt; string is a long one, containing information about&lt;br /&gt;
the original file, and what it contained.&lt;br /&gt;
&lt;br /&gt;
This is all very well, but what if someone wanted to know what units&lt;br /&gt;
the &amp;lt;font color=&#039;green&#039;&amp;gt;t&amp;lt;/font&amp;gt; variable was in, or where the data came from, or what that&lt;br /&gt;
value of -100 is supposed to imply, or even whether the variable&lt;br /&gt;
represents temperature or time.  The data themselves are silent on&lt;br /&gt;
those issues, so either we have to provide additional documentation,&lt;br /&gt;
or we have to introduce attributes for the data variables, to make the&lt;br /&gt;
dataset self-documenting.  We do that with an ancillary file of data&lt;br /&gt;
attributes.  Call this file &amp;lt;font color=&#039;green&#039;&amp;gt;dasex.das&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
t {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float64 missing_data -100.0;&lt;br /&gt;
&lt;br /&gt;
Float64 scale_factor 10.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
latitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_north&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
longitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_east&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the DAS that is returned from the dataset looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
FF_GLOBAL {&lt;br /&gt;
&lt;br /&gt;
String Server &amp;quot;DODS FFND release 4.2.3&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String Native_file &amp;quot;...&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
temp {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float64 missing_data -100.0;&lt;br /&gt;
&lt;br /&gt;
Float64 scale_factor 10.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
latitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_north&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
longitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_east&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can see that &amp;lt;font color=&#039;green&#039;&amp;gt;t&amp;lt;/font&amp;gt; stands for &amp;quot;Temperature&amp;quot; and that the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;-100&amp;lt;/font&amp;gt; is missing data, and that all the measurements have to&lt;br /&gt;
multiplied by 10 before they are in degrees Celsius.&lt;br /&gt;
&lt;br /&gt;
Now that the data have these additional attributes, the dataset is&lt;br /&gt;
compliant with level 1 of the DODS data standard.  This can also be&lt;br /&gt;
noted in the DAS, with the addition of another global attribute&lt;br /&gt;
container called &amp;lt;font color=&#039;green&#039;&amp;gt;DODS&amp;lt;/font&amp;gt;.  A file called &amp;lt;font color=&#039;green&#039;&amp;gt;dasex2.das&amp;lt;/font&amp;gt; contains&lt;br /&gt;
the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String Conventions &amp;quot;DODS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String Acknowledge &amp;quot;Example dataset from the DODS documentation.&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String history &amp;quot;Created for DODS standards book.&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add this information to the bottom of the &amp;lt;font color=&#039;green&#039;&amp;gt;dasex.das&amp;lt;/font&amp;gt; file&lt;br /&gt;
(&#039;&#039;before&#039;&#039;  the last closing bracket), and now the dataset is&lt;br /&gt;
compliant with level 2 of the DODS data standard.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/adding-attr&amp;diff=2076</id>
		<title>Wiki Testing/adding-attr</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/adding-attr&amp;diff=2076"/>
		<updated>2008-02-07T12:23:18Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* A Worked Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Adding Data Attributes=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One of the original design goals of DODS was to permit data providers&lt;br /&gt;
to use DODS with as little work as possible.  A corollary to this&lt;br /&gt;
requirement is that if ancillary information about a dataset is&lt;br /&gt;
required, it must be very easy to provide.  The DODS architecture&lt;br /&gt;
allows a data provider to add attribute information to a dataset&lt;br /&gt;
without modifying the data files at all.  All that is required is a&lt;br /&gt;
separate file, stored in the same directory as the data.&lt;br /&gt;
&lt;br /&gt;
This chapter shows how you can easily add attribute information to an&lt;br /&gt;
existing dataset to comply with the DODS data standard.  We start by&lt;br /&gt;
creating a small dataset and serving it with DODS FreeForm .  A similar&lt;br /&gt;
example is presented in [http://docs.opendap.org/index.php/Wiki_Testing/dpref&amp;lt;cite&amp;gt;FreeForm Guide&amp;lt;/cite&amp;gt;] , highlighting different aspects.&lt;br /&gt;
&lt;br /&gt;
All the files used in this chapter are available on the [http://www.opendap.org/examples/ffsimple.dat&amp;lt;cite&amp;gt;DODS examples&amp;lt;/cite&amp;gt;] .&lt;br /&gt;
&lt;br /&gt;
==A Worked Example==&lt;br /&gt;
&lt;br /&gt;
Consider the following table of numbers:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101  1.17125&lt;br /&gt;
-25.928001   -0.777265  2.07288&lt;br /&gt;
-28.286662   35.591879  2.36377&lt;br /&gt;
&lt;br /&gt;
12.588231  149.408117 -100.000&lt;br /&gt;
-63.223548   55.319598  0.04503&lt;br /&gt;
&lt;br /&gt;
54.118314 -136.940570  1.04085&lt;br /&gt;
-38.818812   91.411330  1.39978&lt;br /&gt;
-34.577065   30.172129  2.09096&lt;br /&gt;
&lt;br /&gt;
27.331551 -155.233735  2.30917&lt;br /&gt;
&lt;br /&gt;
11.624981 -113.660611  2.75036&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This table represents a series of temperature measurements at ten&lt;br /&gt;
different geographical locations.  The latitudes and longitudes are&lt;br /&gt;
given in decimal degrees, and the temperatures are given in units of&lt;br /&gt;
ten degrees.  That is, the temperature as recorded, times ten, equals&lt;br /&gt;
the temperature in Celsius.  There is one temperature measurement&lt;br /&gt;
missing, and its place is marked with a value of &amp;lt;font color=&#039;green&#039;&amp;gt;-100.0&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(This dataset, and the ancillary files discussed in this chapter, are&lt;br /&gt;
in the DODS examples directory, and is available at the DODS examples ,&lt;br /&gt;
under &amp;lt;font color=&#039;green&#039;&amp;gt;dasex.*&amp;lt;/font&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
The dataset shown here can be served as is, with the FreeForm NDs , using&lt;br /&gt;
the following format file (&amp;lt;font color=&#039;green&#039;&amp;gt;dasex.fmt&amp;lt;/font&amp;gt;):\footnote{See the&lt;br /&gt;
&lt;br /&gt;
[http://docs.opendap.org/index.php/Wiki_Testing/dpref&amp;lt;cite&amp;gt;FreeForms Guide&amp;lt;/cite&amp;gt;] for more information about that software.}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ASCII_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
t 24 31 double 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put both of these files in your &amp;lt;font color=&#039;green&#039;&amp;gt;htdocs&amp;lt;/font&amp;gt; directory (refer to the&lt;br /&gt;
documentation for your web server to locate this directory).  After&lt;br /&gt;
installing the FreeForm ND , you can issue data requests on this&lt;br /&gt;
dataset.  Use a web browser like netscape, and enter the following&lt;br /&gt;
URL (Use your own server&#039;s name instead of &amp;lt;font color=&#039;green&#039;&amp;gt;machine.edu&amp;lt;/font&amp;gt;.):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://machine.edu/cgi-bin/nph-ff/dasex.dat.dds&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Sequence {&lt;br /&gt;
&lt;br /&gt;
Float64 latitude;&lt;br /&gt;
&lt;br /&gt;
Float64 longitude;&lt;br /&gt;
&lt;br /&gt;
Float64 t;&lt;br /&gt;
&lt;br /&gt;
} lat/lon;&lt;br /&gt;
} dasex;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The is the DDS (Data Description Structure) of the dasex dataset.  (See&lt;br /&gt;
[http://docs.opendap.org/index.php/Wiki_Testing/OpeNDAP_User%27s_Guide&amp;lt;cite&amp;gt;DODS User Guide&amp;lt;/cite&amp;gt;] for more information about the DDS and what it means, as&lt;br /&gt;
well as a description of what a Sequence is.)  Instead of &amp;lt;font color=&#039;green&#039;&amp;gt;.dds&amp;lt;/font&amp;gt; at&lt;br /&gt;
the end of the URL, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;.asc&amp;lt;/font&amp;gt; to see the data itself.&lt;br /&gt;
Try that.&lt;br /&gt;
&lt;br /&gt;
To see data attributes, try the same URL, ending with &amp;lt;font color=&#039;green&#039;&amp;gt;.das&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://machine.edu/cgi-bin/nph-ff/dasex.dat.das&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
FF_GLOBAL {&lt;br /&gt;
&lt;br /&gt;
String Server &amp;quot;DODS FFND release 4.2.3&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String Native_file &amp;quot; ...&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS is a list of the dataset&#039;s attributes.  This dataset has two,&lt;br /&gt;
and they are global ones.  That is, they describe the entire dataset,&lt;br /&gt;
and don&#039;t correspond to any of the data variables listed in the DDS.&lt;br /&gt;
They are also in a container called &amp;lt;font color=&#039;green&#039;&amp;gt;FF_GLOBAL&amp;lt;/font&amp;gt;, which is another&lt;br /&gt;
hint that they are global attributes.  The &amp;lt;font color=&#039;green&#039;&amp;gt;Server&amp;lt;/font&amp;gt; string&lt;br /&gt;
describes the actual DODS server that sent the data, and the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;Native_file&amp;lt;/font&amp;gt; string is a long one, containing information about&lt;br /&gt;
the original file, and what it contained.&lt;br /&gt;
&lt;br /&gt;
This is all very well, but what if someone wanted to know what units&lt;br /&gt;
the &amp;lt;font color=&#039;green&#039;&amp;gt;t&amp;lt;/font&amp;gt; variable was in, or where the data came from, or what that&lt;br /&gt;
value of -100 is supposed to imply, or even whether the variable&lt;br /&gt;
represents temperature or time.  The data themselves are silent on&lt;br /&gt;
those issues, so either we have to provide additional documentation,&lt;br /&gt;
or we have to introduce attributes for the data variables, to make the&lt;br /&gt;
dataset self-documenting.  We do that with an ancillary file of data&lt;br /&gt;
attributes.  Call this file &amp;lt;font color=&#039;green&#039;&amp;gt;dasex.das&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
t {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float64 missing_data -100.0;&lt;br /&gt;
&lt;br /&gt;
Float64 scale_factor 10.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
latitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_north&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
longitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_east&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the DAS that is returned from the dataset looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
FF_GLOBAL {&lt;br /&gt;
&lt;br /&gt;
String Server &amp;quot;DODS FFND release 4.2.3&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String Native_file &amp;quot;...&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
temp {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float64 missing_data -100.0;&lt;br /&gt;
&lt;br /&gt;
Float64 scale_factor 10.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
latitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_north&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
longitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_east&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can see that &amp;lt;font color=&#039;green&#039;&amp;gt;t&amp;lt;/font&amp;gt; stands for &amp;quot;Temperature&amp;quot; and that the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;-100&amp;lt;/font&amp;gt; is missing data, and that all the measurements have to&lt;br /&gt;
multiplied by 10 before they are in degrees Celsius.&lt;br /&gt;
&lt;br /&gt;
Now that the data have these additional attributes, the dataset is&lt;br /&gt;
compliant with level 1 of the DODS data standard.  This can also be&lt;br /&gt;
noted in the DAS, with the addition of another global attribute&lt;br /&gt;
container called &amp;lt;font color=&#039;green&#039;&amp;gt;DODS&amp;lt;/font&amp;gt;.  A file called &amp;lt;font color=&#039;green&#039;&amp;gt;dasex2.das&amp;lt;/font&amp;gt; contains&lt;br /&gt;
the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String Conventions &amp;quot;DODS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String Acknowledge &amp;quot;Example dataset from the DODS documentation.&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String history &amp;quot;Created for DODS standards book.&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add this information to the bottom of the &amp;lt;font color=&#039;green&#039;&amp;gt;dasex.das&amp;lt;/font&amp;gt; file&lt;br /&gt;
(&#039;&#039;before&#039;&#039;  the last closing bracket), and now the dataset is&lt;br /&gt;
compliant with level 2 of the DODS data standard.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/adding-attr&amp;diff=2075</id>
		<title>Wiki Testing/adding-attr</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/adding-attr&amp;diff=2075"/>
		<updated>2008-02-07T12:17:11Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Adding Data Attributes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Adding Data Attributes=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One of the original design goals of DODS was to permit data providers&lt;br /&gt;
to use DODS with as little work as possible.  A corollary to this&lt;br /&gt;
requirement is that if ancillary information about a dataset is&lt;br /&gt;
required, it must be very easy to provide.  The DODS architecture&lt;br /&gt;
allows a data provider to add attribute information to a dataset&lt;br /&gt;
without modifying the data files at all.  All that is required is a&lt;br /&gt;
separate file, stored in the same directory as the data.&lt;br /&gt;
&lt;br /&gt;
This chapter shows how you can easily add attribute information to an&lt;br /&gt;
existing dataset to comply with the DODS data standard.  We start by&lt;br /&gt;
creating a small dataset and serving it with DODS FreeForm .  A similar&lt;br /&gt;
example is presented in [http://docs.opendap.org/index.php/Wiki_Testing/dpref&amp;lt;cite&amp;gt;FreeForm Guide&amp;lt;/cite&amp;gt;] , highlighting different aspects.&lt;br /&gt;
&lt;br /&gt;
All the files used in this chapter are available on the [http://www.opendap.org/examples/ffsimple.dat&amp;lt;cite&amp;gt;DODS examples&amp;lt;/cite&amp;gt;] .&lt;br /&gt;
&lt;br /&gt;
==A Worked Example==&lt;br /&gt;
&lt;br /&gt;
Consider the following table of numbers:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101  1.17125&lt;br /&gt;
-25.928001   -0.777265  2.07288&lt;br /&gt;
-28.286662   35.591879  2.36377&lt;br /&gt;
&lt;br /&gt;
12.588231  149.408117 -100.000&lt;br /&gt;
-63.223548   55.319598  0.04503&lt;br /&gt;
&lt;br /&gt;
54.118314 -136.940570  1.04085&lt;br /&gt;
-38.818812   91.411330  1.39978&lt;br /&gt;
-34.577065   30.172129  2.09096&lt;br /&gt;
&lt;br /&gt;
27.331551 -155.233735  2.30917&lt;br /&gt;
&lt;br /&gt;
11.624981 -113.660611  2.75036&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This table represents a series of temperature measurements at ten&lt;br /&gt;
different geographical locations.  The latitudes and longitudes are&lt;br /&gt;
given in decimal degrees, and the temperatures are given in units of&lt;br /&gt;
ten degrees.  That is, the temperature as recorded, times ten, equals&lt;br /&gt;
the temperature in Celsius.  There is one temperature measurement&lt;br /&gt;
missing, and its place is marked with a value of &amp;lt;font color=&#039;green&#039;&amp;gt;-100.0&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(This dataset, and the ancillary files discussed in this chapter, are&lt;br /&gt;
in the DODS examples directory, and is available at the \DODSexamples ,&lt;br /&gt;
under &amp;lt;font color=&#039;green&#039;&amp;gt;dasex.*&amp;lt;/font&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
The dataset shown here can be served as is, with the \DODSffs , using&lt;br /&gt;
the following format file (&amp;lt;font color=&#039;green&#039;&amp;gt;dasex.fmt&amp;lt;/font&amp;gt;):\footnote{See the&lt;br /&gt;
&lt;br /&gt;
\DODSffbook for more information about that software.}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ASCII_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
t 24 31 double 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put both of these files in your &amp;lt;font color=&#039;green&#039;&amp;gt;htdocs&amp;lt;/font&amp;gt; directory (refer to the&lt;br /&gt;
documentation for your web server to locate this directory).  After&lt;br /&gt;
installing the \DODSffs , you can issue data requests on this&lt;br /&gt;
dataset.  Use a web browser like netscape, and enter the following&lt;br /&gt;
URL (Use your own server&#039;s name instead of &amp;lt;font color=&#039;green&#039;&amp;gt;machine.edu&amp;lt;/font&amp;gt;.):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://machine.edu/cgi-bin/nph-ff/dasex.dat.dds&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Sequence {&lt;br /&gt;
&lt;br /&gt;
Float64 latitude;&lt;br /&gt;
&lt;br /&gt;
Float64 longitude;&lt;br /&gt;
&lt;br /&gt;
Float64 t;&lt;br /&gt;
&lt;br /&gt;
} lat/lon;&lt;br /&gt;
} dasex;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The is the DDS (Data Description Structure) of the dasex dataset.  (See&lt;br /&gt;
\DODSuser for more information about the DDS and what it means, as&lt;br /&gt;
well as a description of what a Sequence is.)  Instead of &amp;lt;font color=&#039;green&#039;&amp;gt;.dds&amp;lt;/font&amp;gt; at&lt;br /&gt;
the end of the URL, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;.asc&amp;lt;/font&amp;gt; to see the data itself.&lt;br /&gt;
Try that.&lt;br /&gt;
&lt;br /&gt;
To see data attributes, try the same URL, ending with &amp;lt;font color=&#039;green&#039;&amp;gt;.das&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://machine.edu/cgi-bin/nph-ff/dasex.dat.das&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
FF_GLOBAL {&lt;br /&gt;
&lt;br /&gt;
String Server &amp;quot;DODS FFND release 4.2.3&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String Native_file &amp;quot; ...&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS is a list of the dataset&#039;s attributes.  This dataset has two,&lt;br /&gt;
and they are global ones.  That is, they describe the entire dataset,&lt;br /&gt;
and don&#039;t correspond to any of the data variables listed in the DDS.&lt;br /&gt;
They are also in a container called &amp;lt;font color=&#039;green&#039;&amp;gt;FF_GLOBAL&amp;lt;/font&amp;gt;, which is another&lt;br /&gt;
hint that they are global attributes.  The &amp;lt;font color=&#039;green&#039;&amp;gt;Server&amp;lt;/font&amp;gt; string&lt;br /&gt;
describes the actual DODS server that sent the data, and the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;Native_file&amp;lt;/font&amp;gt; string is a long one, containing information about&lt;br /&gt;
the original file, and what it contained.&lt;br /&gt;
&lt;br /&gt;
This is all very well, but what if someone wanted to know what units&lt;br /&gt;
the &amp;lt;font color=&#039;green&#039;&amp;gt;t&amp;lt;/font&amp;gt; variable was in, or where the data came from, or what that&lt;br /&gt;
value of -100 is supposed to imply, or even whether the variable&lt;br /&gt;
represents temperature or time.  The data themselves are silent on&lt;br /&gt;
those issues, so either we have to provide additional documentation,&lt;br /&gt;
or we have to introduce attributes for the data variables, to make the&lt;br /&gt;
dataset self-documenting.  We do that with an ancillary file of data&lt;br /&gt;
attributes.  Call this file &amp;lt;font color=&#039;green&#039;&amp;gt;dasex.das&amp;lt;/font&amp;gt;\footnote{It is called&lt;br /&gt;
&lt;br /&gt;
dasex1.das in the \DODSexamples .  You will have to rename this file&lt;br /&gt;
&lt;br /&gt;
to make it work.}:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
t {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float64 missing_data -100.0;&lt;br /&gt;
&lt;br /&gt;
Float64 scale_factor 10.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
latitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_north&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
longitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_east&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the DAS that is returned from the dataset looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
FF_GLOBAL {&lt;br /&gt;
&lt;br /&gt;
String Server &amp;quot;DODS FFND release 4.2.3&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String Native_file &amp;quot;...&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
temp {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float64 missing_data -100.0;&lt;br /&gt;
&lt;br /&gt;
Float64 scale_factor 10.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
latitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_north&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
longitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_east&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can see that &amp;lt;font color=&#039;green&#039;&amp;gt;t&amp;lt;/font&amp;gt; stands for &amp;quot;Temperature&amp;quot; and that the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;-100&amp;lt;/font&amp;gt; is missing data, and that all the measurements have to&lt;br /&gt;
multiplied by 10 before they are in degrees Celsius.&lt;br /&gt;
&lt;br /&gt;
Now that the data have these additional attributes, the dataset is&lt;br /&gt;
compliant with level 1 of the DODS data standard.  This can also be&lt;br /&gt;
noted in the DAS, with the addition of another global attribute&lt;br /&gt;
container called &amp;lt;font color=&#039;green&#039;&amp;gt;DODS&amp;lt;/font&amp;gt;.  A file called &amp;lt;font color=&#039;green&#039;&amp;gt;dasex2.das&amp;lt;/font&amp;gt; contains&lt;br /&gt;
the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String Conventions &amp;quot;DODS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String Acknowledge &amp;quot;Example dataset from the DODS documentation.&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String history &amp;quot;Created for DODS standards book.&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add this information to the bottom of the &amp;lt;font color=&#039;green&#039;&amp;gt;dasex.das&amp;lt;/font&amp;gt; file&lt;br /&gt;
(&#039;&#039;before&#039;&#039;  the last closing bracket), and now the dataset is&lt;br /&gt;
compliant with level 2 of the DODS data standard.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/adding-attr&amp;diff=2073</id>
		<title>Wiki Testing/adding-attr</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/adding-attr&amp;diff=2073"/>
		<updated>2008-02-07T12:13:08Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Adding Data Attributes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Adding Data Attributes=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One of the original design goals of DODS was to permit data providers&lt;br /&gt;
to use DODS with as little work as possible.  A corollary to this&lt;br /&gt;
requirement is that if ancillary information about a dataset is&lt;br /&gt;
required, it must be very easy to provide.  The DODS architecture&lt;br /&gt;
allows a data provider to add attribute information to a dataset&lt;br /&gt;
without modifying the data files at all.  All that is required is a&lt;br /&gt;
separate file, stored in the same directory as the data.&lt;br /&gt;
&lt;br /&gt;
This chapter shows how you can easily add attribute information to an&lt;br /&gt;
existing dataset to comply with the DODS data standard.  We start by&lt;br /&gt;
creating a small dataset and serving it with DODS FreeForm .  A similar&lt;br /&gt;
example is presented in [http://docs.opendap.org/index.php/Wiki_Testing/dpref&amp;lt;cite&amp;gt;FreeForm Guide&amp;lt;/cite&amp;gt;] , highlighting different aspects.&lt;br /&gt;
&lt;br /&gt;
All the files used in this chapter are available on the \DODSexamples .&lt;br /&gt;
&lt;br /&gt;
==A Worked Example==&lt;br /&gt;
&lt;br /&gt;
Consider the following table of numbers:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101  1.17125&lt;br /&gt;
-25.928001   -0.777265  2.07288&lt;br /&gt;
-28.286662   35.591879  2.36377&lt;br /&gt;
&lt;br /&gt;
12.588231  149.408117 -100.000&lt;br /&gt;
-63.223548   55.319598  0.04503&lt;br /&gt;
&lt;br /&gt;
54.118314 -136.940570  1.04085&lt;br /&gt;
-38.818812   91.411330  1.39978&lt;br /&gt;
-34.577065   30.172129  2.09096&lt;br /&gt;
&lt;br /&gt;
27.331551 -155.233735  2.30917&lt;br /&gt;
&lt;br /&gt;
11.624981 -113.660611  2.75036&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This table represents a series of temperature measurements at ten&lt;br /&gt;
different geographical locations.  The latitudes and longitudes are&lt;br /&gt;
given in decimal degrees, and the temperatures are given in units of&lt;br /&gt;
ten degrees.  That is, the temperature as recorded, times ten, equals&lt;br /&gt;
the temperature in Celsius.  There is one temperature measurement&lt;br /&gt;
missing, and its place is marked with a value of &amp;lt;font color=&#039;green&#039;&amp;gt;-100.0&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(This dataset, and the ancillary files discussed in this chapter, are&lt;br /&gt;
in the DODS examples directory, and is available at the \DODSexamples ,&lt;br /&gt;
under &amp;lt;font color=&#039;green&#039;&amp;gt;dasex.*&amp;lt;/font&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
The dataset shown here can be served as is, with the \DODSffs , using&lt;br /&gt;
the following format file (&amp;lt;font color=&#039;green&#039;&amp;gt;dasex.fmt&amp;lt;/font&amp;gt;):\footnote{See the&lt;br /&gt;
&lt;br /&gt;
\DODSffbook for more information about that software.}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ASCII_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
t 24 31 double 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put both of these files in your &amp;lt;font color=&#039;green&#039;&amp;gt;htdocs&amp;lt;/font&amp;gt; directory (refer to the&lt;br /&gt;
documentation for your web server to locate this directory).  After&lt;br /&gt;
installing the \DODSffs , you can issue data requests on this&lt;br /&gt;
dataset.  Use a web browser like netscape, and enter the following&lt;br /&gt;
URL (Use your own server&#039;s name instead of &amp;lt;font color=&#039;green&#039;&amp;gt;machine.edu&amp;lt;/font&amp;gt;.):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://machine.edu/cgi-bin/nph-ff/dasex.dat.dds&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Sequence {&lt;br /&gt;
&lt;br /&gt;
Float64 latitude;&lt;br /&gt;
&lt;br /&gt;
Float64 longitude;&lt;br /&gt;
&lt;br /&gt;
Float64 t;&lt;br /&gt;
&lt;br /&gt;
} lat/lon;&lt;br /&gt;
} dasex;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The is the DDS (Data Description Structure) of the dasex dataset.  (See&lt;br /&gt;
\DODSuser for more information about the DDS and what it means, as&lt;br /&gt;
well as a description of what a Sequence is.)  Instead of &amp;lt;font color=&#039;green&#039;&amp;gt;.dds&amp;lt;/font&amp;gt; at&lt;br /&gt;
the end of the URL, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;.asc&amp;lt;/font&amp;gt; to see the data itself.&lt;br /&gt;
Try that.&lt;br /&gt;
&lt;br /&gt;
To see data attributes, try the same URL, ending with &amp;lt;font color=&#039;green&#039;&amp;gt;.das&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://machine.edu/cgi-bin/nph-ff/dasex.dat.das&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
FF_GLOBAL {&lt;br /&gt;
&lt;br /&gt;
String Server &amp;quot;DODS FFND release 4.2.3&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String Native_file &amp;quot; ...&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS is a list of the dataset&#039;s attributes.  This dataset has two,&lt;br /&gt;
and they are global ones.  That is, they describe the entire dataset,&lt;br /&gt;
and don&#039;t correspond to any of the data variables listed in the DDS.&lt;br /&gt;
They are also in a container called &amp;lt;font color=&#039;green&#039;&amp;gt;FF_GLOBAL&amp;lt;/font&amp;gt;, which is another&lt;br /&gt;
hint that they are global attributes.  The &amp;lt;font color=&#039;green&#039;&amp;gt;Server&amp;lt;/font&amp;gt; string&lt;br /&gt;
describes the actual DODS server that sent the data, and the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;Native_file&amp;lt;/font&amp;gt; string is a long one, containing information about&lt;br /&gt;
the original file, and what it contained.&lt;br /&gt;
&lt;br /&gt;
This is all very well, but what if someone wanted to know what units&lt;br /&gt;
the &amp;lt;font color=&#039;green&#039;&amp;gt;t&amp;lt;/font&amp;gt; variable was in, or where the data came from, or what that&lt;br /&gt;
value of -100 is supposed to imply, or even whether the variable&lt;br /&gt;
represents temperature or time.  The data themselves are silent on&lt;br /&gt;
those issues, so either we have to provide additional documentation,&lt;br /&gt;
or we have to introduce attributes for the data variables, to make the&lt;br /&gt;
dataset self-documenting.  We do that with an ancillary file of data&lt;br /&gt;
attributes.  Call this file &amp;lt;font color=&#039;green&#039;&amp;gt;dasex.das&amp;lt;/font&amp;gt;\footnote{It is called&lt;br /&gt;
&lt;br /&gt;
dasex1.das in the \DODSexamples .  You will have to rename this file&lt;br /&gt;
&lt;br /&gt;
to make it work.}:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
t {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float64 missing_data -100.0;&lt;br /&gt;
&lt;br /&gt;
Float64 scale_factor 10.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
latitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_north&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
longitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_east&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the DAS that is returned from the dataset looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
FF_GLOBAL {&lt;br /&gt;
&lt;br /&gt;
String Server &amp;quot;DODS FFND release 4.2.3&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String Native_file &amp;quot;...&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
temp {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float64 missing_data -100.0;&lt;br /&gt;
&lt;br /&gt;
Float64 scale_factor 10.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
latitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_north&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
longitude {&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree_east&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can see that &amp;lt;font color=&#039;green&#039;&amp;gt;t&amp;lt;/font&amp;gt; stands for &amp;quot;Temperature&amp;quot; and that the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;-100&amp;lt;/font&amp;gt; is missing data, and that all the measurements have to&lt;br /&gt;
multiplied by 10 before they are in degrees Celsius.&lt;br /&gt;
&lt;br /&gt;
Now that the data have these additional attributes, the dataset is&lt;br /&gt;
compliant with level 1 of the DODS data standard.  This can also be&lt;br /&gt;
noted in the DAS, with the addition of another global attribute&lt;br /&gt;
container called &amp;lt;font color=&#039;green&#039;&amp;gt;DODS&amp;lt;/font&amp;gt;.  A file called &amp;lt;font color=&#039;green&#039;&amp;gt;dasex2.das&amp;lt;/font&amp;gt; contains&lt;br /&gt;
the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String Conventions &amp;quot;DODS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String Acknowledge &amp;quot;Example dataset from the DODS documentation.&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String history &amp;quot;Created for DODS standards book.&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add this information to the bottom of the &amp;lt;font color=&#039;green&#039;&amp;gt;dasex.das&amp;lt;/font&amp;gt; file&lt;br /&gt;
(&#039;&#039;before&#039;&#039;  the last closing bracket), and now the dataset is&lt;br /&gt;
compliant with level 2 of the DODS data standard.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2061</id>
		<title>Wiki Testing/dods-standards</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2061"/>
		<updated>2008-02-07T10:29:23Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Very Useful Attributes, But Not Essential (Class 2) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=The Emerging DODS Data Standards=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using DODS, a scientist or data center can make their data readily&lt;br /&gt;
available to anyone who knows about it.  But there is a difference&lt;br /&gt;
between &amp;quot;readily available&amp;quot; and &amp;quot;readily usable.&amp;quot;  Just because&lt;br /&gt;
DODS can easily retrieve data doesn&#039;t mean that it is easy to use.&lt;br /&gt;
&lt;br /&gt;
The DODS project has found that the single biggest obstacle to ease of&lt;br /&gt;
use of a dataset&#039;s data is incompatibility of metadata, or data&lt;br /&gt;
attributes.\footnote{Please see the \DODSuser for a discussion of&lt;br /&gt;
&lt;br /&gt;
DODS treatment of attributes, or metadata.}  This incompatibility&lt;br /&gt;
can range from the seemingly simple, such as different data names, to&lt;br /&gt;
the far less tractable, such as incompatible time representations.&lt;br /&gt;
&lt;br /&gt;
To address this problem, the DODS project has created the data&lt;br /&gt;
attribute standard described in this chapter.  This standard is&lt;br /&gt;
&#039;&#039;entirely optional&#039;&#039; .  A server can still serve data from a DODS&lt;br /&gt;
dataset that does not conform to this standard, and a DODS client can&lt;br /&gt;
still read that data.  However, a dataset that conforms to this&lt;br /&gt;
standard will be more easily read and processed by another user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE:The DODS project has an original emphasis on oceanography.&lt;br /&gt;
Therefore, the DODS standard described here has been defined, where&lt;br /&gt;
possible, to be compatible with existing geo-spatial metadata&lt;br /&gt;
conventions, including the COARDS and the ISO Z39.50 GeoProfile&lt;br /&gt;
conventions.  It should be noted that the DODS standard is a small&lt;br /&gt;
subset of these metadata definitions, and may well be applicable to&lt;br /&gt;
data from other scientific (or other) disciplines.  In addition, the&lt;br /&gt;
architecture of the DODS software does not preclude the adoption of&lt;br /&gt;
alternate data standards that may be more appropriate to those other&lt;br /&gt;
fields.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a similar effort, attempting to assert some order over incompatible&lt;br /&gt;
data attributes among netCDF files, the COARDS project&lt;br /&gt;
[http://ferret.wrc.noaa.gov/noaa_coop/coop_cdf_profile.html&amp;lt;cite&amp;gt;&amp;quot;Cooperative Ocean/Atmosphere Research Data Service&amp;quot;&amp;lt;/cite&amp;gt;] has&lt;br /&gt;
specified some standard attributes that shall be defined in a dataset.&lt;br /&gt;
Note that this has little or nothing to do with netCDF itself.  You&lt;br /&gt;
can have a netCDF dataset that doesn&#039;t comply with the COARDS&lt;br /&gt;
standard.  But it will be more useful to others if it does.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the DODS architecture allows data attributes to be added to&lt;br /&gt;
any dataset &#039;&#039;without&#039;&#039;  modifying the data files themselves.&lt;br /&gt;
This makes the task of conforming to the data standard fairly simple,&lt;br /&gt;
in most cases consisting of adding a few files to a directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, this is not an exhaustive list of attributes possible.&lt;br /&gt;
Beyond syntax-checking, the DODS software does no parsing of attribute&lt;br /&gt;
structures for a dataset.  You are free to add whatever attributes you&lt;br /&gt;
choose to any dataset served by a DODS server.  If you want to add&lt;br /&gt;
enough data attributes to make your metadata 100\&lt;br /&gt;
ISO Z39.50 GeoProfile, there is no reason not to do so.\footnote{We&lt;br /&gt;
would suggest that if you do add GeoProfile attributes not mentioned&lt;br /&gt;
in this document to your dataset, you should use the SGML attribute&lt;br /&gt;
tags as attribute names.  In the event that future DODS servers&lt;br /&gt;
support a part of the GeoProfile protocol, this will allow your&lt;br /&gt;
datasets to be merged seamlessly with that standard.}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Essential and Optional Attributes==&lt;br /&gt;
&lt;br /&gt;
One of the motivating principles of the DODS project is to keep the&lt;br /&gt;
burden on the data provider as light as possible.  To further decrease&lt;br /&gt;
the burden of making data available, the DODS data standard attributes&lt;br /&gt;
are separated into two groups:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Those that are essential to minimal data attribute interoperability, and&lt;br /&gt;
*Those that are very useful, but not essential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second group can be further split up among the more and less&lt;br /&gt;
useful attributes.&lt;br /&gt;
&lt;br /&gt;
The DODS project recognizes these as different &amp;quot;classes&amp;quot; of&lt;br /&gt;
compatibility.  For example, a class 0 DODS dataset is one that is&lt;br /&gt;
served by DODS, but does not comply with the DODS data standards,&lt;br /&gt;
except in the most minimal way.  A class 1 dataset conforms, but only&lt;br /&gt;
contains the essential attributes.  A class 2 datasets conforms and&lt;br /&gt;
contains the essential and the class 2 attributes, and so on.  The&lt;br /&gt;
attributes described in the following sections are identified by their&lt;br /&gt;
classes in this way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Global and Variable Attributes===&lt;br /&gt;
&lt;br /&gt;
DODS attributes consist of sets of name-value&lt;br /&gt;
pairs [[Wiki_Testing/dods-standards|(1)]].  To say that a data variable has&lt;br /&gt;
attributes is the same as saying that there is a set of attributes (in&lt;br /&gt;
the dataset&#039;s DAS) with the same name as this variable.  The set can&lt;br /&gt;
contain one or more name-value pairs, such as &amp;quot;units&amp;quot; with&lt;br /&gt;
&amp;quot;degreesC&amp;quot; and &amp;quot;scale_factor&amp;quot; with &amp;quot;2.35&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Consider the dataset with a DDS like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Int16 temp[time = 16][lat = 17][lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 lat[lat = 17];&lt;br /&gt;
&lt;br /&gt;
Float32 lon[lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 time[time = 16];&lt;br /&gt;
} test1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS for this DODS-compliant dataset might look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
temp {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Surface Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String missing_value &amp;quot;-32767&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String scale_factor &amp;quot;0.005&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temp&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
time {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;hours from base_time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String conventions &amp;quot;DODS&amp;quot;, &amp;quot;COARDS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One of the attribute containers in this DAS does not correspond to any&lt;br /&gt;
data variables.  The attributes in this container are said to be&lt;br /&gt;
&amp;quot;global&amp;quot; attributes, and modify the entire dataset.  There is&lt;br /&gt;
nothing special about the names; an attribute container can be called&lt;br /&gt;
anything at all.  However, the container called &amp;quot;DODS&amp;quot;, if it&lt;br /&gt;
exists, should contain the global attributes described in the DODS&lt;br /&gt;
data standard, such as &amp;lt;font color=&#039;green&#039;&amp;gt;conventions&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt;, and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Utterly Essential Attributes (Class 0)==&lt;br /&gt;
&lt;br /&gt;
The following attributes must appear in any DODS dataset for it to be&lt;br /&gt;
considered class 0 compliant.  These attributes must be defined for&lt;br /&gt;
&#039;&#039;each&#039;&#039;  data variable in the dataset.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; : A long descriptive name (title). This could be used for labelling plots, for example. If a variable has no &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; attribute assigned, the variable name should be used as a default.  This corresponds to the &amp;quot;Detailed Variable&amp;quot; field of the GCMD variable naming hierarchy.  &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; : A character array that specifies the units used for the variable&#039;s data. The units attribute should be formatted as per the recommendations in the Unidata [http://www.unidata.ucar.edu/packages/udunits/ &amp;lt;cite&amp;gt;udunits&amp;lt;/cite&amp;gt;]  package.  &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; : If present for a variable, the data are to be multiplied by this factor after the data are read by the application that accesses the data. One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; : If present for a variable, this number is to be added to the data after it is read by the application that accesses the data.  One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified. If both &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; attributes are present, the data are first scaled before the offset is added.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; : This is a string containing a transformation function used to convert the raw data into the units specifed in the &amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; attribute. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
There are some special cases, outlined in the next two sections.&lt;br /&gt;
However, if your dataset contains no null values, and no data stored&lt;br /&gt;
as DODS Arrays, the above list is complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; NOTE: A DODS Array is a different data type than a Grid, and contains&lt;br /&gt;
less information about its independent variables.  For more&lt;br /&gt;
information, see below, or refer to the [http://docs.opendap.org/index.php/Wiki_Testing/OpeNDAP_User%27s_Guide&amp;lt;cite&amp;gt;OPeNDAP User Guide&amp;lt;/cite&amp;gt;] .&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Missing Data===&lt;br /&gt;
&lt;br /&gt;
If a dataset contains missing data flagged with special values, those&lt;br /&gt;
values must be specified in the attribute list of the variable.  That&lt;br /&gt;
is, if you have a data sequence called &amp;lt;font color=&#039;green&#039;&amp;gt;ralph&amp;lt;/font&amp;gt;, and it contains missing values flagged with -999, the DAS for the dataset should have an&lt;br /&gt;
attribute container like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
ralph {&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DODS metadata standard provides three categories of missing data.&lt;br /&gt;
These attribute values are essential only in the sense that they must&lt;br /&gt;
be in the data variable&#039;s attribute container &#039;&#039;if you use them&#039;&#039; .&lt;br /&gt;
If your data doesn&#039;t use these values---that is, if there are no&lt;br /&gt;
missing values flagged with special numeric values--these attributes&lt;br /&gt;
need not be specified.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;missing_value&amp;lt;/font&amp;gt; :  This is a conventional name for a missing value that will not be treated in any special way by the client application.  This attribute is part of the COARDS standard.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;null_value&amp;lt;/font&amp;gt; : A null value differs from a missing value in that it describes data that isn&#039;t there, but shouldn&#039;t have been, either.  That is, where a missing value might be used to fill in for a sensor malfunction, a null value is used to indicate that no data was taken.  A dataset that contained random data interpolated onto a grid might use a null value on those grid points too distant from data values to make an accurate estimate.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;default_value&amp;lt;/font&amp;gt; :  A default value is yet another sort of missing data.  In this case, data would never have been at those points.  Land points in gridded sea-surface temperature data would be default values, as would the end of profile data vectors filled to uniform length.  This differs some from the semantics of the COARDS &amp;lt;font color=&#039;green&#039;&amp;gt;_FillValue&amp;lt;/font&amp;gt;, but perhaps not so far as to prevent the DODS project from adopting the COARDS name as a synonym.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Array Data===&lt;br /&gt;
&lt;br /&gt;
A dataset containing only an array may be missing some important&lt;br /&gt;
information about the dataset&#039;s independent variables.  To make the&lt;br /&gt;
dataset conpliant with the Class 0 of the DODS standard, this&lt;br /&gt;
information must be included in the attribute list.&lt;br /&gt;
&lt;br /&gt;
The information missing from an Array variable is the location of that&lt;br /&gt;
array&#039;s corners---the &amp;lt;font color=&#039;green&#039;&amp;gt;min&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;max&amp;lt;/font&amp;gt; for each dimension---and&lt;br /&gt;
other information about the array dimensions.  The requirements,&lt;br /&gt;
therefore, are that an Array&#039;s dimensions be named, and that attribute&lt;br /&gt;
containers with those same names be contained in the dataset DAS.&lt;br /&gt;
That is, for a dataset with the following array data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Array {&lt;br /&gt;
&lt;br /&gt;
Byte dsp_band_1[lat = 1024][lon = 1024];&lt;br /&gt;
&lt;br /&gt;
} dsp_band_1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS should look something like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
dsp_band_1 {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;AVHRR sea surface temperature data&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 scale_factor 0.15625;&lt;br /&gt;
&lt;br /&gt;
Float32 add_offset 5.0;&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min 0.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 70.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min -100.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 0.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If using the name of the dimension would cause a name collision with&lt;br /&gt;
some other variable in the dataset, you can use the name of the&lt;br /&gt;
dimension prefixed by the name of the array.  That is, in the above&lt;br /&gt;
example, the attribute containers for the array dimensions would be&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lat&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lon&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Less Essential, But Still Useful Attributes (Class 1)==&lt;br /&gt;
&lt;br /&gt;
The optional attributes are divided into two different classes.  This&lt;br /&gt;
again allows a data provider some latitude in the class of compliance&lt;br /&gt;
with the standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;short_name&amp;lt;/font&amp;gt; : This is the name of the variable, taken from a list of DODS names (see \appref{std-names}).  Including this attribute is a way to ensure that two datasets can be usefully compared with one another on a variable-by-variable basis.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Convention&amp;lt;/font&amp;gt; : This global attribute is recommended to identify the dataset as conforming to the DODS data standard, identified here.  The attribute should be a string with the value &amp;quot;DODS&amp;quot;.   Note that this is a global attribute, and should appear in the &amp;quot;DODS&amp;quot; attribute container, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String Convention &amp;quot;DODS&amp;quot;; }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the presence of the &amp;quot;DODS&amp;quot; attribute container is itself&lt;br /&gt;
a clue to whether the dataset is DODS-compliant or not.&lt;br /&gt;
To be compliant with the&lt;br /&gt;
GeoProfile, one element in the Convention vector should read&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;FGDC Content Standards for Digital Geospatial Metadata&amp;lt;/font&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Very Useful Attributes, But Not Essential (Class 2)==&lt;br /&gt;
&lt;br /&gt;
This is a set of attributes that has been found to be quite useful in&lt;br /&gt;
the use of DODS datasets.  A dataset can be considered to be class 2&lt;br /&gt;
compliant if it contains more than one of these attributes.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt; : This string should contain an acknowledgement paragraph that can appear in papers that use the data from this dataset.  For example: &amp;quot;The principal investigators in the production of these data are J.D. Elms, S.D. Woodruff, and&lt;br /&gt;
S. Worley [http://www.cdc.noaa.gov/coads/participants.html&amp;lt;cite&amp;gt;cite&amp;lt;/cite&amp;gt;].&amp;quot; and so on.  This is a global attribute, and should appear in the &amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; : The &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; attribute is recommended to record the evolution of the data contained within a DODS data file. Applications which process this data can append their information to this attribute.  This is a global attribute, and should appear in the &amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Data_Use_Policy&amp;lt;/font&amp;gt; : If there are any restrictions on the use of the data, they should be noted in the string with this name. This is a global attribute, and should appear in the &amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Theme&amp;lt;/font&amp;gt; : A string containing one or more of the GCMD parameter valid names. See the [http://gcmd.gsfc.nasa.gov/cgi-bin/md/valids_display.pl&amp;lt;cite&amp;gt;GCMD Parameters&amp;quot; list maintained at GCMD&amp;lt;/cite&amp;gt;]&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2060</id>
		<title>Wiki Testing/dods-standards</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2060"/>
		<updated>2008-02-07T10:26:49Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Less Essential, But Still Useful Attributes (Class 1) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=The Emerging DODS Data Standards=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using DODS, a scientist or data center can make their data readily&lt;br /&gt;
available to anyone who knows about it.  But there is a difference&lt;br /&gt;
between &amp;quot;readily available&amp;quot; and &amp;quot;readily usable.&amp;quot;  Just because&lt;br /&gt;
DODS can easily retrieve data doesn&#039;t mean that it is easy to use.&lt;br /&gt;
&lt;br /&gt;
The DODS project has found that the single biggest obstacle to ease of&lt;br /&gt;
use of a dataset&#039;s data is incompatibility of metadata, or data&lt;br /&gt;
attributes.\footnote{Please see the \DODSuser for a discussion of&lt;br /&gt;
&lt;br /&gt;
DODS treatment of attributes, or metadata.}  This incompatibility&lt;br /&gt;
can range from the seemingly simple, such as different data names, to&lt;br /&gt;
the far less tractable, such as incompatible time representations.&lt;br /&gt;
&lt;br /&gt;
To address this problem, the DODS project has created the data&lt;br /&gt;
attribute standard described in this chapter.  This standard is&lt;br /&gt;
&#039;&#039;entirely optional&#039;&#039; .  A server can still serve data from a DODS&lt;br /&gt;
dataset that does not conform to this standard, and a DODS client can&lt;br /&gt;
still read that data.  However, a dataset that conforms to this&lt;br /&gt;
standard will be more easily read and processed by another user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE:The DODS project has an original emphasis on oceanography.&lt;br /&gt;
Therefore, the DODS standard described here has been defined, where&lt;br /&gt;
possible, to be compatible with existing geo-spatial metadata&lt;br /&gt;
conventions, including the COARDS and the ISO Z39.50 GeoProfile&lt;br /&gt;
conventions.  It should be noted that the DODS standard is a small&lt;br /&gt;
subset of these metadata definitions, and may well be applicable to&lt;br /&gt;
data from other scientific (or other) disciplines.  In addition, the&lt;br /&gt;
architecture of the DODS software does not preclude the adoption of&lt;br /&gt;
alternate data standards that may be more appropriate to those other&lt;br /&gt;
fields.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a similar effort, attempting to assert some order over incompatible&lt;br /&gt;
data attributes among netCDF files, the COARDS project&lt;br /&gt;
[http://ferret.wrc.noaa.gov/noaa_coop/coop_cdf_profile.html&amp;lt;cite&amp;gt;&amp;quot;Cooperative Ocean/Atmosphere Research Data Service&amp;quot;&amp;lt;/cite&amp;gt;] has&lt;br /&gt;
specified some standard attributes that shall be defined in a dataset.&lt;br /&gt;
Note that this has little or nothing to do with netCDF itself.  You&lt;br /&gt;
can have a netCDF dataset that doesn&#039;t comply with the COARDS&lt;br /&gt;
standard.  But it will be more useful to others if it does.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the DODS architecture allows data attributes to be added to&lt;br /&gt;
any dataset &#039;&#039;without&#039;&#039;  modifying the data files themselves.&lt;br /&gt;
This makes the task of conforming to the data standard fairly simple,&lt;br /&gt;
in most cases consisting of adding a few files to a directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, this is not an exhaustive list of attributes possible.&lt;br /&gt;
Beyond syntax-checking, the DODS software does no parsing of attribute&lt;br /&gt;
structures for a dataset.  You are free to add whatever attributes you&lt;br /&gt;
choose to any dataset served by a DODS server.  If you want to add&lt;br /&gt;
enough data attributes to make your metadata 100\&lt;br /&gt;
ISO Z39.50 GeoProfile, there is no reason not to do so.\footnote{We&lt;br /&gt;
would suggest that if you do add GeoProfile attributes not mentioned&lt;br /&gt;
in this document to your dataset, you should use the SGML attribute&lt;br /&gt;
tags as attribute names.  In the event that future DODS servers&lt;br /&gt;
support a part of the GeoProfile protocol, this will allow your&lt;br /&gt;
datasets to be merged seamlessly with that standard.}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Essential and Optional Attributes==&lt;br /&gt;
&lt;br /&gt;
One of the motivating principles of the DODS project is to keep the&lt;br /&gt;
burden on the data provider as light as possible.  To further decrease&lt;br /&gt;
the burden of making data available, the DODS data standard attributes&lt;br /&gt;
are separated into two groups:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Those that are essential to minimal data attribute interoperability, and&lt;br /&gt;
*Those that are very useful, but not essential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second group can be further split up among the more and less&lt;br /&gt;
useful attributes.&lt;br /&gt;
&lt;br /&gt;
The DODS project recognizes these as different &amp;quot;classes&amp;quot; of&lt;br /&gt;
compatibility.  For example, a class 0 DODS dataset is one that is&lt;br /&gt;
served by DODS, but does not comply with the DODS data standards,&lt;br /&gt;
except in the most minimal way.  A class 1 dataset conforms, but only&lt;br /&gt;
contains the essential attributes.  A class 2 datasets conforms and&lt;br /&gt;
contains the essential and the class 2 attributes, and so on.  The&lt;br /&gt;
attributes described in the following sections are identified by their&lt;br /&gt;
classes in this way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Global and Variable Attributes===&lt;br /&gt;
&lt;br /&gt;
DODS attributes consist of sets of name-value&lt;br /&gt;
pairs [[Wiki_Testing/dods-standards|(1)]].  To say that a data variable has&lt;br /&gt;
attributes is the same as saying that there is a set of attributes (in&lt;br /&gt;
the dataset&#039;s DAS) with the same name as this variable.  The set can&lt;br /&gt;
contain one or more name-value pairs, such as &amp;quot;units&amp;quot; with&lt;br /&gt;
&amp;quot;degreesC&amp;quot; and &amp;quot;scale_factor&amp;quot; with &amp;quot;2.35&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Consider the dataset with a DDS like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Int16 temp[time = 16][lat = 17][lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 lat[lat = 17];&lt;br /&gt;
&lt;br /&gt;
Float32 lon[lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 time[time = 16];&lt;br /&gt;
} test1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS for this DODS-compliant dataset might look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
temp {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Surface Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String missing_value &amp;quot;-32767&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String scale_factor &amp;quot;0.005&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temp&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
time {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;hours from base_time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String conventions &amp;quot;DODS&amp;quot;, &amp;quot;COARDS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One of the attribute containers in this DAS does not correspond to any&lt;br /&gt;
data variables.  The attributes in this container are said to be&lt;br /&gt;
&amp;quot;global&amp;quot; attributes, and modify the entire dataset.  There is&lt;br /&gt;
nothing special about the names; an attribute container can be called&lt;br /&gt;
anything at all.  However, the container called &amp;quot;DODS&amp;quot;, if it&lt;br /&gt;
exists, should contain the global attributes described in the DODS&lt;br /&gt;
data standard, such as &amp;lt;font color=&#039;green&#039;&amp;gt;conventions&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt;, and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Utterly Essential Attributes (Class 0)==&lt;br /&gt;
&lt;br /&gt;
The following attributes must appear in any DODS dataset for it to be&lt;br /&gt;
considered class 0 compliant.  These attributes must be defined for&lt;br /&gt;
&#039;&#039;each&#039;&#039;  data variable in the dataset.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; : A long descriptive name (title). This could be used for labelling plots, for example. If a variable has no &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; attribute assigned, the variable name should be used as a default.  This corresponds to the &amp;quot;Detailed Variable&amp;quot; field of the GCMD variable naming hierarchy.  &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; : A character array that specifies the units used for the variable&#039;s data. The units attribute should be formatted as per the recommendations in the Unidata [http://www.unidata.ucar.edu/packages/udunits/ &amp;lt;cite&amp;gt;udunits&amp;lt;/cite&amp;gt;]  package.  &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; : If present for a variable, the data are to be multiplied by this factor after the data are read by the application that accesses the data. One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; : If present for a variable, this number is to be added to the data after it is read by the application that accesses the data.  One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified. If both &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; attributes are present, the data are first scaled before the offset is added.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; : This is a string containing a transformation function used to convert the raw data into the units specifed in the &amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; attribute. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
There are some special cases, outlined in the next two sections.&lt;br /&gt;
However, if your dataset contains no null values, and no data stored&lt;br /&gt;
as DODS Arrays, the above list is complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; NOTE: A DODS Array is a different data type than a Grid, and contains&lt;br /&gt;
less information about its independent variables.  For more&lt;br /&gt;
information, see below, or refer to the [http://docs.opendap.org/index.php/Wiki_Testing/OpeNDAP_User%27s_Guide&amp;lt;cite&amp;gt;OPeNDAP User Guide&amp;lt;/cite&amp;gt;] .&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Missing Data===&lt;br /&gt;
&lt;br /&gt;
If a dataset contains missing data flagged with special values, those&lt;br /&gt;
values must be specified in the attribute list of the variable.  That&lt;br /&gt;
is, if you have a data sequence called &amp;lt;font color=&#039;green&#039;&amp;gt;ralph&amp;lt;/font&amp;gt;, and it contains missing values flagged with -999, the DAS for the dataset should have an&lt;br /&gt;
attribute container like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
ralph {&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DODS metadata standard provides three categories of missing data.&lt;br /&gt;
These attribute values are essential only in the sense that they must&lt;br /&gt;
be in the data variable&#039;s attribute container &#039;&#039;if you use them&#039;&#039; .&lt;br /&gt;
If your data doesn&#039;t use these values---that is, if there are no&lt;br /&gt;
missing values flagged with special numeric values--these attributes&lt;br /&gt;
need not be specified.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;missing_value&amp;lt;/font&amp;gt; :  This is a conventional name for a missing value that will not be treated in any special way by the client application.  This attribute is part of the COARDS standard.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;null_value&amp;lt;/font&amp;gt; : A null value differs from a missing value in that it describes data that isn&#039;t there, but shouldn&#039;t have been, either.  That is, where a missing value might be used to fill in for a sensor malfunction, a null value is used to indicate that no data was taken.  A dataset that contained random data interpolated onto a grid might use a null value on those grid points too distant from data values to make an accurate estimate.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;default_value&amp;lt;/font&amp;gt; :  A default value is yet another sort of missing data.  In this case, data would never have been at those points.  Land points in gridded sea-surface temperature data would be default values, as would the end of profile data vectors filled to uniform length.  This differs some from the semantics of the COARDS &amp;lt;font color=&#039;green&#039;&amp;gt;_FillValue&amp;lt;/font&amp;gt;, but perhaps not so far as to prevent the DODS project from adopting the COARDS name as a synonym.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Array Data===&lt;br /&gt;
&lt;br /&gt;
A dataset containing only an array may be missing some important&lt;br /&gt;
information about the dataset&#039;s independent variables.  To make the&lt;br /&gt;
dataset conpliant with the Class 0 of the DODS standard, this&lt;br /&gt;
information must be included in the attribute list.&lt;br /&gt;
&lt;br /&gt;
The information missing from an Array variable is the location of that&lt;br /&gt;
array&#039;s corners---the &amp;lt;font color=&#039;green&#039;&amp;gt;min&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;max&amp;lt;/font&amp;gt; for each dimension---and&lt;br /&gt;
other information about the array dimensions.  The requirements,&lt;br /&gt;
therefore, are that an Array&#039;s dimensions be named, and that attribute&lt;br /&gt;
containers with those same names be contained in the dataset DAS.&lt;br /&gt;
That is, for a dataset with the following array data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Array {&lt;br /&gt;
&lt;br /&gt;
Byte dsp_band_1[lat = 1024][lon = 1024];&lt;br /&gt;
&lt;br /&gt;
} dsp_band_1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS should look something like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
dsp_band_1 {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;AVHRR sea surface temperature data&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 scale_factor 0.15625;&lt;br /&gt;
&lt;br /&gt;
Float32 add_offset 5.0;&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min 0.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 70.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min -100.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 0.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If using the name of the dimension would cause a name collision with&lt;br /&gt;
some other variable in the dataset, you can use the name of the&lt;br /&gt;
dimension prefixed by the name of the array.  That is, in the above&lt;br /&gt;
example, the attribute containers for the array dimensions would be&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lat&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lon&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Less Essential, But Still Useful Attributes (Class 1)==&lt;br /&gt;
&lt;br /&gt;
The optional attributes are divided into two different classes.  This&lt;br /&gt;
again allows a data provider some latitude in the class of compliance&lt;br /&gt;
with the standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;short_name&amp;lt;/font&amp;gt; : This is the name of the variable, taken from a list of DODS names (see \appref{std-names}).  Including this attribute is a way to ensure that two datasets can be usefully compared with one another on a variable-by-variable basis.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Convention&amp;lt;/font&amp;gt; : This global attribute is recommended to identify the dataset as conforming to the DODS data standard, identified here.  The attribute should be a string with the value &amp;quot;DODS&amp;quot;.   Note that this is a global attribute, and should appear in the &amp;quot;DODS&amp;quot; attribute container, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String Convention &amp;quot;DODS&amp;quot;; }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the presence of the &amp;quot;DODS&amp;quot; attribute container is itself&lt;br /&gt;
a clue to whether the dataset is DODS-compliant or not.&lt;br /&gt;
To be compliant with the&lt;br /&gt;
GeoProfile, one element in the Convention vector should read&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;FGDC Content Standards for Digital Geospatial Metadata&amp;lt;/font&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Very Useful Attributes, But Not Essential (Class 2)==&lt;br /&gt;
&lt;br /&gt;
This is a set of attributes that has been found to be quite useful in&lt;br /&gt;
the use of DODS datasets.  A dataset can be considered to be class 2&lt;br /&gt;
compliant if it contains more than one of these attributes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt; : This string should contain an acknowledgement&lt;br /&gt;
paragraph that can appear in papers that use the data from this&lt;br /&gt;
dataset.  For example: &amp;quot;The principal investigators in the&lt;br /&gt;
production of these data are J.D. Elms, S.D. Woodruff, and&lt;br /&gt;
S. Worley (http://www.cdc.noaa.gov/coads/participants.html).&amp;quot; and&lt;br /&gt;
so on.  This is a global attribute, and should appear in the&lt;br /&gt;
&amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; : The &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; attribute is recommended to&lt;br /&gt;
record the evolution of the data contained within a DODS data file.&lt;br /&gt;
Applications which process this data can append their information to&lt;br /&gt;
this attribute.  This is a global attribute, and should appear in&lt;br /&gt;
the &amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Data_Use_Policy&amp;lt;/font&amp;gt; : If there are any restrictions on the use&lt;br /&gt;
of the data, they should be noted in the string with this name.&lt;br /&gt;
This is a global attribute, and should appear in the &amp;quot;DODS&amp;quot;&lt;br /&gt;
attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Theme&amp;lt;/font&amp;gt; : A string containing one or more of the GCMD parameter&lt;br /&gt;
valid names. See \xlink{the &amp;quot;GCMD Parameters&amp;quot; list maintained at GCMD.}  {http://gcmd.gsfc.nasa.gov/cgi-bin/md/valids_display.pl}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2058</id>
		<title>Wiki Testing/dods-standards</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2058"/>
		<updated>2008-02-07T10:26:09Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Utterly Essential Attributes (Class 0) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=The Emerging DODS Data Standards=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using DODS, a scientist or data center can make their data readily&lt;br /&gt;
available to anyone who knows about it.  But there is a difference&lt;br /&gt;
between &amp;quot;readily available&amp;quot; and &amp;quot;readily usable.&amp;quot;  Just because&lt;br /&gt;
DODS can easily retrieve data doesn&#039;t mean that it is easy to use.&lt;br /&gt;
&lt;br /&gt;
The DODS project has found that the single biggest obstacle to ease of&lt;br /&gt;
use of a dataset&#039;s data is incompatibility of metadata, or data&lt;br /&gt;
attributes.\footnote{Please see the \DODSuser for a discussion of&lt;br /&gt;
&lt;br /&gt;
DODS treatment of attributes, or metadata.}  This incompatibility&lt;br /&gt;
can range from the seemingly simple, such as different data names, to&lt;br /&gt;
the far less tractable, such as incompatible time representations.&lt;br /&gt;
&lt;br /&gt;
To address this problem, the DODS project has created the data&lt;br /&gt;
attribute standard described in this chapter.  This standard is&lt;br /&gt;
&#039;&#039;entirely optional&#039;&#039; .  A server can still serve data from a DODS&lt;br /&gt;
dataset that does not conform to this standard, and a DODS client can&lt;br /&gt;
still read that data.  However, a dataset that conforms to this&lt;br /&gt;
standard will be more easily read and processed by another user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE:The DODS project has an original emphasis on oceanography.&lt;br /&gt;
Therefore, the DODS standard described here has been defined, where&lt;br /&gt;
possible, to be compatible with existing geo-spatial metadata&lt;br /&gt;
conventions, including the COARDS and the ISO Z39.50 GeoProfile&lt;br /&gt;
conventions.  It should be noted that the DODS standard is a small&lt;br /&gt;
subset of these metadata definitions, and may well be applicable to&lt;br /&gt;
data from other scientific (or other) disciplines.  In addition, the&lt;br /&gt;
architecture of the DODS software does not preclude the adoption of&lt;br /&gt;
alternate data standards that may be more appropriate to those other&lt;br /&gt;
fields.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a similar effort, attempting to assert some order over incompatible&lt;br /&gt;
data attributes among netCDF files, the COARDS project&lt;br /&gt;
[http://ferret.wrc.noaa.gov/noaa_coop/coop_cdf_profile.html&amp;lt;cite&amp;gt;&amp;quot;Cooperative Ocean/Atmosphere Research Data Service&amp;quot;&amp;lt;/cite&amp;gt;] has&lt;br /&gt;
specified some standard attributes that shall be defined in a dataset.&lt;br /&gt;
Note that this has little or nothing to do with netCDF itself.  You&lt;br /&gt;
can have a netCDF dataset that doesn&#039;t comply with the COARDS&lt;br /&gt;
standard.  But it will be more useful to others if it does.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the DODS architecture allows data attributes to be added to&lt;br /&gt;
any dataset &#039;&#039;without&#039;&#039;  modifying the data files themselves.&lt;br /&gt;
This makes the task of conforming to the data standard fairly simple,&lt;br /&gt;
in most cases consisting of adding a few files to a directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, this is not an exhaustive list of attributes possible.&lt;br /&gt;
Beyond syntax-checking, the DODS software does no parsing of attribute&lt;br /&gt;
structures for a dataset.  You are free to add whatever attributes you&lt;br /&gt;
choose to any dataset served by a DODS server.  If you want to add&lt;br /&gt;
enough data attributes to make your metadata 100\&lt;br /&gt;
ISO Z39.50 GeoProfile, there is no reason not to do so.\footnote{We&lt;br /&gt;
would suggest that if you do add GeoProfile attributes not mentioned&lt;br /&gt;
in this document to your dataset, you should use the SGML attribute&lt;br /&gt;
tags as attribute names.  In the event that future DODS servers&lt;br /&gt;
support a part of the GeoProfile protocol, this will allow your&lt;br /&gt;
datasets to be merged seamlessly with that standard.}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Essential and Optional Attributes==&lt;br /&gt;
&lt;br /&gt;
One of the motivating principles of the DODS project is to keep the&lt;br /&gt;
burden on the data provider as light as possible.  To further decrease&lt;br /&gt;
the burden of making data available, the DODS data standard attributes&lt;br /&gt;
are separated into two groups:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Those that are essential to minimal data attribute interoperability, and&lt;br /&gt;
*Those that are very useful, but not essential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second group can be further split up among the more and less&lt;br /&gt;
useful attributes.&lt;br /&gt;
&lt;br /&gt;
The DODS project recognizes these as different &amp;quot;classes&amp;quot; of&lt;br /&gt;
compatibility.  For example, a class 0 DODS dataset is one that is&lt;br /&gt;
served by DODS, but does not comply with the DODS data standards,&lt;br /&gt;
except in the most minimal way.  A class 1 dataset conforms, but only&lt;br /&gt;
contains the essential attributes.  A class 2 datasets conforms and&lt;br /&gt;
contains the essential and the class 2 attributes, and so on.  The&lt;br /&gt;
attributes described in the following sections are identified by their&lt;br /&gt;
classes in this way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Global and Variable Attributes===&lt;br /&gt;
&lt;br /&gt;
DODS attributes consist of sets of name-value&lt;br /&gt;
pairs [[Wiki_Testing/dods-standards|(1)]].  To say that a data variable has&lt;br /&gt;
attributes is the same as saying that there is a set of attributes (in&lt;br /&gt;
the dataset&#039;s DAS) with the same name as this variable.  The set can&lt;br /&gt;
contain one or more name-value pairs, such as &amp;quot;units&amp;quot; with&lt;br /&gt;
&amp;quot;degreesC&amp;quot; and &amp;quot;scale_factor&amp;quot; with &amp;quot;2.35&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Consider the dataset with a DDS like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Int16 temp[time = 16][lat = 17][lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 lat[lat = 17];&lt;br /&gt;
&lt;br /&gt;
Float32 lon[lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 time[time = 16];&lt;br /&gt;
} test1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS for this DODS-compliant dataset might look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
temp {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Surface Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String missing_value &amp;quot;-32767&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String scale_factor &amp;quot;0.005&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temp&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
time {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;hours from base_time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String conventions &amp;quot;DODS&amp;quot;, &amp;quot;COARDS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One of the attribute containers in this DAS does not correspond to any&lt;br /&gt;
data variables.  The attributes in this container are said to be&lt;br /&gt;
&amp;quot;global&amp;quot; attributes, and modify the entire dataset.  There is&lt;br /&gt;
nothing special about the names; an attribute container can be called&lt;br /&gt;
anything at all.  However, the container called &amp;quot;DODS&amp;quot;, if it&lt;br /&gt;
exists, should contain the global attributes described in the DODS&lt;br /&gt;
data standard, such as &amp;lt;font color=&#039;green&#039;&amp;gt;conventions&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt;, and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Utterly Essential Attributes (Class 0)==&lt;br /&gt;
&lt;br /&gt;
The following attributes must appear in any DODS dataset for it to be&lt;br /&gt;
considered class 0 compliant.  These attributes must be defined for&lt;br /&gt;
&#039;&#039;each&#039;&#039;  data variable in the dataset.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; : A long descriptive name (title). This could be used for labelling plots, for example. If a variable has no &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; attribute assigned, the variable name should be used as a default.  This corresponds to the &amp;quot;Detailed Variable&amp;quot; field of the GCMD variable naming hierarchy.  &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; : A character array that specifies the units used for the variable&#039;s data. The units attribute should be formatted as per the recommendations in the Unidata [http://www.unidata.ucar.edu/packages/udunits/ &amp;lt;cite&amp;gt;udunits&amp;lt;/cite&amp;gt;]  package.  &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; : If present for a variable, the data are to be multiplied by this factor after the data are read by the application that accesses the data. One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; : If present for a variable, this number is to be added to the data after it is read by the application that accesses the data.  One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified. If both &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; attributes are present, the data are first scaled before the offset is added.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; : This is a string containing a transformation function used to convert the raw data into the units specifed in the &amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; attribute. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
There are some special cases, outlined in the next two sections.&lt;br /&gt;
However, if your dataset contains no null values, and no data stored&lt;br /&gt;
as DODS Arrays, the above list is complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; NOTE: A DODS Array is a different data type than a Grid, and contains&lt;br /&gt;
less information about its independent variables.  For more&lt;br /&gt;
information, see below, or refer to the [http://docs.opendap.org/index.php/Wiki_Testing/OpeNDAP_User%27s_Guide&amp;lt;cite&amp;gt;OPeNDAP User Guide&amp;lt;/cite&amp;gt;] .&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Missing Data===&lt;br /&gt;
&lt;br /&gt;
If a dataset contains missing data flagged with special values, those&lt;br /&gt;
values must be specified in the attribute list of the variable.  That&lt;br /&gt;
is, if you have a data sequence called &amp;lt;font color=&#039;green&#039;&amp;gt;ralph&amp;lt;/font&amp;gt;, and it contains missing values flagged with -999, the DAS for the dataset should have an&lt;br /&gt;
attribute container like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
ralph {&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DODS metadata standard provides three categories of missing data.&lt;br /&gt;
These attribute values are essential only in the sense that they must&lt;br /&gt;
be in the data variable&#039;s attribute container &#039;&#039;if you use them&#039;&#039; .&lt;br /&gt;
If your data doesn&#039;t use these values---that is, if there are no&lt;br /&gt;
missing values flagged with special numeric values--these attributes&lt;br /&gt;
need not be specified.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;missing_value&amp;lt;/font&amp;gt; :  This is a conventional name for a missing value that will not be treated in any special way by the client application.  This attribute is part of the COARDS standard.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;null_value&amp;lt;/font&amp;gt; : A null value differs from a missing value in that it describes data that isn&#039;t there, but shouldn&#039;t have been, either.  That is, where a missing value might be used to fill in for a sensor malfunction, a null value is used to indicate that no data was taken.  A dataset that contained random data interpolated onto a grid might use a null value on those grid points too distant from data values to make an accurate estimate.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;default_value&amp;lt;/font&amp;gt; :  A default value is yet another sort of missing data.  In this case, data would never have been at those points.  Land points in gridded sea-surface temperature data would be default values, as would the end of profile data vectors filled to uniform length.  This differs some from the semantics of the COARDS &amp;lt;font color=&#039;green&#039;&amp;gt;_FillValue&amp;lt;/font&amp;gt;, but perhaps not so far as to prevent the DODS project from adopting the COARDS name as a synonym.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Array Data===&lt;br /&gt;
&lt;br /&gt;
A dataset containing only an array may be missing some important&lt;br /&gt;
information about the dataset&#039;s independent variables.  To make the&lt;br /&gt;
dataset conpliant with the Class 0 of the DODS standard, this&lt;br /&gt;
information must be included in the attribute list.&lt;br /&gt;
&lt;br /&gt;
The information missing from an Array variable is the location of that&lt;br /&gt;
array&#039;s corners---the &amp;lt;font color=&#039;green&#039;&amp;gt;min&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;max&amp;lt;/font&amp;gt; for each dimension---and&lt;br /&gt;
other information about the array dimensions.  The requirements,&lt;br /&gt;
therefore, are that an Array&#039;s dimensions be named, and that attribute&lt;br /&gt;
containers with those same names be contained in the dataset DAS.&lt;br /&gt;
That is, for a dataset with the following array data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Array {&lt;br /&gt;
&lt;br /&gt;
Byte dsp_band_1[lat = 1024][lon = 1024];&lt;br /&gt;
&lt;br /&gt;
} dsp_band_1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS should look something like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
dsp_band_1 {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;AVHRR sea surface temperature data&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 scale_factor 0.15625;&lt;br /&gt;
&lt;br /&gt;
Float32 add_offset 5.0;&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min 0.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 70.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min -100.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 0.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If using the name of the dimension would cause a name collision with&lt;br /&gt;
some other variable in the dataset, you can use the name of the&lt;br /&gt;
dimension prefixed by the name of the array.  That is, in the above&lt;br /&gt;
example, the attribute containers for the array dimensions would be&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lat&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lon&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Less Essential, But Still Useful Attributes (Class 1)==&lt;br /&gt;
&lt;br /&gt;
The optional attributes are divided into two different classes.  This&lt;br /&gt;
again allows a data provider some latitude in the class of compliance&lt;br /&gt;
with the standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;short_name&amp;lt;/font&amp;gt; : This is the name of the variable, taken from&lt;br /&gt;
a list of DODS names (see \appref{std-names}).  Including this&lt;br /&gt;
attribute is a way to ensure that two datasets can be usefully&lt;br /&gt;
compared with one another on a variable-by-variable basis.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Convention&amp;lt;/font&amp;gt; : This global attribute is recommended to&lt;br /&gt;
identify the dataset as conforming to the DODS data standard,&lt;br /&gt;
identified here.  The attribute should be a string with the value&lt;br /&gt;
&amp;quot;DODS&amp;quot;.   Note that this is a global attribute, and should appear&lt;br /&gt;
in the &amp;quot;DODS&amp;quot; attribute container, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String Convention &amp;quot;DODS&amp;quot;; }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the presence of the &amp;quot;DODS&amp;quot; attribute container is itself&lt;br /&gt;
a clue to whether the dataset is DODS-compliant or not.&lt;br /&gt;
To be compliant with the&lt;br /&gt;
GeoProfile, one element in the Convention vector should read&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;FGDC Content Standards for Digital Geospatial Metadata&amp;lt;/font&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Very Useful Attributes, But Not Essential (Class 2)==&lt;br /&gt;
&lt;br /&gt;
This is a set of attributes that has been found to be quite useful in&lt;br /&gt;
the use of DODS datasets.  A dataset can be considered to be class 2&lt;br /&gt;
compliant if it contains more than one of these attributes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt; : This string should contain an acknowledgement&lt;br /&gt;
paragraph that can appear in papers that use the data from this&lt;br /&gt;
dataset.  For example: &amp;quot;The principal investigators in the&lt;br /&gt;
production of these data are J.D. Elms, S.D. Woodruff, and&lt;br /&gt;
S. Worley (http://www.cdc.noaa.gov/coads/participants.html).&amp;quot; and&lt;br /&gt;
so on.  This is a global attribute, and should appear in the&lt;br /&gt;
&amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; : The &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; attribute is recommended to&lt;br /&gt;
record the evolution of the data contained within a DODS data file.&lt;br /&gt;
Applications which process this data can append their information to&lt;br /&gt;
this attribute.  This is a global attribute, and should appear in&lt;br /&gt;
the &amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Data_Use_Policy&amp;lt;/font&amp;gt; : If there are any restrictions on the use&lt;br /&gt;
of the data, they should be noted in the string with this name.&lt;br /&gt;
This is a global attribute, and should appear in the &amp;quot;DODS&amp;quot;&lt;br /&gt;
attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Theme&amp;lt;/font&amp;gt; : A string containing one or more of the GCMD parameter&lt;br /&gt;
valid names. See \xlink{the &amp;quot;GCMD Parameters&amp;quot; list maintained at GCMD.}  {http://gcmd.gsfc.nasa.gov/cgi-bin/md/valids_display.pl}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2057</id>
		<title>Wiki Testing/dods-standards</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2057"/>
		<updated>2008-02-07T10:25:51Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Utterly Essential Attributes (Class 0) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=The Emerging DODS Data Standards=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using DODS, a scientist or data center can make their data readily&lt;br /&gt;
available to anyone who knows about it.  But there is a difference&lt;br /&gt;
between &amp;quot;readily available&amp;quot; and &amp;quot;readily usable.&amp;quot;  Just because&lt;br /&gt;
DODS can easily retrieve data doesn&#039;t mean that it is easy to use.&lt;br /&gt;
&lt;br /&gt;
The DODS project has found that the single biggest obstacle to ease of&lt;br /&gt;
use of a dataset&#039;s data is incompatibility of metadata, or data&lt;br /&gt;
attributes.\footnote{Please see the \DODSuser for a discussion of&lt;br /&gt;
&lt;br /&gt;
DODS treatment of attributes, or metadata.}  This incompatibility&lt;br /&gt;
can range from the seemingly simple, such as different data names, to&lt;br /&gt;
the far less tractable, such as incompatible time representations.&lt;br /&gt;
&lt;br /&gt;
To address this problem, the DODS project has created the data&lt;br /&gt;
attribute standard described in this chapter.  This standard is&lt;br /&gt;
&#039;&#039;entirely optional&#039;&#039; .  A server can still serve data from a DODS&lt;br /&gt;
dataset that does not conform to this standard, and a DODS client can&lt;br /&gt;
still read that data.  However, a dataset that conforms to this&lt;br /&gt;
standard will be more easily read and processed by another user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE:The DODS project has an original emphasis on oceanography.&lt;br /&gt;
Therefore, the DODS standard described here has been defined, where&lt;br /&gt;
possible, to be compatible with existing geo-spatial metadata&lt;br /&gt;
conventions, including the COARDS and the ISO Z39.50 GeoProfile&lt;br /&gt;
conventions.  It should be noted that the DODS standard is a small&lt;br /&gt;
subset of these metadata definitions, and may well be applicable to&lt;br /&gt;
data from other scientific (or other) disciplines.  In addition, the&lt;br /&gt;
architecture of the DODS software does not preclude the adoption of&lt;br /&gt;
alternate data standards that may be more appropriate to those other&lt;br /&gt;
fields.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a similar effort, attempting to assert some order over incompatible&lt;br /&gt;
data attributes among netCDF files, the COARDS project&lt;br /&gt;
[http://ferret.wrc.noaa.gov/noaa_coop/coop_cdf_profile.html&amp;lt;cite&amp;gt;&amp;quot;Cooperative Ocean/Atmosphere Research Data Service&amp;quot;&amp;lt;/cite&amp;gt;] has&lt;br /&gt;
specified some standard attributes that shall be defined in a dataset.&lt;br /&gt;
Note that this has little or nothing to do with netCDF itself.  You&lt;br /&gt;
can have a netCDF dataset that doesn&#039;t comply with the COARDS&lt;br /&gt;
standard.  But it will be more useful to others if it does.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the DODS architecture allows data attributes to be added to&lt;br /&gt;
any dataset &#039;&#039;without&#039;&#039;  modifying the data files themselves.&lt;br /&gt;
This makes the task of conforming to the data standard fairly simple,&lt;br /&gt;
in most cases consisting of adding a few files to a directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, this is not an exhaustive list of attributes possible.&lt;br /&gt;
Beyond syntax-checking, the DODS software does no parsing of attribute&lt;br /&gt;
structures for a dataset.  You are free to add whatever attributes you&lt;br /&gt;
choose to any dataset served by a DODS server.  If you want to add&lt;br /&gt;
enough data attributes to make your metadata 100\&lt;br /&gt;
ISO Z39.50 GeoProfile, there is no reason not to do so.\footnote{We&lt;br /&gt;
would suggest that if you do add GeoProfile attributes not mentioned&lt;br /&gt;
in this document to your dataset, you should use the SGML attribute&lt;br /&gt;
tags as attribute names.  In the event that future DODS servers&lt;br /&gt;
support a part of the GeoProfile protocol, this will allow your&lt;br /&gt;
datasets to be merged seamlessly with that standard.}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Essential and Optional Attributes==&lt;br /&gt;
&lt;br /&gt;
One of the motivating principles of the DODS project is to keep the&lt;br /&gt;
burden on the data provider as light as possible.  To further decrease&lt;br /&gt;
the burden of making data available, the DODS data standard attributes&lt;br /&gt;
are separated into two groups:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Those that are essential to minimal data attribute interoperability, and&lt;br /&gt;
*Those that are very useful, but not essential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second group can be further split up among the more and less&lt;br /&gt;
useful attributes.&lt;br /&gt;
&lt;br /&gt;
The DODS project recognizes these as different &amp;quot;classes&amp;quot; of&lt;br /&gt;
compatibility.  For example, a class 0 DODS dataset is one that is&lt;br /&gt;
served by DODS, but does not comply with the DODS data standards,&lt;br /&gt;
except in the most minimal way.  A class 1 dataset conforms, but only&lt;br /&gt;
contains the essential attributes.  A class 2 datasets conforms and&lt;br /&gt;
contains the essential and the class 2 attributes, and so on.  The&lt;br /&gt;
attributes described in the following sections are identified by their&lt;br /&gt;
classes in this way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Global and Variable Attributes===&lt;br /&gt;
&lt;br /&gt;
DODS attributes consist of sets of name-value&lt;br /&gt;
pairs [[Wiki_Testing/dods-standards|(1)]].  To say that a data variable has&lt;br /&gt;
attributes is the same as saying that there is a set of attributes (in&lt;br /&gt;
the dataset&#039;s DAS) with the same name as this variable.  The set can&lt;br /&gt;
contain one or more name-value pairs, such as &amp;quot;units&amp;quot; with&lt;br /&gt;
&amp;quot;degreesC&amp;quot; and &amp;quot;scale_factor&amp;quot; with &amp;quot;2.35&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Consider the dataset with a DDS like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Int16 temp[time = 16][lat = 17][lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 lat[lat = 17];&lt;br /&gt;
&lt;br /&gt;
Float32 lon[lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 time[time = 16];&lt;br /&gt;
} test1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS for this DODS-compliant dataset might look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
temp {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Surface Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String missing_value &amp;quot;-32767&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String scale_factor &amp;quot;0.005&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temp&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
time {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;hours from base_time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String conventions &amp;quot;DODS&amp;quot;, &amp;quot;COARDS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One of the attribute containers in this DAS does not correspond to any&lt;br /&gt;
data variables.  The attributes in this container are said to be&lt;br /&gt;
&amp;quot;global&amp;quot; attributes, and modify the entire dataset.  There is&lt;br /&gt;
nothing special about the names; an attribute container can be called&lt;br /&gt;
anything at all.  However, the container called &amp;quot;DODS&amp;quot;, if it&lt;br /&gt;
exists, should contain the global attributes described in the DODS&lt;br /&gt;
data standard, such as &amp;lt;font color=&#039;green&#039;&amp;gt;conventions&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt;, and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Utterly Essential Attributes (Class 0)==&lt;br /&gt;
&lt;br /&gt;
The following attributes must appear in any DODS dataset for it to be&lt;br /&gt;
considered class 0 compliant.  These attributes must be defined for&lt;br /&gt;
&#039;&#039;each&#039;&#039;  data variable in the dataset.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; : A long descriptive name (title). This could be used for labelling plots, for example. If a variable has no &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; attribute assigned, the variable name should be used as a default.  This corresponds to the &amp;quot;Detailed Variable&amp;quot; field of the GCMD variable naming hierarchy.  &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; : A character array that specifies the units used for the variable&#039;s data. The units attribute should be formatted as per the recommendations in the Unidata [http://www.unidata.ucar.edu/packages/udunits/ &amp;lt;cite&amp;gt;udunits&amp;lt;/cite&amp;gt;]  package.  &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; : If present for a variable, the data are to be multiplied by this factor after the data are read by the application that accesses the data. One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; : If present for a variable, this number is to be added to the data after it is read by the application that accesses the data.  One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified. If both &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; attributes are present, the data are first scaled before the offset is added.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; : This is a string containing a transformation function used to convert the raw data into the units specifed in the &amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; attribute. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
There are some special cases, outlined in the next two sections.&lt;br /&gt;
However, if your dataset contains no null values, and no data stored&lt;br /&gt;
as DODS Arrays, the above list is complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; NOTE: A DODS Array is a different data type than a Grid, and contains&lt;br /&gt;
less information about its independent variables.  For more&lt;br /&gt;
information, see below, or refer to the [http://docs.opendap.org/index.php/Wiki_Testing/OpeNDAP_User%27s_Guide&amp;lt;cite&amp;gt;OPeNDAP User Guide&amp;lt;/ite&amp;gt;] .&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Missing Data===&lt;br /&gt;
&lt;br /&gt;
If a dataset contains missing data flagged with special values, those&lt;br /&gt;
values must be specified in the attribute list of the variable.  That&lt;br /&gt;
is, if you have a data sequence called &amp;lt;font color=&#039;green&#039;&amp;gt;ralph&amp;lt;/font&amp;gt;, and it contains missing values flagged with -999, the DAS for the dataset should have an&lt;br /&gt;
attribute container like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
ralph {&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DODS metadata standard provides three categories of missing data.&lt;br /&gt;
These attribute values are essential only in the sense that they must&lt;br /&gt;
be in the data variable&#039;s attribute container &#039;&#039;if you use them&#039;&#039; .&lt;br /&gt;
If your data doesn&#039;t use these values---that is, if there are no&lt;br /&gt;
missing values flagged with special numeric values--these attributes&lt;br /&gt;
need not be specified.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;missing_value&amp;lt;/font&amp;gt; :  This is a conventional name for a missing value that will not be treated in any special way by the client application.  This attribute is part of the COARDS standard.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;null_value&amp;lt;/font&amp;gt; : A null value differs from a missing value in that it describes data that isn&#039;t there, but shouldn&#039;t have been, either.  That is, where a missing value might be used to fill in for a sensor malfunction, a null value is used to indicate that no data was taken.  A dataset that contained random data interpolated onto a grid might use a null value on those grid points too distant from data values to make an accurate estimate.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;default_value&amp;lt;/font&amp;gt; :  A default value is yet another sort of missing data.  In this case, data would never have been at those points.  Land points in gridded sea-surface temperature data would be default values, as would the end of profile data vectors filled to uniform length.  This differs some from the semantics of the COARDS &amp;lt;font color=&#039;green&#039;&amp;gt;_FillValue&amp;lt;/font&amp;gt;, but perhaps not so far as to prevent the DODS project from adopting the COARDS name as a synonym.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Array Data===&lt;br /&gt;
&lt;br /&gt;
A dataset containing only an array may be missing some important&lt;br /&gt;
information about the dataset&#039;s independent variables.  To make the&lt;br /&gt;
dataset conpliant with the Class 0 of the DODS standard, this&lt;br /&gt;
information must be included in the attribute list.&lt;br /&gt;
&lt;br /&gt;
The information missing from an Array variable is the location of that&lt;br /&gt;
array&#039;s corners---the &amp;lt;font color=&#039;green&#039;&amp;gt;min&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;max&amp;lt;/font&amp;gt; for each dimension---and&lt;br /&gt;
other information about the array dimensions.  The requirements,&lt;br /&gt;
therefore, are that an Array&#039;s dimensions be named, and that attribute&lt;br /&gt;
containers with those same names be contained in the dataset DAS.&lt;br /&gt;
That is, for a dataset with the following array data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Array {&lt;br /&gt;
&lt;br /&gt;
Byte dsp_band_1[lat = 1024][lon = 1024];&lt;br /&gt;
&lt;br /&gt;
} dsp_band_1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS should look something like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
dsp_band_1 {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;AVHRR sea surface temperature data&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 scale_factor 0.15625;&lt;br /&gt;
&lt;br /&gt;
Float32 add_offset 5.0;&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min 0.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 70.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min -100.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 0.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If using the name of the dimension would cause a name collision with&lt;br /&gt;
some other variable in the dataset, you can use the name of the&lt;br /&gt;
dimension prefixed by the name of the array.  That is, in the above&lt;br /&gt;
example, the attribute containers for the array dimensions would be&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lat&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lon&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Less Essential, But Still Useful Attributes (Class 1)==&lt;br /&gt;
&lt;br /&gt;
The optional attributes are divided into two different classes.  This&lt;br /&gt;
again allows a data provider some latitude in the class of compliance&lt;br /&gt;
with the standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;short_name&amp;lt;/font&amp;gt; : This is the name of the variable, taken from&lt;br /&gt;
a list of DODS names (see \appref{std-names}).  Including this&lt;br /&gt;
attribute is a way to ensure that two datasets can be usefully&lt;br /&gt;
compared with one another on a variable-by-variable basis.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Convention&amp;lt;/font&amp;gt; : This global attribute is recommended to&lt;br /&gt;
identify the dataset as conforming to the DODS data standard,&lt;br /&gt;
identified here.  The attribute should be a string with the value&lt;br /&gt;
&amp;quot;DODS&amp;quot;.   Note that this is a global attribute, and should appear&lt;br /&gt;
in the &amp;quot;DODS&amp;quot; attribute container, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String Convention &amp;quot;DODS&amp;quot;; }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the presence of the &amp;quot;DODS&amp;quot; attribute container is itself&lt;br /&gt;
a clue to whether the dataset is DODS-compliant or not.&lt;br /&gt;
To be compliant with the&lt;br /&gt;
GeoProfile, one element in the Convention vector should read&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;FGDC Content Standards for Digital Geospatial Metadata&amp;lt;/font&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Very Useful Attributes, But Not Essential (Class 2)==&lt;br /&gt;
&lt;br /&gt;
This is a set of attributes that has been found to be quite useful in&lt;br /&gt;
the use of DODS datasets.  A dataset can be considered to be class 2&lt;br /&gt;
compliant if it contains more than one of these attributes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt; : This string should contain an acknowledgement&lt;br /&gt;
paragraph that can appear in papers that use the data from this&lt;br /&gt;
dataset.  For example: &amp;quot;The principal investigators in the&lt;br /&gt;
production of these data are J.D. Elms, S.D. Woodruff, and&lt;br /&gt;
S. Worley (http://www.cdc.noaa.gov/coads/participants.html).&amp;quot; and&lt;br /&gt;
so on.  This is a global attribute, and should appear in the&lt;br /&gt;
&amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; : The &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; attribute is recommended to&lt;br /&gt;
record the evolution of the data contained within a DODS data file.&lt;br /&gt;
Applications which process this data can append their information to&lt;br /&gt;
this attribute.  This is a global attribute, and should appear in&lt;br /&gt;
the &amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Data_Use_Policy&amp;lt;/font&amp;gt; : If there are any restrictions on the use&lt;br /&gt;
of the data, they should be noted in the string with this name.&lt;br /&gt;
This is a global attribute, and should appear in the &amp;quot;DODS&amp;quot;&lt;br /&gt;
attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Theme&amp;lt;/font&amp;gt; : A string containing one or more of the GCMD parameter&lt;br /&gt;
valid names. See \xlink{the &amp;quot;GCMD Parameters&amp;quot; list maintained at GCMD.}  {http://gcmd.gsfc.nasa.gov/cgi-bin/md/valids_display.pl}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2056</id>
		<title>Wiki Testing/dods-standards</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2056"/>
		<updated>2008-02-07T10:24:50Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Utterly Essential Attributes (Class 0) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=The Emerging DODS Data Standards=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using DODS, a scientist or data center can make their data readily&lt;br /&gt;
available to anyone who knows about it.  But there is a difference&lt;br /&gt;
between &amp;quot;readily available&amp;quot; and &amp;quot;readily usable.&amp;quot;  Just because&lt;br /&gt;
DODS can easily retrieve data doesn&#039;t mean that it is easy to use.&lt;br /&gt;
&lt;br /&gt;
The DODS project has found that the single biggest obstacle to ease of&lt;br /&gt;
use of a dataset&#039;s data is incompatibility of metadata, or data&lt;br /&gt;
attributes.\footnote{Please see the \DODSuser for a discussion of&lt;br /&gt;
&lt;br /&gt;
DODS treatment of attributes, or metadata.}  This incompatibility&lt;br /&gt;
can range from the seemingly simple, such as different data names, to&lt;br /&gt;
the far less tractable, such as incompatible time representations.&lt;br /&gt;
&lt;br /&gt;
To address this problem, the DODS project has created the data&lt;br /&gt;
attribute standard described in this chapter.  This standard is&lt;br /&gt;
&#039;&#039;entirely optional&#039;&#039; .  A server can still serve data from a DODS&lt;br /&gt;
dataset that does not conform to this standard, and a DODS client can&lt;br /&gt;
still read that data.  However, a dataset that conforms to this&lt;br /&gt;
standard will be more easily read and processed by another user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE:The DODS project has an original emphasis on oceanography.&lt;br /&gt;
Therefore, the DODS standard described here has been defined, where&lt;br /&gt;
possible, to be compatible with existing geo-spatial metadata&lt;br /&gt;
conventions, including the COARDS and the ISO Z39.50 GeoProfile&lt;br /&gt;
conventions.  It should be noted that the DODS standard is a small&lt;br /&gt;
subset of these metadata definitions, and may well be applicable to&lt;br /&gt;
data from other scientific (or other) disciplines.  In addition, the&lt;br /&gt;
architecture of the DODS software does not preclude the adoption of&lt;br /&gt;
alternate data standards that may be more appropriate to those other&lt;br /&gt;
fields.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a similar effort, attempting to assert some order over incompatible&lt;br /&gt;
data attributes among netCDF files, the COARDS project&lt;br /&gt;
[http://ferret.wrc.noaa.gov/noaa_coop/coop_cdf_profile.html&amp;lt;cite&amp;gt;&amp;quot;Cooperative Ocean/Atmosphere Research Data Service&amp;quot;&amp;lt;/cite&amp;gt;] has&lt;br /&gt;
specified some standard attributes that shall be defined in a dataset.&lt;br /&gt;
Note that this has little or nothing to do with netCDF itself.  You&lt;br /&gt;
can have a netCDF dataset that doesn&#039;t comply with the COARDS&lt;br /&gt;
standard.  But it will be more useful to others if it does.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the DODS architecture allows data attributes to be added to&lt;br /&gt;
any dataset &#039;&#039;without&#039;&#039;  modifying the data files themselves.&lt;br /&gt;
This makes the task of conforming to the data standard fairly simple,&lt;br /&gt;
in most cases consisting of adding a few files to a directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, this is not an exhaustive list of attributes possible.&lt;br /&gt;
Beyond syntax-checking, the DODS software does no parsing of attribute&lt;br /&gt;
structures for a dataset.  You are free to add whatever attributes you&lt;br /&gt;
choose to any dataset served by a DODS server.  If you want to add&lt;br /&gt;
enough data attributes to make your metadata 100\&lt;br /&gt;
ISO Z39.50 GeoProfile, there is no reason not to do so.\footnote{We&lt;br /&gt;
would suggest that if you do add GeoProfile attributes not mentioned&lt;br /&gt;
in this document to your dataset, you should use the SGML attribute&lt;br /&gt;
tags as attribute names.  In the event that future DODS servers&lt;br /&gt;
support a part of the GeoProfile protocol, this will allow your&lt;br /&gt;
datasets to be merged seamlessly with that standard.}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Essential and Optional Attributes==&lt;br /&gt;
&lt;br /&gt;
One of the motivating principles of the DODS project is to keep the&lt;br /&gt;
burden on the data provider as light as possible.  To further decrease&lt;br /&gt;
the burden of making data available, the DODS data standard attributes&lt;br /&gt;
are separated into two groups:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Those that are essential to minimal data attribute interoperability, and&lt;br /&gt;
*Those that are very useful, but not essential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second group can be further split up among the more and less&lt;br /&gt;
useful attributes.&lt;br /&gt;
&lt;br /&gt;
The DODS project recognizes these as different &amp;quot;classes&amp;quot; of&lt;br /&gt;
compatibility.  For example, a class 0 DODS dataset is one that is&lt;br /&gt;
served by DODS, but does not comply with the DODS data standards,&lt;br /&gt;
except in the most minimal way.  A class 1 dataset conforms, but only&lt;br /&gt;
contains the essential attributes.  A class 2 datasets conforms and&lt;br /&gt;
contains the essential and the class 2 attributes, and so on.  The&lt;br /&gt;
attributes described in the following sections are identified by their&lt;br /&gt;
classes in this way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Global and Variable Attributes===&lt;br /&gt;
&lt;br /&gt;
DODS attributes consist of sets of name-value&lt;br /&gt;
pairs [[Wiki_Testing/dods-standards|(1)]].  To say that a data variable has&lt;br /&gt;
attributes is the same as saying that there is a set of attributes (in&lt;br /&gt;
the dataset&#039;s DAS) with the same name as this variable.  The set can&lt;br /&gt;
contain one or more name-value pairs, such as &amp;quot;units&amp;quot; with&lt;br /&gt;
&amp;quot;degreesC&amp;quot; and &amp;quot;scale_factor&amp;quot; with &amp;quot;2.35&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Consider the dataset with a DDS like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Int16 temp[time = 16][lat = 17][lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 lat[lat = 17];&lt;br /&gt;
&lt;br /&gt;
Float32 lon[lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 time[time = 16];&lt;br /&gt;
} test1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS for this DODS-compliant dataset might look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
temp {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Surface Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String missing_value &amp;quot;-32767&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String scale_factor &amp;quot;0.005&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temp&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
time {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;hours from base_time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String conventions &amp;quot;DODS&amp;quot;, &amp;quot;COARDS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One of the attribute containers in this DAS does not correspond to any&lt;br /&gt;
data variables.  The attributes in this container are said to be&lt;br /&gt;
&amp;quot;global&amp;quot; attributes, and modify the entire dataset.  There is&lt;br /&gt;
nothing special about the names; an attribute container can be called&lt;br /&gt;
anything at all.  However, the container called &amp;quot;DODS&amp;quot;, if it&lt;br /&gt;
exists, should contain the global attributes described in the DODS&lt;br /&gt;
data standard, such as &amp;lt;font color=&#039;green&#039;&amp;gt;conventions&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt;, and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Utterly Essential Attributes (Class 0)==&lt;br /&gt;
&lt;br /&gt;
The following attributes must appear in any DODS dataset for it to be&lt;br /&gt;
considered class 0 compliant.  These attributes must be defined for&lt;br /&gt;
&#039;&#039;each&#039;&#039;  data variable in the dataset.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; : A long descriptive name (title). This could be used for labelling plots, for example. If a variable has no &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; attribute assigned, the variable name should be used as a default.  This corresponds to the &amp;quot;Detailed Variable&amp;quot; field of the GCMD variable naming hierarchy.  &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; : A character array that specifies the units used for the variable&#039;s data. The units attribute should be formatted as per the recommendations in the Unidata [http://www.unidata.ucar.edu/packages/udunits/ &amp;lt;cite&amp;gt;udunits&amp;lt;/cite&amp;gt;]  package.  &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; : If present for a variable, the data are to be multiplied by this factor after the data are read by the application that accesses the data. One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; : If present for a variable, this number is to be added to the data after it is read by the application that accesses the data.  One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified. If both &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; attributes are present, the data are first scaled before the offset is added.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; : This is a string containing a transformation function used to convert the raw data into the units specifed in the &amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; attribute. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
There are some special cases, outlined in the next two sections.&lt;br /&gt;
However, if your dataset contains no null values, and no data stored&lt;br /&gt;
as DODS Arrays, the above list is complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: A DODS Array is a different data type than a Grid, and contains&lt;br /&gt;
less information about its independent variables.  For more&lt;br /&gt;
information, see below, or refer to the [http://docs.opendap.org/index.php/Wiki_Testing/OpeNDAP_User%27s_Guide&amp;lt;cite&amp;gt;OPeNDAP User Guide&amp;lt;/ite&amp;gt;] .&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Missing Data===&lt;br /&gt;
&lt;br /&gt;
If a dataset contains missing data flagged with special values, those&lt;br /&gt;
values must be specified in the attribute list of the variable.  That&lt;br /&gt;
is, if you have a data sequence called &amp;lt;font color=&#039;green&#039;&amp;gt;ralph&amp;lt;/font&amp;gt;, and it contains missing values flagged with -999, the DAS for the dataset should have an&lt;br /&gt;
attribute container like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
ralph {&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DODS metadata standard provides three categories of missing data.&lt;br /&gt;
These attribute values are essential only in the sense that they must&lt;br /&gt;
be in the data variable&#039;s attribute container &#039;&#039;if you use them&#039;&#039; .&lt;br /&gt;
If your data doesn&#039;t use these values---that is, if there are no&lt;br /&gt;
missing values flagged with special numeric values--these attributes&lt;br /&gt;
need not be specified.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;missing_value&amp;lt;/font&amp;gt; :  This is a conventional name for a missing value that will not be treated in any special way by the client application.  This attribute is part of the COARDS standard.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;null_value&amp;lt;/font&amp;gt; : A null value differs from a missing value in that it describes data that isn&#039;t there, but shouldn&#039;t have been, either.  That is, where a missing value might be used to fill in for a sensor malfunction, a null value is used to indicate that no data was taken.  A dataset that contained random data interpolated onto a grid might use a null value on those grid points too distant from data values to make an accurate estimate.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;default_value&amp;lt;/font&amp;gt; :  A default value is yet another sort of missing data.  In this case, data would never have been at those points.  Land points in gridded sea-surface temperature data would be default values, as would the end of profile data vectors filled to uniform length.  This differs some from the semantics of the COARDS &amp;lt;font color=&#039;green&#039;&amp;gt;_FillValue&amp;lt;/font&amp;gt;, but perhaps not so far as to prevent the DODS project from adopting the COARDS name as a synonym.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Array Data===&lt;br /&gt;
&lt;br /&gt;
A dataset containing only an array may be missing some important&lt;br /&gt;
information about the dataset&#039;s independent variables.  To make the&lt;br /&gt;
dataset conpliant with the Class 0 of the DODS standard, this&lt;br /&gt;
information must be included in the attribute list.&lt;br /&gt;
&lt;br /&gt;
The information missing from an Array variable is the location of that&lt;br /&gt;
array&#039;s corners---the &amp;lt;font color=&#039;green&#039;&amp;gt;min&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;max&amp;lt;/font&amp;gt; for each dimension---and&lt;br /&gt;
other information about the array dimensions.  The requirements,&lt;br /&gt;
therefore, are that an Array&#039;s dimensions be named, and that attribute&lt;br /&gt;
containers with those same names be contained in the dataset DAS.&lt;br /&gt;
That is, for a dataset with the following array data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Array {&lt;br /&gt;
&lt;br /&gt;
Byte dsp_band_1[lat = 1024][lon = 1024];&lt;br /&gt;
&lt;br /&gt;
} dsp_band_1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS should look something like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
dsp_band_1 {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;AVHRR sea surface temperature data&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 scale_factor 0.15625;&lt;br /&gt;
&lt;br /&gt;
Float32 add_offset 5.0;&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min 0.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 70.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min -100.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 0.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If using the name of the dimension would cause a name collision with&lt;br /&gt;
some other variable in the dataset, you can use the name of the&lt;br /&gt;
dimension prefixed by the name of the array.  That is, in the above&lt;br /&gt;
example, the attribute containers for the array dimensions would be&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lat&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lon&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Less Essential, But Still Useful Attributes (Class 1)==&lt;br /&gt;
&lt;br /&gt;
The optional attributes are divided into two different classes.  This&lt;br /&gt;
again allows a data provider some latitude in the class of compliance&lt;br /&gt;
with the standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;short_name&amp;lt;/font&amp;gt; : This is the name of the variable, taken from&lt;br /&gt;
a list of DODS names (see \appref{std-names}).  Including this&lt;br /&gt;
attribute is a way to ensure that two datasets can be usefully&lt;br /&gt;
compared with one another on a variable-by-variable basis.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Convention&amp;lt;/font&amp;gt; : This global attribute is recommended to&lt;br /&gt;
identify the dataset as conforming to the DODS data standard,&lt;br /&gt;
identified here.  The attribute should be a string with the value&lt;br /&gt;
&amp;quot;DODS&amp;quot;.   Note that this is a global attribute, and should appear&lt;br /&gt;
in the &amp;quot;DODS&amp;quot; attribute container, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String Convention &amp;quot;DODS&amp;quot;; }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the presence of the &amp;quot;DODS&amp;quot; attribute container is itself&lt;br /&gt;
a clue to whether the dataset is DODS-compliant or not.&lt;br /&gt;
To be compliant with the&lt;br /&gt;
GeoProfile, one element in the Convention vector should read&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;FGDC Content Standards for Digital Geospatial Metadata&amp;lt;/font&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Very Useful Attributes, But Not Essential (Class 2)==&lt;br /&gt;
&lt;br /&gt;
This is a set of attributes that has been found to be quite useful in&lt;br /&gt;
the use of DODS datasets.  A dataset can be considered to be class 2&lt;br /&gt;
compliant if it contains more than one of these attributes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt; : This string should contain an acknowledgement&lt;br /&gt;
paragraph that can appear in papers that use the data from this&lt;br /&gt;
dataset.  For example: &amp;quot;The principal investigators in the&lt;br /&gt;
production of these data are J.D. Elms, S.D. Woodruff, and&lt;br /&gt;
S. Worley (http://www.cdc.noaa.gov/coads/participants.html).&amp;quot; and&lt;br /&gt;
so on.  This is a global attribute, and should appear in the&lt;br /&gt;
&amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; : The &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; attribute is recommended to&lt;br /&gt;
record the evolution of the data contained within a DODS data file.&lt;br /&gt;
Applications which process this data can append their information to&lt;br /&gt;
this attribute.  This is a global attribute, and should appear in&lt;br /&gt;
the &amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Data_Use_Policy&amp;lt;/font&amp;gt; : If there are any restrictions on the use&lt;br /&gt;
of the data, they should be noted in the string with this name.&lt;br /&gt;
This is a global attribute, and should appear in the &amp;quot;DODS&amp;quot;&lt;br /&gt;
attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Theme&amp;lt;/font&amp;gt; : A string containing one or more of the GCMD parameter&lt;br /&gt;
valid names. See \xlink{the &amp;quot;GCMD Parameters&amp;quot; list maintained at GCMD.}  {http://gcmd.gsfc.nasa.gov/cgi-bin/md/valids_display.pl}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2055</id>
		<title>Wiki Testing/dods-standards</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2055"/>
		<updated>2008-02-07T10:21:50Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Utterly Essential Attributes (Class 0) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=The Emerging DODS Data Standards=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using DODS, a scientist or data center can make their data readily&lt;br /&gt;
available to anyone who knows about it.  But there is a difference&lt;br /&gt;
between &amp;quot;readily available&amp;quot; and &amp;quot;readily usable.&amp;quot;  Just because&lt;br /&gt;
DODS can easily retrieve data doesn&#039;t mean that it is easy to use.&lt;br /&gt;
&lt;br /&gt;
The DODS project has found that the single biggest obstacle to ease of&lt;br /&gt;
use of a dataset&#039;s data is incompatibility of metadata, or data&lt;br /&gt;
attributes.\footnote{Please see the \DODSuser for a discussion of&lt;br /&gt;
&lt;br /&gt;
DODS treatment of attributes, or metadata.}  This incompatibility&lt;br /&gt;
can range from the seemingly simple, such as different data names, to&lt;br /&gt;
the far less tractable, such as incompatible time representations.&lt;br /&gt;
&lt;br /&gt;
To address this problem, the DODS project has created the data&lt;br /&gt;
attribute standard described in this chapter.  This standard is&lt;br /&gt;
&#039;&#039;entirely optional&#039;&#039; .  A server can still serve data from a DODS&lt;br /&gt;
dataset that does not conform to this standard, and a DODS client can&lt;br /&gt;
still read that data.  However, a dataset that conforms to this&lt;br /&gt;
standard will be more easily read and processed by another user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE:The DODS project has an original emphasis on oceanography.&lt;br /&gt;
Therefore, the DODS standard described here has been defined, where&lt;br /&gt;
possible, to be compatible with existing geo-spatial metadata&lt;br /&gt;
conventions, including the COARDS and the ISO Z39.50 GeoProfile&lt;br /&gt;
conventions.  It should be noted that the DODS standard is a small&lt;br /&gt;
subset of these metadata definitions, and may well be applicable to&lt;br /&gt;
data from other scientific (or other) disciplines.  In addition, the&lt;br /&gt;
architecture of the DODS software does not preclude the adoption of&lt;br /&gt;
alternate data standards that may be more appropriate to those other&lt;br /&gt;
fields.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a similar effort, attempting to assert some order over incompatible&lt;br /&gt;
data attributes among netCDF files, the COARDS project&lt;br /&gt;
[http://ferret.wrc.noaa.gov/noaa_coop/coop_cdf_profile.html&amp;lt;cite&amp;gt;&amp;quot;Cooperative Ocean/Atmosphere Research Data Service&amp;quot;&amp;lt;/cite&amp;gt;] has&lt;br /&gt;
specified some standard attributes that shall be defined in a dataset.&lt;br /&gt;
Note that this has little or nothing to do with netCDF itself.  You&lt;br /&gt;
can have a netCDF dataset that doesn&#039;t comply with the COARDS&lt;br /&gt;
standard.  But it will be more useful to others if it does.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the DODS architecture allows data attributes to be added to&lt;br /&gt;
any dataset &#039;&#039;without&#039;&#039;  modifying the data files themselves.&lt;br /&gt;
This makes the task of conforming to the data standard fairly simple,&lt;br /&gt;
in most cases consisting of adding a few files to a directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, this is not an exhaustive list of attributes possible.&lt;br /&gt;
Beyond syntax-checking, the DODS software does no parsing of attribute&lt;br /&gt;
structures for a dataset.  You are free to add whatever attributes you&lt;br /&gt;
choose to any dataset served by a DODS server.  If you want to add&lt;br /&gt;
enough data attributes to make your metadata 100\&lt;br /&gt;
ISO Z39.50 GeoProfile, there is no reason not to do so.\footnote{We&lt;br /&gt;
would suggest that if you do add GeoProfile attributes not mentioned&lt;br /&gt;
in this document to your dataset, you should use the SGML attribute&lt;br /&gt;
tags as attribute names.  In the event that future DODS servers&lt;br /&gt;
support a part of the GeoProfile protocol, this will allow your&lt;br /&gt;
datasets to be merged seamlessly with that standard.}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Essential and Optional Attributes==&lt;br /&gt;
&lt;br /&gt;
One of the motivating principles of the DODS project is to keep the&lt;br /&gt;
burden on the data provider as light as possible.  To further decrease&lt;br /&gt;
the burden of making data available, the DODS data standard attributes&lt;br /&gt;
are separated into two groups:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Those that are essential to minimal data attribute interoperability, and&lt;br /&gt;
*Those that are very useful, but not essential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second group can be further split up among the more and less&lt;br /&gt;
useful attributes.&lt;br /&gt;
&lt;br /&gt;
The DODS project recognizes these as different &amp;quot;classes&amp;quot; of&lt;br /&gt;
compatibility.  For example, a class 0 DODS dataset is one that is&lt;br /&gt;
served by DODS, but does not comply with the DODS data standards,&lt;br /&gt;
except in the most minimal way.  A class 1 dataset conforms, but only&lt;br /&gt;
contains the essential attributes.  A class 2 datasets conforms and&lt;br /&gt;
contains the essential and the class 2 attributes, and so on.  The&lt;br /&gt;
attributes described in the following sections are identified by their&lt;br /&gt;
classes in this way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Global and Variable Attributes===&lt;br /&gt;
&lt;br /&gt;
DODS attributes consist of sets of name-value&lt;br /&gt;
pairs [[Wiki_Testing/dods-standards|(1)]].  To say that a data variable has&lt;br /&gt;
attributes is the same as saying that there is a set of attributes (in&lt;br /&gt;
the dataset&#039;s DAS) with the same name as this variable.  The set can&lt;br /&gt;
contain one or more name-value pairs, such as &amp;quot;units&amp;quot; with&lt;br /&gt;
&amp;quot;degreesC&amp;quot; and &amp;quot;scale_factor&amp;quot; with &amp;quot;2.35&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Consider the dataset with a DDS like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Int16 temp[time = 16][lat = 17][lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 lat[lat = 17];&lt;br /&gt;
&lt;br /&gt;
Float32 lon[lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 time[time = 16];&lt;br /&gt;
} test1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS for this DODS-compliant dataset might look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
temp {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Surface Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String missing_value &amp;quot;-32767&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String scale_factor &amp;quot;0.005&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temp&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
time {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;hours from base_time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String conventions &amp;quot;DODS&amp;quot;, &amp;quot;COARDS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One of the attribute containers in this DAS does not correspond to any&lt;br /&gt;
data variables.  The attributes in this container are said to be&lt;br /&gt;
&amp;quot;global&amp;quot; attributes, and modify the entire dataset.  There is&lt;br /&gt;
nothing special about the names; an attribute container can be called&lt;br /&gt;
anything at all.  However, the container called &amp;quot;DODS&amp;quot;, if it&lt;br /&gt;
exists, should contain the global attributes described in the DODS&lt;br /&gt;
data standard, such as &amp;lt;font color=&#039;green&#039;&amp;gt;conventions&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt;, and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Utterly Essential Attributes (Class 0)==&lt;br /&gt;
&lt;br /&gt;
The following attributes must appear in any DODS dataset for it to be&lt;br /&gt;
considered class 0 compliant.  These attributes must be defined for&lt;br /&gt;
&#039;&#039;each&#039;&#039;  data variable in the dataset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; : A long descriptive name (title). This could be used for labelling plots, for example. If a variable has no &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; attribute assigned, the variable name should be used as a default.  This corresponds to the &amp;quot;Detailed Variable&amp;quot; field of the GCMD variable naming hierarchy. (\iso{Attribute_Label}{3507}{attrlabl})&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; : A character array that specifies the units used for&lt;br /&gt;
the variable&#039;s data. The units attribute should be formatted as per&lt;br /&gt;
the recommendations in the Unidata&lt;br /&gt;
[http://www.unidata.ucar.edu/packages/udunits/ &amp;lt;cite&amp;gt;udunits&amp;lt;/cite&amp;gt;]  package. (\iso{Attribute_Units_of_Measurement}{3522}{attrunit}).&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; : If present for a variable, the data are to&lt;br /&gt;
be multiplied by this factor after the data are read by the&lt;br /&gt;
application that accesses the data. One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the&lt;br /&gt;
specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; : If present for a variable, this number is to&lt;br /&gt;
be added to the data after it is read by the application that&lt;br /&gt;
accesses the data.  One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the&lt;br /&gt;
specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified.&lt;br /&gt;
If both &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; attributes are&lt;br /&gt;
present, the data are first scaled before the offset is added.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; : This is a string containing a transformation&lt;br /&gt;
function used to convert the raw data into the units specifed in the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; attribute.\footnote{The format of the function&lt;br /&gt;
specification (i.e. Java, Perl, Tcl, Lisp, whatever) is not&lt;br /&gt;
currently specified.}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some special cases, outlined in the next two sections.&lt;br /&gt;
However, if your dataset contains no null values, and no data stored&lt;br /&gt;
as DODS Arrays, the above list is complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;A DODS Array is a different data type than a Grid, and contains&lt;br /&gt;
less information about its independent variables.  For more&lt;br /&gt;
information, see below, or refer to the \DODSuser .&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Missing Data===&lt;br /&gt;
&lt;br /&gt;
If a dataset contains missing data flagged with special values, those&lt;br /&gt;
values must be specified in the attribute list of the variable.  That&lt;br /&gt;
is, if you have a data sequence called &amp;lt;font color=&#039;green&#039;&amp;gt;ralph&amp;lt;/font&amp;gt;, and it contains missing&lt;br /&gt;
values flagged with -999, the DAS for the dataset should have an&lt;br /&gt;
attribute container like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
ralph {&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DODS metadata standard provides three categories of missing data.&lt;br /&gt;
These attribute values are essential only in the sense that they must&lt;br /&gt;
be in the data variable&#039;s attribute container &#039;&#039;if you use them&#039;&#039; .&lt;br /&gt;
If your data doesn&#039;t use these values---that is, if there are no&lt;br /&gt;
missing values flagged with special numeric values--these attributes&lt;br /&gt;
need not be specified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;missing_value&amp;lt;/font&amp;gt; :  This is a conventional name for a&lt;br /&gt;
missing value that will not be treated in any special way by the&lt;br /&gt;
client application.  This attribute is part of the COARDS standard.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;null_value&amp;lt;/font&amp;gt; : A null value differs from a missing value in&lt;br /&gt;
that it describes data that isn&#039;t there, but shouldn&#039;t have been,&lt;br /&gt;
either.  That is, where a missing value might be used to fill in for&lt;br /&gt;
a sensor malfunction, a null value is used to indicate that no data&lt;br /&gt;
was taken.  A dataset that contained random data interpolated onto a&lt;br /&gt;
grid might use a null value on those grid points too distant from&lt;br /&gt;
data values to make an accurate estimate.\footnote{The COARDS&lt;br /&gt;
standard does not make this distinction, and would use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;missing_value&amp;lt;/font&amp;gt; for these points.}&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;default_value&amp;lt;/font&amp;gt; :  A default value is yet another sort of&lt;br /&gt;
missing data.  In this case, data would never have been at those&lt;br /&gt;
points.  Land points in gridded sea-surface temperature data would&lt;br /&gt;
be default values, as would the end of profile data vectors filled&lt;br /&gt;
to uniform length.  This differs some from the semantics of the&lt;br /&gt;
COARDS &amp;lt;font color=&#039;green&#039;&amp;gt;_FillValue&amp;lt;/font&amp;gt;, but perhaps not so far as to prevent the&lt;br /&gt;
DODS project from adopting the COARDS name as a synonym.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Array Data===&lt;br /&gt;
&lt;br /&gt;
A dataset containing only an array may be missing some important&lt;br /&gt;
information about the dataset&#039;s independent variables.  To make the&lt;br /&gt;
dataset conpliant with the Class 0 of the DODS standard, this&lt;br /&gt;
information must be included in the attribute list.&lt;br /&gt;
&lt;br /&gt;
The information missing from an Array variable is the location of that&lt;br /&gt;
array&#039;s corners---the &amp;lt;font color=&#039;green&#039;&amp;gt;min&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;max&amp;lt;/font&amp;gt; for each dimension---and&lt;br /&gt;
other information about the array dimensions.  The requirements,&lt;br /&gt;
therefore, are that an Array&#039;s dimensions be named, and that attribute&lt;br /&gt;
containers with those same names be contained in the dataset DAS.&lt;br /&gt;
That is, for a dataset with the following array data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Array {&lt;br /&gt;
&lt;br /&gt;
Byte dsp_band_1[lat = 1024][lon = 1024];&lt;br /&gt;
&lt;br /&gt;
} dsp_band_1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS should look something like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
dsp_band_1 {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;AVHRR sea surface temperature data&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 scale_factor 0.15625;&lt;br /&gt;
&lt;br /&gt;
Float32 add_offset 5.0;&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min 0.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 70.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min -100.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 0.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If using the name of the dimension would cause a name collision with&lt;br /&gt;
some other variable in the dataset, you can use the name of the&lt;br /&gt;
dimension prefixed by the name of the array.  That is, in the above&lt;br /&gt;
example, the attribute containers for the array dimensions would be&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lat&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lon&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Less Essential, But Still Useful Attributes (Class 1)==&lt;br /&gt;
&lt;br /&gt;
The optional attributes are divided into two different classes.  This&lt;br /&gt;
again allows a data provider some latitude in the class of compliance&lt;br /&gt;
with the standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;short_name&amp;lt;/font&amp;gt; : This is the name of the variable, taken from&lt;br /&gt;
a list of DODS names (see \appref{std-names}).  Including this&lt;br /&gt;
attribute is a way to ensure that two datasets can be usefully&lt;br /&gt;
compared with one another on a variable-by-variable basis.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Convention&amp;lt;/font&amp;gt; : This global attribute is recommended to&lt;br /&gt;
identify the dataset as conforming to the DODS data standard,&lt;br /&gt;
identified here.  The attribute should be a string with the value&lt;br /&gt;
&amp;quot;DODS&amp;quot;.   Note that this is a global attribute, and should appear&lt;br /&gt;
in the &amp;quot;DODS&amp;quot; attribute container, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String Convention &amp;quot;DODS&amp;quot;; }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the presence of the &amp;quot;DODS&amp;quot; attribute container is itself&lt;br /&gt;
a clue to whether the dataset is DODS-compliant or not.&lt;br /&gt;
To be compliant with the&lt;br /&gt;
GeoProfile, one element in the Convention vector should read&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;FGDC Content Standards for Digital Geospatial Metadata&amp;lt;/font&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Very Useful Attributes, But Not Essential (Class 2)==&lt;br /&gt;
&lt;br /&gt;
This is a set of attributes that has been found to be quite useful in&lt;br /&gt;
the use of DODS datasets.  A dataset can be considered to be class 2&lt;br /&gt;
compliant if it contains more than one of these attributes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt; : This string should contain an acknowledgement&lt;br /&gt;
paragraph that can appear in papers that use the data from this&lt;br /&gt;
dataset.  For example: &amp;quot;The principal investigators in the&lt;br /&gt;
production of these data are J.D. Elms, S.D. Woodruff, and&lt;br /&gt;
S. Worley (http://www.cdc.noaa.gov/coads/participants.html).&amp;quot; and&lt;br /&gt;
so on.  This is a global attribute, and should appear in the&lt;br /&gt;
&amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; : The &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; attribute is recommended to&lt;br /&gt;
record the evolution of the data contained within a DODS data file.&lt;br /&gt;
Applications which process this data can append their information to&lt;br /&gt;
this attribute.  This is a global attribute, and should appear in&lt;br /&gt;
the &amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Data_Use_Policy&amp;lt;/font&amp;gt; : If there are any restrictions on the use&lt;br /&gt;
of the data, they should be noted in the string with this name.&lt;br /&gt;
This is a global attribute, and should appear in the &amp;quot;DODS&amp;quot;&lt;br /&gt;
attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Theme&amp;lt;/font&amp;gt; : A string containing one or more of the GCMD parameter&lt;br /&gt;
valid names. See \xlink{the &amp;quot;GCMD Parameters&amp;quot; list maintained at GCMD.}  {http://gcmd.gsfc.nasa.gov/cgi-bin/md/valids_display.pl}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2054</id>
		<title>Wiki Testing/dods-standards</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2054"/>
		<updated>2008-02-07T10:21:21Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Essential and Optional Attributes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=The Emerging DODS Data Standards=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using DODS, a scientist or data center can make their data readily&lt;br /&gt;
available to anyone who knows about it.  But there is a difference&lt;br /&gt;
between &amp;quot;readily available&amp;quot; and &amp;quot;readily usable.&amp;quot;  Just because&lt;br /&gt;
DODS can easily retrieve data doesn&#039;t mean that it is easy to use.&lt;br /&gt;
&lt;br /&gt;
The DODS project has found that the single biggest obstacle to ease of&lt;br /&gt;
use of a dataset&#039;s data is incompatibility of metadata, or data&lt;br /&gt;
attributes.\footnote{Please see the \DODSuser for a discussion of&lt;br /&gt;
&lt;br /&gt;
DODS treatment of attributes, or metadata.}  This incompatibility&lt;br /&gt;
can range from the seemingly simple, such as different data names, to&lt;br /&gt;
the far less tractable, such as incompatible time representations.&lt;br /&gt;
&lt;br /&gt;
To address this problem, the DODS project has created the data&lt;br /&gt;
attribute standard described in this chapter.  This standard is&lt;br /&gt;
&#039;&#039;entirely optional&#039;&#039; .  A server can still serve data from a DODS&lt;br /&gt;
dataset that does not conform to this standard, and a DODS client can&lt;br /&gt;
still read that data.  However, a dataset that conforms to this&lt;br /&gt;
standard will be more easily read and processed by another user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE:The DODS project has an original emphasis on oceanography.&lt;br /&gt;
Therefore, the DODS standard described here has been defined, where&lt;br /&gt;
possible, to be compatible with existing geo-spatial metadata&lt;br /&gt;
conventions, including the COARDS and the ISO Z39.50 GeoProfile&lt;br /&gt;
conventions.  It should be noted that the DODS standard is a small&lt;br /&gt;
subset of these metadata definitions, and may well be applicable to&lt;br /&gt;
data from other scientific (or other) disciplines.  In addition, the&lt;br /&gt;
architecture of the DODS software does not preclude the adoption of&lt;br /&gt;
alternate data standards that may be more appropriate to those other&lt;br /&gt;
fields.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a similar effort, attempting to assert some order over incompatible&lt;br /&gt;
data attributes among netCDF files, the COARDS project&lt;br /&gt;
[http://ferret.wrc.noaa.gov/noaa_coop/coop_cdf_profile.html&amp;lt;cite&amp;gt;&amp;quot;Cooperative Ocean/Atmosphere Research Data Service&amp;quot;&amp;lt;/cite&amp;gt;] has&lt;br /&gt;
specified some standard attributes that shall be defined in a dataset.&lt;br /&gt;
Note that this has little or nothing to do with netCDF itself.  You&lt;br /&gt;
can have a netCDF dataset that doesn&#039;t comply with the COARDS&lt;br /&gt;
standard.  But it will be more useful to others if it does.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the DODS architecture allows data attributes to be added to&lt;br /&gt;
any dataset &#039;&#039;without&#039;&#039;  modifying the data files themselves.&lt;br /&gt;
This makes the task of conforming to the data standard fairly simple,&lt;br /&gt;
in most cases consisting of adding a few files to a directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, this is not an exhaustive list of attributes possible.&lt;br /&gt;
Beyond syntax-checking, the DODS software does no parsing of attribute&lt;br /&gt;
structures for a dataset.  You are free to add whatever attributes you&lt;br /&gt;
choose to any dataset served by a DODS server.  If you want to add&lt;br /&gt;
enough data attributes to make your metadata 100\&lt;br /&gt;
ISO Z39.50 GeoProfile, there is no reason not to do so.\footnote{We&lt;br /&gt;
would suggest that if you do add GeoProfile attributes not mentioned&lt;br /&gt;
in this document to your dataset, you should use the SGML attribute&lt;br /&gt;
tags as attribute names.  In the event that future DODS servers&lt;br /&gt;
support a part of the GeoProfile protocol, this will allow your&lt;br /&gt;
datasets to be merged seamlessly with that standard.}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Essential and Optional Attributes==&lt;br /&gt;
&lt;br /&gt;
One of the motivating principles of the DODS project is to keep the&lt;br /&gt;
burden on the data provider as light as possible.  To further decrease&lt;br /&gt;
the burden of making data available, the DODS data standard attributes&lt;br /&gt;
are separated into two groups:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Those that are essential to minimal data attribute interoperability, and&lt;br /&gt;
*Those that are very useful, but not essential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second group can be further split up among the more and less&lt;br /&gt;
useful attributes.&lt;br /&gt;
&lt;br /&gt;
The DODS project recognizes these as different &amp;quot;classes&amp;quot; of&lt;br /&gt;
compatibility.  For example, a class 0 DODS dataset is one that is&lt;br /&gt;
served by DODS, but does not comply with the DODS data standards,&lt;br /&gt;
except in the most minimal way.  A class 1 dataset conforms, but only&lt;br /&gt;
contains the essential attributes.  A class 2 datasets conforms and&lt;br /&gt;
contains the essential and the class 2 attributes, and so on.  The&lt;br /&gt;
attributes described in the following sections are identified by their&lt;br /&gt;
classes in this way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Global and Variable Attributes===&lt;br /&gt;
&lt;br /&gt;
DODS attributes consist of sets of name-value&lt;br /&gt;
pairs [[Wiki_Testing/dods-standards|(1)]].  To say that a data variable has&lt;br /&gt;
attributes is the same as saying that there is a set of attributes (in&lt;br /&gt;
the dataset&#039;s DAS) with the same name as this variable.  The set can&lt;br /&gt;
contain one or more name-value pairs, such as &amp;quot;units&amp;quot; with&lt;br /&gt;
&amp;quot;degreesC&amp;quot; and &amp;quot;scale_factor&amp;quot; with &amp;quot;2.35&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Consider the dataset with a DDS like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Int16 temp[time = 16][lat = 17][lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 lat[lat = 17];&lt;br /&gt;
&lt;br /&gt;
Float32 lon[lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 time[time = 16];&lt;br /&gt;
} test1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS for this DODS-compliant dataset might look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
temp {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Surface Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String missing_value &amp;quot;-32767&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String scale_factor &amp;quot;0.005&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temp&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
time {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;hours from base_time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String conventions &amp;quot;DODS&amp;quot;, &amp;quot;COARDS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One of the attribute containers in this DAS does not correspond to any&lt;br /&gt;
data variables.  The attributes in this container are said to be&lt;br /&gt;
&amp;quot;global&amp;quot; attributes, and modify the entire dataset.  There is&lt;br /&gt;
nothing special about the names; an attribute container can be called&lt;br /&gt;
anything at all.  However, the container called &amp;quot;DODS&amp;quot;, if it&lt;br /&gt;
exists, should contain the global attributes described in the DODS&lt;br /&gt;
data standard, such as &amp;lt;font color=&#039;green&#039;&amp;gt;conventions&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt;, and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Utterly Essential Attributes (Class 0)==&lt;br /&gt;
&lt;br /&gt;
The following attributes must appear in any DODS dataset for it to be&lt;br /&gt;
considered class 0 compliant.  These attributes must be defined for&lt;br /&gt;
&#039;&#039;each&#039;&#039;  data variable in the dataset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; : A long descriptive name (title). This could be&lt;br /&gt;
used for labelling plots, for example. If a variable has no&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; attribute assigned, the variable name should be&lt;br /&gt;
used as a default.  This corresponds to the &amp;quot;Detailed Variable&amp;quot;&lt;br /&gt;
field of the GCMD variable naming hierarchy.&lt;br /&gt;
(\iso{Attribute_Label}{3507}{attrlabl})&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; : A character array that specifies the units used for&lt;br /&gt;
the variable&#039;s data. The units attribute should be formatted as per&lt;br /&gt;
the recommendations in the Unidata&lt;br /&gt;
[http://www.unidata.ucar.edu/packages/udunits/ &amp;lt;cite&amp;gt;udunits&amp;lt;/cite&amp;gt;]  package. (\iso{Attribute_Units_of_Measurement}{3522}{attrunit}).&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; : If present for a variable, the data are to&lt;br /&gt;
be multiplied by this factor after the data are read by the&lt;br /&gt;
application that accesses the data. One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the&lt;br /&gt;
specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; : If present for a variable, this number is to&lt;br /&gt;
be added to the data after it is read by the application that&lt;br /&gt;
accesses the data.  One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the&lt;br /&gt;
specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified.&lt;br /&gt;
If both &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; attributes are&lt;br /&gt;
present, the data are first scaled before the offset is added.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; : This is a string containing a transformation&lt;br /&gt;
function used to convert the raw data into the units specifed in the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; attribute.\footnote{The format of the function&lt;br /&gt;
specification (i.e. Java, Perl, Tcl, Lisp, whatever) is not&lt;br /&gt;
currently specified.}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some special cases, outlined in the next two sections.&lt;br /&gt;
However, if your dataset contains no null values, and no data stored&lt;br /&gt;
as DODS Arrays, the above list is complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;A DODS Array is a different data type than a Grid, and contains&lt;br /&gt;
less information about its independent variables.  For more&lt;br /&gt;
information, see below, or refer to the \DODSuser .&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Missing Data===&lt;br /&gt;
&lt;br /&gt;
If a dataset contains missing data flagged with special values, those&lt;br /&gt;
values must be specified in the attribute list of the variable.  That&lt;br /&gt;
is, if you have a data sequence called &amp;lt;font color=&#039;green&#039;&amp;gt;ralph&amp;lt;/font&amp;gt;, and it contains missing&lt;br /&gt;
values flagged with -999, the DAS for the dataset should have an&lt;br /&gt;
attribute container like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
ralph {&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DODS metadata standard provides three categories of missing data.&lt;br /&gt;
These attribute values are essential only in the sense that they must&lt;br /&gt;
be in the data variable&#039;s attribute container &#039;&#039;if you use them&#039;&#039; .&lt;br /&gt;
If your data doesn&#039;t use these values---that is, if there are no&lt;br /&gt;
missing values flagged with special numeric values--these attributes&lt;br /&gt;
need not be specified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;missing_value&amp;lt;/font&amp;gt; :  This is a conventional name for a&lt;br /&gt;
missing value that will not be treated in any special way by the&lt;br /&gt;
client application.  This attribute is part of the COARDS standard.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;null_value&amp;lt;/font&amp;gt; : A null value differs from a missing value in&lt;br /&gt;
that it describes data that isn&#039;t there, but shouldn&#039;t have been,&lt;br /&gt;
either.  That is, where a missing value might be used to fill in for&lt;br /&gt;
a sensor malfunction, a null value is used to indicate that no data&lt;br /&gt;
was taken.  A dataset that contained random data interpolated onto a&lt;br /&gt;
grid might use a null value on those grid points too distant from&lt;br /&gt;
data values to make an accurate estimate.\footnote{The COARDS&lt;br /&gt;
standard does not make this distinction, and would use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;missing_value&amp;lt;/font&amp;gt; for these points.}&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;default_value&amp;lt;/font&amp;gt; :  A default value is yet another sort of&lt;br /&gt;
missing data.  In this case, data would never have been at those&lt;br /&gt;
points.  Land points in gridded sea-surface temperature data would&lt;br /&gt;
be default values, as would the end of profile data vectors filled&lt;br /&gt;
to uniform length.  This differs some from the semantics of the&lt;br /&gt;
COARDS &amp;lt;font color=&#039;green&#039;&amp;gt;_FillValue&amp;lt;/font&amp;gt;, but perhaps not so far as to prevent the&lt;br /&gt;
DODS project from adopting the COARDS name as a synonym.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Array Data===&lt;br /&gt;
&lt;br /&gt;
A dataset containing only an array may be missing some important&lt;br /&gt;
information about the dataset&#039;s independent variables.  To make the&lt;br /&gt;
dataset conpliant with the Class 0 of the DODS standard, this&lt;br /&gt;
information must be included in the attribute list.&lt;br /&gt;
&lt;br /&gt;
The information missing from an Array variable is the location of that&lt;br /&gt;
array&#039;s corners---the &amp;lt;font color=&#039;green&#039;&amp;gt;min&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;max&amp;lt;/font&amp;gt; for each dimension---and&lt;br /&gt;
other information about the array dimensions.  The requirements,&lt;br /&gt;
therefore, are that an Array&#039;s dimensions be named, and that attribute&lt;br /&gt;
containers with those same names be contained in the dataset DAS.&lt;br /&gt;
That is, for a dataset with the following array data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Array {&lt;br /&gt;
&lt;br /&gt;
Byte dsp_band_1[lat = 1024][lon = 1024];&lt;br /&gt;
&lt;br /&gt;
} dsp_band_1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS should look something like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
dsp_band_1 {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;AVHRR sea surface temperature data&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 scale_factor 0.15625;&lt;br /&gt;
&lt;br /&gt;
Float32 add_offset 5.0;&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min 0.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 70.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min -100.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 0.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If using the name of the dimension would cause a name collision with&lt;br /&gt;
some other variable in the dataset, you can use the name of the&lt;br /&gt;
dimension prefixed by the name of the array.  That is, in the above&lt;br /&gt;
example, the attribute containers for the array dimensions would be&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lat&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lon&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Less Essential, But Still Useful Attributes (Class 1)==&lt;br /&gt;
&lt;br /&gt;
The optional attributes are divided into two different classes.  This&lt;br /&gt;
again allows a data provider some latitude in the class of compliance&lt;br /&gt;
with the standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;short_name&amp;lt;/font&amp;gt; : This is the name of the variable, taken from&lt;br /&gt;
a list of DODS names (see \appref{std-names}).  Including this&lt;br /&gt;
attribute is a way to ensure that two datasets can be usefully&lt;br /&gt;
compared with one another on a variable-by-variable basis.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Convention&amp;lt;/font&amp;gt; : This global attribute is recommended to&lt;br /&gt;
identify the dataset as conforming to the DODS data standard,&lt;br /&gt;
identified here.  The attribute should be a string with the value&lt;br /&gt;
&amp;quot;DODS&amp;quot;.   Note that this is a global attribute, and should appear&lt;br /&gt;
in the &amp;quot;DODS&amp;quot; attribute container, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String Convention &amp;quot;DODS&amp;quot;; }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the presence of the &amp;quot;DODS&amp;quot; attribute container is itself&lt;br /&gt;
a clue to whether the dataset is DODS-compliant or not.&lt;br /&gt;
To be compliant with the&lt;br /&gt;
GeoProfile, one element in the Convention vector should read&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;FGDC Content Standards for Digital Geospatial Metadata&amp;lt;/font&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Very Useful Attributes, But Not Essential (Class 2)==&lt;br /&gt;
&lt;br /&gt;
This is a set of attributes that has been found to be quite useful in&lt;br /&gt;
the use of DODS datasets.  A dataset can be considered to be class 2&lt;br /&gt;
compliant if it contains more than one of these attributes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt; : This string should contain an acknowledgement&lt;br /&gt;
paragraph that can appear in papers that use the data from this&lt;br /&gt;
dataset.  For example: &amp;quot;The principal investigators in the&lt;br /&gt;
production of these data are J.D. Elms, S.D. Woodruff, and&lt;br /&gt;
S. Worley (http://www.cdc.noaa.gov/coads/participants.html).&amp;quot; and&lt;br /&gt;
so on.  This is a global attribute, and should appear in the&lt;br /&gt;
&amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; : The &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; attribute is recommended to&lt;br /&gt;
record the evolution of the data contained within a DODS data file.&lt;br /&gt;
Applications which process this data can append their information to&lt;br /&gt;
this attribute.  This is a global attribute, and should appear in&lt;br /&gt;
the &amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Data_Use_Policy&amp;lt;/font&amp;gt; : If there are any restrictions on the use&lt;br /&gt;
of the data, they should be noted in the string with this name.&lt;br /&gt;
This is a global attribute, and should appear in the &amp;quot;DODS&amp;quot;&lt;br /&gt;
attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Theme&amp;lt;/font&amp;gt; : A string containing one or more of the GCMD parameter&lt;br /&gt;
valid names. See \xlink{the &amp;quot;GCMD Parameters&amp;quot; list maintained at GCMD.}  {http://gcmd.gsfc.nasa.gov/cgi-bin/md/valids_display.pl}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2053</id>
		<title>Wiki Testing/dods-standards</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/dods-standards&amp;diff=2053"/>
		<updated>2008-02-07T10:20:01Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* The Emerging DODS Data Standards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=The Emerging DODS Data Standards=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using DODS, a scientist or data center can make their data readily&lt;br /&gt;
available to anyone who knows about it.  But there is a difference&lt;br /&gt;
between &amp;quot;readily available&amp;quot; and &amp;quot;readily usable.&amp;quot;  Just because&lt;br /&gt;
DODS can easily retrieve data doesn&#039;t mean that it is easy to use.&lt;br /&gt;
&lt;br /&gt;
The DODS project has found that the single biggest obstacle to ease of&lt;br /&gt;
use of a dataset&#039;s data is incompatibility of metadata, or data&lt;br /&gt;
attributes.\footnote{Please see the \DODSuser for a discussion of&lt;br /&gt;
&lt;br /&gt;
DODS treatment of attributes, or metadata.}  This incompatibility&lt;br /&gt;
can range from the seemingly simple, such as different data names, to&lt;br /&gt;
the far less tractable, such as incompatible time representations.&lt;br /&gt;
&lt;br /&gt;
To address this problem, the DODS project has created the data&lt;br /&gt;
attribute standard described in this chapter.  This standard is&lt;br /&gt;
&#039;&#039;entirely optional&#039;&#039; .  A server can still serve data from a DODS&lt;br /&gt;
dataset that does not conform to this standard, and a DODS client can&lt;br /&gt;
still read that data.  However, a dataset that conforms to this&lt;br /&gt;
standard will be more easily read and processed by another user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE:The DODS project has an original emphasis on oceanography.&lt;br /&gt;
Therefore, the DODS standard described here has been defined, where&lt;br /&gt;
possible, to be compatible with existing geo-spatial metadata&lt;br /&gt;
conventions, including the COARDS and the ISO Z39.50 GeoProfile&lt;br /&gt;
conventions.  It should be noted that the DODS standard is a small&lt;br /&gt;
subset of these metadata definitions, and may well be applicable to&lt;br /&gt;
data from other scientific (or other) disciplines.  In addition, the&lt;br /&gt;
architecture of the DODS software does not preclude the adoption of&lt;br /&gt;
alternate data standards that may be more appropriate to those other&lt;br /&gt;
fields.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a similar effort, attempting to assert some order over incompatible&lt;br /&gt;
data attributes among netCDF files, the COARDS project&lt;br /&gt;
[http://ferret.wrc.noaa.gov/noaa_coop/coop_cdf_profile.html&amp;lt;cite&amp;gt;&amp;quot;Cooperative Ocean/Atmosphere Research Data Service&amp;quot;&amp;lt;/cite&amp;gt;] has&lt;br /&gt;
specified some standard attributes that shall be defined in a dataset.&lt;br /&gt;
Note that this has little or nothing to do with netCDF itself.  You&lt;br /&gt;
can have a netCDF dataset that doesn&#039;t comply with the COARDS&lt;br /&gt;
standard.  But it will be more useful to others if it does.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the DODS architecture allows data attributes to be added to&lt;br /&gt;
any dataset &#039;&#039;without&#039;&#039;  modifying the data files themselves.&lt;br /&gt;
This makes the task of conforming to the data standard fairly simple,&lt;br /&gt;
in most cases consisting of adding a few files to a directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, this is not an exhaustive list of attributes possible.&lt;br /&gt;
Beyond syntax-checking, the DODS software does no parsing of attribute&lt;br /&gt;
structures for a dataset.  You are free to add whatever attributes you&lt;br /&gt;
choose to any dataset served by a DODS server.  If you want to add&lt;br /&gt;
enough data attributes to make your metadata 100\&lt;br /&gt;
ISO Z39.50 GeoProfile, there is no reason not to do so.\footnote{We&lt;br /&gt;
would suggest that if you do add GeoProfile attributes not mentioned&lt;br /&gt;
in this document to your dataset, you should use the SGML attribute&lt;br /&gt;
tags as attribute names.  In the event that future DODS servers&lt;br /&gt;
support a part of the GeoProfile protocol, this will allow your&lt;br /&gt;
datasets to be merged seamlessly with that standard.}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Essential and Optional Attributes==&lt;br /&gt;
&lt;br /&gt;
One of the motivating principles of the DODS project is to keep the&lt;br /&gt;
burden on the data provider as light as possible.  To further decrease&lt;br /&gt;
the burden of making data available, the DODS data standard attributes&lt;br /&gt;
are separated into two groups:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Those that are essential to minimal data attribute&lt;br /&gt;
interoperability, and&lt;br /&gt;
*Those that are very useful, but not essential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second group can be further split up among the more and less&lt;br /&gt;
useful attributes.&lt;br /&gt;
&lt;br /&gt;
The DODS project recognizes these as different &amp;quot;classes&amp;quot; of&lt;br /&gt;
compatibility.  For example, a class 0 DODS dataset is one that is&lt;br /&gt;
served by DODS, but does not comply with the DODS data standards,&lt;br /&gt;
except in the most minimal way.  A class 1 dataset conforms, but only&lt;br /&gt;
contains the essential attributes.  A class 2 datasets conforms and&lt;br /&gt;
contains the essential and the class 2 attributes, and so on.  The&lt;br /&gt;
attributes described in the following sections are identified by their&lt;br /&gt;
classes in this way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Global and Variable Attributes===&lt;br /&gt;
&lt;br /&gt;
DODS attributes consist of sets of name-value&lt;br /&gt;
pairs.\footnote{Actually, there is type information in there, too, so&lt;br /&gt;
&lt;br /&gt;
it&#039;s more accurate to say name-type-value triples, but &amp;quot;triples&amp;quot;&lt;br /&gt;
&lt;br /&gt;
is more awkward than &amp;quot;pair.&amp;quot;}  To say that a data variable has&lt;br /&gt;
attributes is the same as saying that there is a set of attributes (in&lt;br /&gt;
the dataset&#039;s DAS) with the same name as this variable.  The set can&lt;br /&gt;
contain one or more name-value pairs, such as &amp;quot;units&amp;quot; with&lt;br /&gt;
&amp;quot;degreesC&amp;quot; and &amp;quot;scale_factor&amp;quot; with &amp;quot;2.35&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Consider the dataset with a DDS like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Int16 temp[time = 16][lat = 17][lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 lat[lat = 17];&lt;br /&gt;
&lt;br /&gt;
Float32 lon[lon = 21];&lt;br /&gt;
&lt;br /&gt;
Float32 time[time = 16];&lt;br /&gt;
} test1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS for this DODS-compliant dataset might look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
temp {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Surface Temperature&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String missing_value &amp;quot;-32767&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String scale_factor &amp;quot;0.005&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Temp&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;degree East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
time {&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;hours from base_time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String short_name &amp;quot;Time&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String conventions &amp;quot;DODS&amp;quot;, &amp;quot;COARDS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One of the attribute containers in this DAS does not correspond to any&lt;br /&gt;
data variables.  The attributes in this container are said to be&lt;br /&gt;
&amp;quot;global&amp;quot; attributes, and modify the entire dataset.  There is&lt;br /&gt;
nothing special about the names; an attribute container can be called&lt;br /&gt;
anything at all.  However, the container called &amp;quot;DODS&amp;quot;, if it&lt;br /&gt;
exists, should contain the global attributes described in the DODS&lt;br /&gt;
data standard, such as &amp;lt;font color=&#039;green&#039;&amp;gt;conventions&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt;, and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Utterly Essential Attributes (Class 0)==&lt;br /&gt;
&lt;br /&gt;
The following attributes must appear in any DODS dataset for it to be&lt;br /&gt;
considered class 0 compliant.  These attributes must be defined for&lt;br /&gt;
&#039;&#039;each&#039;&#039;  data variable in the dataset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; : A long descriptive name (title). This could be&lt;br /&gt;
used for labelling plots, for example. If a variable has no&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;long_name&amp;lt;/font&amp;gt; attribute assigned, the variable name should be&lt;br /&gt;
used as a default.  This corresponds to the &amp;quot;Detailed Variable&amp;quot;&lt;br /&gt;
field of the GCMD variable naming hierarchy.&lt;br /&gt;
(\iso{Attribute_Label}{3507}{attrlabl})&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; : A character array that specifies the units used for&lt;br /&gt;
the variable&#039;s data. The units attribute should be formatted as per&lt;br /&gt;
the recommendations in the Unidata&lt;br /&gt;
[http://www.unidata.ucar.edu/packages/udunits/ &amp;lt;cite&amp;gt;udunits&amp;lt;/cite&amp;gt;]  package. (\iso{Attribute_Units_of_Measurement}{3522}{attrunit}).&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; : If present for a variable, the data are to&lt;br /&gt;
be multiplied by this factor after the data are read by the&lt;br /&gt;
application that accesses the data. One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the&lt;br /&gt;
specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; : If present for a variable, this number is to&lt;br /&gt;
be added to the data after it is read by the application that&lt;br /&gt;
accesses the data.  One or both of &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; or&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; must be present if the data are not stored in the&lt;br /&gt;
specified units, unless there is also a &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; specified.&lt;br /&gt;
If both &amp;lt;font color=&#039;green&#039;&amp;gt;scale_factor&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;add_offset&amp;lt;/font&amp;gt; attributes are&lt;br /&gt;
present, the data are first scaled before the offset is added.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;transform&amp;lt;/font&amp;gt; : This is a string containing a transformation&lt;br /&gt;
function used to convert the raw data into the units specifed in the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;units&amp;lt;/font&amp;gt; attribute.\footnote{The format of the function&lt;br /&gt;
specification (i.e. Java, Perl, Tcl, Lisp, whatever) is not&lt;br /&gt;
currently specified.}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some special cases, outlined in the next two sections.&lt;br /&gt;
However, if your dataset contains no null values, and no data stored&lt;br /&gt;
as DODS Arrays, the above list is complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;A DODS Array is a different data type than a Grid, and contains&lt;br /&gt;
less information about its independent variables.  For more&lt;br /&gt;
information, see below, or refer to the \DODSuser .&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Missing Data===&lt;br /&gt;
&lt;br /&gt;
If a dataset contains missing data flagged with special values, those&lt;br /&gt;
values must be specified in the attribute list of the variable.  That&lt;br /&gt;
is, if you have a data sequence called &amp;lt;font color=&#039;green&#039;&amp;gt;ralph&amp;lt;/font&amp;gt;, and it contains missing&lt;br /&gt;
values flagged with -999, the DAS for the dataset should have an&lt;br /&gt;
attribute container like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
ralph {&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DODS metadata standard provides three categories of missing data.&lt;br /&gt;
These attribute values are essential only in the sense that they must&lt;br /&gt;
be in the data variable&#039;s attribute container &#039;&#039;if you use them&#039;&#039; .&lt;br /&gt;
If your data doesn&#039;t use these values---that is, if there are no&lt;br /&gt;
missing values flagged with special numeric values--these attributes&lt;br /&gt;
need not be specified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;missing_value&amp;lt;/font&amp;gt; :  This is a conventional name for a&lt;br /&gt;
missing value that will not be treated in any special way by the&lt;br /&gt;
client application.  This attribute is part of the COARDS standard.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;null_value&amp;lt;/font&amp;gt; : A null value differs from a missing value in&lt;br /&gt;
that it describes data that isn&#039;t there, but shouldn&#039;t have been,&lt;br /&gt;
either.  That is, where a missing value might be used to fill in for&lt;br /&gt;
a sensor malfunction, a null value is used to indicate that no data&lt;br /&gt;
was taken.  A dataset that contained random data interpolated onto a&lt;br /&gt;
grid might use a null value on those grid points too distant from&lt;br /&gt;
data values to make an accurate estimate.\footnote{The COARDS&lt;br /&gt;
standard does not make this distinction, and would use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;missing_value&amp;lt;/font&amp;gt; for these points.}&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;default_value&amp;lt;/font&amp;gt; :  A default value is yet another sort of&lt;br /&gt;
missing data.  In this case, data would never have been at those&lt;br /&gt;
points.  Land points in gridded sea-surface temperature data would&lt;br /&gt;
be default values, as would the end of profile data vectors filled&lt;br /&gt;
to uniform length.  This differs some from the semantics of the&lt;br /&gt;
COARDS &amp;lt;font color=&#039;green&#039;&amp;gt;_FillValue&amp;lt;/font&amp;gt;, but perhaps not so far as to prevent the&lt;br /&gt;
DODS project from adopting the COARDS name as a synonym.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Array Data===&lt;br /&gt;
&lt;br /&gt;
A dataset containing only an array may be missing some important&lt;br /&gt;
information about the dataset&#039;s independent variables.  To make the&lt;br /&gt;
dataset conpliant with the Class 0 of the DODS standard, this&lt;br /&gt;
information must be included in the attribute list.&lt;br /&gt;
&lt;br /&gt;
The information missing from an Array variable is the location of that&lt;br /&gt;
array&#039;s corners---the &amp;lt;font color=&#039;green&#039;&amp;gt;min&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;max&amp;lt;/font&amp;gt; for each dimension---and&lt;br /&gt;
other information about the array dimensions.  The requirements,&lt;br /&gt;
therefore, are that an Array&#039;s dimensions be named, and that attribute&lt;br /&gt;
containers with those same names be contained in the dataset DAS.&lt;br /&gt;
That is, for a dataset with the following array data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
&lt;br /&gt;
Array {&lt;br /&gt;
&lt;br /&gt;
Byte dsp_band_1[lat = 1024][lon = 1024];&lt;br /&gt;
&lt;br /&gt;
} dsp_band_1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAS should look something like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Attributes {&lt;br /&gt;
&lt;br /&gt;
dsp_band_1 {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;AVHRR sea surface temperature data&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;DegreesC&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 scale_factor 0.15625;&lt;br /&gt;
&lt;br /&gt;
Float32 add_offset 5.0;&lt;br /&gt;
&lt;br /&gt;
Float32 missing_value -999.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lat {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Latitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees North&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min 0.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 70.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
lon {&lt;br /&gt;
&lt;br /&gt;
String long_name &amp;quot;Longitude&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
String units &amp;quot;Degrees East&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Float32 min -100.0;&lt;br /&gt;
&lt;br /&gt;
Float32 max 0.0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If using the name of the dimension would cause a name collision with&lt;br /&gt;
some other variable in the dataset, you can use the name of the&lt;br /&gt;
dimension prefixed by the name of the array.  That is, in the above&lt;br /&gt;
example, the attribute containers for the array dimensions would be&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lat&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;dsp_band_1.lon&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Less Essential, But Still Useful Attributes (Class 1)==&lt;br /&gt;
&lt;br /&gt;
The optional attributes are divided into two different classes.  This&lt;br /&gt;
again allows a data provider some latitude in the class of compliance&lt;br /&gt;
with the standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;short_name&amp;lt;/font&amp;gt; : This is the name of the variable, taken from&lt;br /&gt;
a list of DODS names (see \appref{std-names}).  Including this&lt;br /&gt;
attribute is a way to ensure that two datasets can be usefully&lt;br /&gt;
compared with one another on a variable-by-variable basis.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Convention&amp;lt;/font&amp;gt; : This global attribute is recommended to&lt;br /&gt;
identify the dataset as conforming to the DODS data standard,&lt;br /&gt;
identified here.  The attribute should be a string with the value&lt;br /&gt;
&amp;quot;DODS&amp;quot;.   Note that this is a global attribute, and should appear&lt;br /&gt;
in the &amp;quot;DODS&amp;quot; attribute container, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DODS {&lt;br /&gt;
&lt;br /&gt;
String Convention &amp;quot;DODS&amp;quot;; }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the presence of the &amp;quot;DODS&amp;quot; attribute container is itself&lt;br /&gt;
a clue to whether the dataset is DODS-compliant or not.&lt;br /&gt;
To be compliant with the&lt;br /&gt;
GeoProfile, one element in the Convention vector should read&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;FGDC Content Standards for Digital Geospatial Metadata&amp;lt;/font&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Very Useful Attributes, But Not Essential (Class 2)==&lt;br /&gt;
&lt;br /&gt;
This is a set of attributes that has been found to be quite useful in&lt;br /&gt;
the use of DODS datasets.  A dataset can be considered to be class 2&lt;br /&gt;
compliant if it contains more than one of these attributes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Acknowledge&amp;lt;/font&amp;gt; : This string should contain an acknowledgement&lt;br /&gt;
paragraph that can appear in papers that use the data from this&lt;br /&gt;
dataset.  For example: &amp;quot;The principal investigators in the&lt;br /&gt;
production of these data are J.D. Elms, S.D. Woodruff, and&lt;br /&gt;
S. Worley (http://www.cdc.noaa.gov/coads/participants.html).&amp;quot; and&lt;br /&gt;
so on.  This is a global attribute, and should appear in the&lt;br /&gt;
&amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; : The &amp;lt;font color=&#039;green&#039;&amp;gt;history&amp;lt;/font&amp;gt; attribute is recommended to&lt;br /&gt;
record the evolution of the data contained within a DODS data file.&lt;br /&gt;
Applications which process this data can append their information to&lt;br /&gt;
this attribute.  This is a global attribute, and should appear in&lt;br /&gt;
the &amp;quot;DODS&amp;quot; attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Data_Use_Policy&amp;lt;/font&amp;gt; : If there are any restrictions on the use&lt;br /&gt;
of the data, they should be noted in the string with this name.&lt;br /&gt;
This is a global attribute, and should appear in the &amp;quot;DODS&amp;quot;&lt;br /&gt;
attribute container.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;Theme&amp;lt;/font&amp;gt; : A string containing one or more of the GCMD parameter&lt;br /&gt;
valid names. See \xlink{the &amp;quot;GCMD Parameters&amp;quot; list maintained at GCMD.}  {http://gcmd.gsfc.nasa.gov/cgi-bin/md/valids_display.pl}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/intro&amp;diff=2052</id>
		<title>Wiki Testing/intro</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/intro&amp;diff=2052"/>
		<updated>2008-02-07T10:17:15Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Server Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=DODS and Data Standards=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once upon a time there was DODS.  And it was good.  DODS solved many&lt;br /&gt;
problems of dataset incompatibility by making remote datasets pretend&lt;br /&gt;
to be in a format they were not in.  This was tricky, and it was&lt;br /&gt;
largely accomplished by hiding from the user the actual data storage&lt;br /&gt;
format, and using many different converters to provide data in a&lt;br /&gt;
standard transmission format.&lt;br /&gt;
&lt;br /&gt;
However, data storage format isn&#039;t everything.  Though the DODS&lt;br /&gt;
solution is quite a useful one, it has its limitations.  Two datasets&lt;br /&gt;
can be incompatible even though they share an identical data storage&lt;br /&gt;
format.  For example, consider two sea surface temperature datasets&lt;br /&gt;
stored in netCDF format files.  One can store its temperature in&lt;br /&gt;
degrees Celsius, and another can store temperature as raw data, in&lt;br /&gt;
unscaled satellite counts, that have to be converted into temperature&lt;br /&gt;
values meaningful to a human.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Levels of Compatibility==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In discussions about whether two different datasets are compatible, we&lt;br /&gt;
must distinguish between different levels of compatibility.  What&lt;br /&gt;
level is important depends to some extent on how you intend to use the&lt;br /&gt;
data.  To a human, for example, two datasets could be considered&lt;br /&gt;
compatible if they are about the same data variable.  Two temperature&lt;br /&gt;
datasets that cover the same area might be considered quite compatible,&lt;br /&gt;
if all one is doing is looking at two different color contour maps&lt;br /&gt;
lying on a table, or side-by-side on a computer screen.&lt;br /&gt;
&lt;br /&gt;
However if one is seeking datasets on which to execute various&lt;br /&gt;
analyses and computations, a higher level of compatibility is&lt;br /&gt;
required.&lt;br /&gt;
&lt;br /&gt;
The issues of data compatibility can be separated into four&lt;br /&gt;
categories:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Data storage format&lt;br /&gt;
*Data attributes&lt;br /&gt;
*Data organization&lt;br /&gt;
*Server interface&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Data Storage Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two datasets whose data are stored and retrieved with different data&lt;br /&gt;
format software are incompatible.  A dataset stored with netCDF&lt;br /&gt;
software cannot be read by a program to read HDF files, and vice&lt;br /&gt;
versa.&lt;br /&gt;
&lt;br /&gt;
Data storage format was the first compatibility issue&lt;br /&gt;
that DODS addressed, and it does so fairly successfully.  Whatever&lt;br /&gt;
storage format data are kept in, the DODS server translates them into&lt;br /&gt;
a standard transmission format before sending them to the DODS client&lt;br /&gt;
requesting that data.  This translation happens file by file, however,&lt;br /&gt;
so datasets that span multiple files may remain somewhat problematic,&lt;br /&gt;
even though the file format itself is not an issue.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Data Attributes===&lt;br /&gt;
&lt;br /&gt;
Having solved the problem of data storage compatibility, DODS was&lt;br /&gt;
faced with the problem of incompatible data attributes.  That is,&lt;br /&gt;
considering our two temperature datasets, one dataset could refer to&lt;br /&gt;
its temperature data in an array called &amp;quot;T&amp;quot;, while another could&lt;br /&gt;
refer to an array called &amp;quot;Temp&amp;quot;.  To a human comparing the two&lt;br /&gt;
files, the equation between the two might be obvious, but to a&lt;br /&gt;
computer it might not.  (Even to a human, the facts might not be as&lt;br /&gt;
obvious as they seem.  For example, &amp;quot;T&amp;quot; could also refer to&lt;br /&gt;
&amp;quot;Time&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Other data attributes that are important to be able to compute with a&lt;br /&gt;
set of data include flags for missing data and unit and unit&lt;br /&gt;
conversion information.  The data standard outlined in&lt;br /&gt;
([http://docs.opendap.org/index.php/Wiki_Testing/DataStandard&amp;lt;cite&amp;gt; dods-standard&amp;lt;/cite&amp;gt;]) of this document is an attempt to address this issue.&lt;br /&gt;
&lt;br /&gt;
===Data Organization===&lt;br /&gt;
&lt;br /&gt;
The organization of a dataset can create another impediment to&lt;br /&gt;
compatibility.  Consider, for example, two datasets containing&lt;br /&gt;
salinity measurements of the ocean at various different depths, and at&lt;br /&gt;
different times.  Assuming that there is some reason not to put all&lt;br /&gt;
the information in a single file, each dataset must be divided among&lt;br /&gt;
several files, and this is where certain incompatibilitles can sneak&lt;br /&gt;
in.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One dataset could store its data in several files, each of which&lt;br /&gt;
contains a three-dimensional array---corresponding to latitude,&lt;br /&gt;
longitude, and depth---of salinity values, corresponding to a&lt;br /&gt;
particular time.  But a similar dataset might be arranged as arrays of&lt;br /&gt;
latitude, longitude, and time, with several different files&lt;br /&gt;
corrsponding to different depths.  Both arrangements are, in fact,&lt;br /&gt;
common among on-line datasets.&lt;br /&gt;
&lt;br /&gt;
The DODS Catalog Server, under development, is intended&lt;br /&gt;
to address the issue of data organization within a dataset, allowing a&lt;br /&gt;
user to query differently organized datasets with the same syntax&lt;br /&gt;
query.&lt;br /&gt;
&lt;br /&gt;
===Server Interface===&lt;br /&gt;
&lt;br /&gt;
The DODS software does create solutions to the compatibility issues&lt;br /&gt;
outlined above.  However, in doing so, it introduces a fourth&lt;br /&gt;
compatibility issue, which is that of the server interface itself.  A&lt;br /&gt;
DODS server is programmed to respond to a set of server commands&lt;br /&gt;
issued by a DODS client.  These commands come in the form of URLs sent&lt;br /&gt;
to the server.&lt;br /&gt;
&lt;br /&gt;
Because the DODS project is a widely distributed project, and because&lt;br /&gt;
the datasets available through DODS are---by design---not under&lt;br /&gt;
central control, it is not always certain that two given DODS servers&lt;br /&gt;
will be running software from the same software release.  Similarly,&lt;br /&gt;
since there are provisions for making local modifications to server&lt;br /&gt;
behavior, it is also not certain that server functions available on&lt;br /&gt;
one server are available on another, even when they are both running&lt;br /&gt;
at the same software release.&lt;br /&gt;
&lt;br /&gt;
Addressing these issues is an ongoing preoccupation of the DODS&lt;br /&gt;
project and its (growing) user base.  The DODS servers also contain&lt;br /&gt;
provisions for making this information available to clients. See&lt;br /&gt;
[http://docs.opendap.org/index.php/Wiki_Testing/OpeNDAP_User%27s_Guide&amp;lt;cite&amp;gt;OPeNDAP User Guide&amp;lt;/cite&amp;gt;] for more information.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/intro&amp;diff=2051</id>
		<title>Wiki Testing/intro</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/intro&amp;diff=2051"/>
		<updated>2008-02-07T10:16:31Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Data Organization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=DODS and Data Standards=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once upon a time there was DODS.  And it was good.  DODS solved many&lt;br /&gt;
problems of dataset incompatibility by making remote datasets pretend&lt;br /&gt;
to be in a format they were not in.  This was tricky, and it was&lt;br /&gt;
largely accomplished by hiding from the user the actual data storage&lt;br /&gt;
format, and using many different converters to provide data in a&lt;br /&gt;
standard transmission format.&lt;br /&gt;
&lt;br /&gt;
However, data storage format isn&#039;t everything.  Though the DODS&lt;br /&gt;
solution is quite a useful one, it has its limitations.  Two datasets&lt;br /&gt;
can be incompatible even though they share an identical data storage&lt;br /&gt;
format.  For example, consider two sea surface temperature datasets&lt;br /&gt;
stored in netCDF format files.  One can store its temperature in&lt;br /&gt;
degrees Celsius, and another can store temperature as raw data, in&lt;br /&gt;
unscaled satellite counts, that have to be converted into temperature&lt;br /&gt;
values meaningful to a human.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Levels of Compatibility==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In discussions about whether two different datasets are compatible, we&lt;br /&gt;
must distinguish between different levels of compatibility.  What&lt;br /&gt;
level is important depends to some extent on how you intend to use the&lt;br /&gt;
data.  To a human, for example, two datasets could be considered&lt;br /&gt;
compatible if they are about the same data variable.  Two temperature&lt;br /&gt;
datasets that cover the same area might be considered quite compatible,&lt;br /&gt;
if all one is doing is looking at two different color contour maps&lt;br /&gt;
lying on a table, or side-by-side on a computer screen.&lt;br /&gt;
&lt;br /&gt;
However if one is seeking datasets on which to execute various&lt;br /&gt;
analyses and computations, a higher level of compatibility is&lt;br /&gt;
required.&lt;br /&gt;
&lt;br /&gt;
The issues of data compatibility can be separated into four&lt;br /&gt;
categories:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Data storage format&lt;br /&gt;
*Data attributes&lt;br /&gt;
*Data organization&lt;br /&gt;
*Server interface&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Data Storage Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two datasets whose data are stored and retrieved with different data&lt;br /&gt;
format software are incompatible.  A dataset stored with netCDF&lt;br /&gt;
software cannot be read by a program to read HDF files, and vice&lt;br /&gt;
versa.&lt;br /&gt;
&lt;br /&gt;
Data storage format was the first compatibility issue&lt;br /&gt;
that DODS addressed, and it does so fairly successfully.  Whatever&lt;br /&gt;
storage format data are kept in, the DODS server translates them into&lt;br /&gt;
a standard transmission format before sending them to the DODS client&lt;br /&gt;
requesting that data.  This translation happens file by file, however,&lt;br /&gt;
so datasets that span multiple files may remain somewhat problematic,&lt;br /&gt;
even though the file format itself is not an issue.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Data Attributes===&lt;br /&gt;
&lt;br /&gt;
Having solved the problem of data storage compatibility, DODS was&lt;br /&gt;
faced with the problem of incompatible data attributes.  That is,&lt;br /&gt;
considering our two temperature datasets, one dataset could refer to&lt;br /&gt;
its temperature data in an array called &amp;quot;T&amp;quot;, while another could&lt;br /&gt;
refer to an array called &amp;quot;Temp&amp;quot;.  To a human comparing the two&lt;br /&gt;
files, the equation between the two might be obvious, but to a&lt;br /&gt;
computer it might not.  (Even to a human, the facts might not be as&lt;br /&gt;
obvious as they seem.  For example, &amp;quot;T&amp;quot; could also refer to&lt;br /&gt;
&amp;quot;Time&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Other data attributes that are important to be able to compute with a&lt;br /&gt;
set of data include flags for missing data and unit and unit&lt;br /&gt;
conversion information.  The data standard outlined in&lt;br /&gt;
([http://docs.opendap.org/index.php/Wiki_Testing/DataStandard&amp;lt;cite&amp;gt; dods-standard&amp;lt;/cite&amp;gt;]) of this document is an attempt to address this issue.&lt;br /&gt;
&lt;br /&gt;
===Data Organization===&lt;br /&gt;
&lt;br /&gt;
The organization of a dataset can create another impediment to&lt;br /&gt;
compatibility.  Consider, for example, two datasets containing&lt;br /&gt;
salinity measurements of the ocean at various different depths, and at&lt;br /&gt;
different times.  Assuming that there is some reason not to put all&lt;br /&gt;
the information in a single file, each dataset must be divided among&lt;br /&gt;
several files, and this is where certain incompatibilitles can sneak&lt;br /&gt;
in.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One dataset could store its data in several files, each of which&lt;br /&gt;
contains a three-dimensional array---corresponding to latitude,&lt;br /&gt;
longitude, and depth---of salinity values, corresponding to a&lt;br /&gt;
particular time.  But a similar dataset might be arranged as arrays of&lt;br /&gt;
latitude, longitude, and time, with several different files&lt;br /&gt;
corrsponding to different depths.  Both arrangements are, in fact,&lt;br /&gt;
common among on-line datasets.&lt;br /&gt;
&lt;br /&gt;
The DODS Catalog Server, under development, is intended&lt;br /&gt;
to address the issue of data organization within a dataset, allowing a&lt;br /&gt;
user to query differently organized datasets with the same syntax&lt;br /&gt;
query.&lt;br /&gt;
&lt;br /&gt;
===Server Interface===&lt;br /&gt;
&lt;br /&gt;
The DODS software does create solutions to the compatibility issues&lt;br /&gt;
outlined above.  However, in doing so, it introduces a fourth&lt;br /&gt;
compatibility issue, which is that of the server interface itself.  A&lt;br /&gt;
DODS server is programmed to respond to a set of server commands&lt;br /&gt;
issued by a DODS client.  These commands come in the form of URLs sent&lt;br /&gt;
to the server.&lt;br /&gt;
&lt;br /&gt;
Because the DODS project is a widely distributed project, and because&lt;br /&gt;
the datasets available through DODS are---by design---not under&lt;br /&gt;
central control, it is not always certain that two given DODS servers&lt;br /&gt;
will be running software from the same software release.  Similarly,&lt;br /&gt;
since there are provisions for making local modifications to server&lt;br /&gt;
behavior, it is also not certain that server functions available on&lt;br /&gt;
one server are available on another, even when they are both running&lt;br /&gt;
at the same software release.&lt;br /&gt;
&lt;br /&gt;
Addressing these issues is an ongoing preoccupation of the DODS&lt;br /&gt;
project and its (growing) user base.  The DODS servers also contain&lt;br /&gt;
provisions for making this information available to clients. See&lt;br /&gt;
\DODSuser for more information.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/intro&amp;diff=2050</id>
		<title>Wiki Testing/intro</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/intro&amp;diff=2050"/>
		<updated>2008-02-07T10:16:10Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Data Attributes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=DODS and Data Standards=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once upon a time there was DODS.  And it was good.  DODS solved many&lt;br /&gt;
problems of dataset incompatibility by making remote datasets pretend&lt;br /&gt;
to be in a format they were not in.  This was tricky, and it was&lt;br /&gt;
largely accomplished by hiding from the user the actual data storage&lt;br /&gt;
format, and using many different converters to provide data in a&lt;br /&gt;
standard transmission format.&lt;br /&gt;
&lt;br /&gt;
However, data storage format isn&#039;t everything.  Though the DODS&lt;br /&gt;
solution is quite a useful one, it has its limitations.  Two datasets&lt;br /&gt;
can be incompatible even though they share an identical data storage&lt;br /&gt;
format.  For example, consider two sea surface temperature datasets&lt;br /&gt;
stored in netCDF format files.  One can store its temperature in&lt;br /&gt;
degrees Celsius, and another can store temperature as raw data, in&lt;br /&gt;
unscaled satellite counts, that have to be converted into temperature&lt;br /&gt;
values meaningful to a human.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Levels of Compatibility==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In discussions about whether two different datasets are compatible, we&lt;br /&gt;
must distinguish between different levels of compatibility.  What&lt;br /&gt;
level is important depends to some extent on how you intend to use the&lt;br /&gt;
data.  To a human, for example, two datasets could be considered&lt;br /&gt;
compatible if they are about the same data variable.  Two temperature&lt;br /&gt;
datasets that cover the same area might be considered quite compatible,&lt;br /&gt;
if all one is doing is looking at two different color contour maps&lt;br /&gt;
lying on a table, or side-by-side on a computer screen.&lt;br /&gt;
&lt;br /&gt;
However if one is seeking datasets on which to execute various&lt;br /&gt;
analyses and computations, a higher level of compatibility is&lt;br /&gt;
required.&lt;br /&gt;
&lt;br /&gt;
The issues of data compatibility can be separated into four&lt;br /&gt;
categories:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Data storage format&lt;br /&gt;
*Data attributes&lt;br /&gt;
*Data organization&lt;br /&gt;
*Server interface&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Data Storage Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two datasets whose data are stored and retrieved with different data&lt;br /&gt;
format software are incompatible.  A dataset stored with netCDF&lt;br /&gt;
software cannot be read by a program to read HDF files, and vice&lt;br /&gt;
versa.&lt;br /&gt;
&lt;br /&gt;
Data storage format was the first compatibility issue&lt;br /&gt;
that DODS addressed, and it does so fairly successfully.  Whatever&lt;br /&gt;
storage format data are kept in, the DODS server translates them into&lt;br /&gt;
a standard transmission format before sending them to the DODS client&lt;br /&gt;
requesting that data.  This translation happens file by file, however,&lt;br /&gt;
so datasets that span multiple files may remain somewhat problematic,&lt;br /&gt;
even though the file format itself is not an issue.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Data Attributes===&lt;br /&gt;
&lt;br /&gt;
Having solved the problem of data storage compatibility, DODS was&lt;br /&gt;
faced with the problem of incompatible data attributes.  That is,&lt;br /&gt;
considering our two temperature datasets, one dataset could refer to&lt;br /&gt;
its temperature data in an array called &amp;quot;T&amp;quot;, while another could&lt;br /&gt;
refer to an array called &amp;quot;Temp&amp;quot;.  To a human comparing the two&lt;br /&gt;
files, the equation between the two might be obvious, but to a&lt;br /&gt;
computer it might not.  (Even to a human, the facts might not be as&lt;br /&gt;
obvious as they seem.  For example, &amp;quot;T&amp;quot; could also refer to&lt;br /&gt;
&amp;quot;Time&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Other data attributes that are important to be able to compute with a&lt;br /&gt;
set of data include flags for missing data and unit and unit&lt;br /&gt;
conversion information.  The data standard outlined in&lt;br /&gt;
([http://docs.opendap.org/index.php/Wiki_Testing/DataStandard&amp;lt;cite&amp;gt; dods-standard&amp;lt;/cite&amp;gt;]) of this document is an attempt to address this issue.&lt;br /&gt;
&lt;br /&gt;
===Data Organization===&lt;br /&gt;
&lt;br /&gt;
The organization of a dataset can create another impediment to&lt;br /&gt;
compatibility.  Consider, for example, two datasets containing&lt;br /&gt;
salinity measurements of the ocean at various different depths, and at&lt;br /&gt;
different times.  Assuming that there is some reason not to put all&lt;br /&gt;
the information in a single file, each dataset must be divided among&lt;br /&gt;
several files, and this is where certain incompatibilitles can sneak&lt;br /&gt;
in.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One dataset could store its data in several files, each of which&lt;br /&gt;
contains a three-dimensional array---corresponding to latitude,&lt;br /&gt;
longitude, and depth---of salinity values, corresponding to a&lt;br /&gt;
particular time.  But a similar dataset might be arranged as arrays of&lt;br /&gt;
latitude, longitude, and time, with several different files&lt;br /&gt;
corrsponding to different depths.  Both arrangements are, in fact,&lt;br /&gt;
common among on-line datasets.&lt;br /&gt;
&lt;br /&gt;
The DODS Catalog Server, under development (as of \today), is intended&lt;br /&gt;
to address the issue of data organization within a dataset, allowing a&lt;br /&gt;
user to query differently organized datasets with the same syntax&lt;br /&gt;
query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Server Interface===&lt;br /&gt;
&lt;br /&gt;
The DODS software does create solutions to the compatibility issues&lt;br /&gt;
outlined above.  However, in doing so, it introduces a fourth&lt;br /&gt;
compatibility issue, which is that of the server interface itself.  A&lt;br /&gt;
DODS server is programmed to respond to a set of server commands&lt;br /&gt;
issued by a DODS client.  These commands come in the form of URLs sent&lt;br /&gt;
to the server.&lt;br /&gt;
&lt;br /&gt;
Because the DODS project is a widely distributed project, and because&lt;br /&gt;
the datasets available through DODS are---by design---not under&lt;br /&gt;
central control, it is not always certain that two given DODS servers&lt;br /&gt;
will be running software from the same software release.  Similarly,&lt;br /&gt;
since there are provisions for making local modifications to server&lt;br /&gt;
behavior, it is also not certain that server functions available on&lt;br /&gt;
one server are available on another, even when they are both running&lt;br /&gt;
at the same software release.&lt;br /&gt;
&lt;br /&gt;
Addressing these issues is an ongoing preoccupation of the DODS&lt;br /&gt;
project and its (growing) user base.  The DODS servers also contain&lt;br /&gt;
provisions for making this information available to clients. See&lt;br /&gt;
\DODSuser for more information.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=The_FreeForm_Data_Handler&amp;diff=2047</id>
		<title>The FreeForm Data Handler</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=The_FreeForm_Data_Handler&amp;diff=2047"/>
		<updated>2008-02-07T09:55:43Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Tasks Illustrated in this Guide */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Preface=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This document describes the OPeNDAP FreeForm ND Data Handler, which&lt;br /&gt;
can be used with the OPeNDAP data server.  It is not a&lt;br /&gt;
complete description of the FreeForm ND software.  For that, please refer&lt;br /&gt;
to the ND manual.&lt;br /&gt;
&lt;br /&gt;
This document contains much material originally written at the&lt;br /&gt;
National Oceanic and Atmospheric Administration&#039;s National&lt;br /&gt;
Environmental Satellite, Data, and Information Service, which is part&lt;br /&gt;
of the National Geophysical Data Center in Boulder, Colorado.&lt;br /&gt;
&lt;br /&gt;
This document has been updated to include information on FreeForm ND,&lt;br /&gt;
the last release of FreeForm. FreeForm is now supported only for use&lt;br /&gt;
with the Distributed Oceanographic Data System; see the&lt;br /&gt;
[http://www.opendap.org/&amp;lt;cite&amp;gt;OPeNDAP&amp;lt;/cite&amp;gt;] for more information.&lt;br /&gt;
&lt;br /&gt;
We are interested in your comments about the OPeNDAP software, and the&lt;br /&gt;
FreeForm ND software and this document.  Send them to:&lt;br /&gt;
[mailto:support@opendap.org&amp;lt;cite&amp;gt;support@opendap.org&amp;lt;/cite&amp;gt;].&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Using FreeForm ND with OPeNDAP, a researcher can easily make his or her data&lt;br /&gt;
available to the wider community of OPeNDAP users without having to&lt;br /&gt;
convert that data into another data file format.  This document&lt;br /&gt;
presents the FreeForm ND software, and shows how to use it with the OPeNDAP server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tasks Illustrated in this Guide==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For a quick start to getting, installing, and using the FreeForm ND&lt;br /&gt;
software, see the list below of tasks described in this document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Quick start. ([http://docs.opendap.org/index.php/Wiki_Testing/dquick&amp;lt;cite&amp;gt;here&amp;lt;/cite&amp;gt;])&lt;br /&gt;
*Getting and installing the FreeForm ND software.  ([http://docs.opendap.org/index.php/Wiki_Testing/dintro#Installing_the_OPeNDAP_FreeForm_ND_Data_Handler&amp;lt;cite&amp;gt;here&amp;lt;/cite&amp;gt;])&lt;br /&gt;
*Serving tabular data. ([http://docs.opendap.org/index.php/Wiki_Testing/tblfmt&amp;lt;cite&amp;gt;here&amp;lt;/cite&amp;gt;])&lt;br /&gt;
*Array tabular data. ([http://docs.opendap.org/index.php/Wiki_Testing/arrayfmt&amp;lt;cite&amp;gt;here&amp;lt;/cite&amp;gt;])&lt;br /&gt;
*Dealing with data file headers ([http://docs.opendap.org/index.php/Wiki_Testing/hdrfmts&amp;lt;cite&amp;gt;here&amp;lt;/cite&amp;gt;])&lt;br /&gt;
*Setup of File servers ([http://docs.opendap.org/index.php/Wiki_Testing/fileserv&amp;lt;cite&amp;gt;here&amp;lt;/cite&amp;gt;])&lt;br /&gt;
&lt;br /&gt;
==Who is this Guide for?==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This guide is for people who wish to use FreeForm ND to serve scientific&lt;br /&gt;
datasets using the OPeNDAP software.  Scientists who wish to share their&lt;br /&gt;
data with colleagues may also find this a useful system, since it is a&lt;br /&gt;
relatively simple matter to set up a server that can allow remote&lt;br /&gt;
access to your data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This documentation assumes that the readers are familiar with&lt;br /&gt;
computers and the internet, but are not necessarily programmers. More&lt;br /&gt;
than a passing familiarity with different data file formats will be&lt;br /&gt;
useful, as will an understanding of elementary internet concepts, such&lt;br /&gt;
as URLs and http.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This manual also assumes some familiarity with the OPeNDAP software.  If&lt;br /&gt;
you are starting from scratch, knowing nothing at all about OPeNDAP, we&lt;br /&gt;
strongly encourage you to browse the [http://docs.opendap.org/index.php/Wiki_Testing/OpeNDAP_User%27s_Guide&amp;lt;cite&amp;gt;The OPeNDAP User Guide&amp;lt;/cite&amp;gt;] before reading too far&lt;br /&gt;
here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Organization of this Document==&lt;br /&gt;
&lt;br /&gt;
This book contains both introductory and reference material. There is&lt;br /&gt;
also a description of the installation procedure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; [[Wiki_Testing/dintro | Chapter 1]] : contains an overview of the OPeNDAP FreeForm ND Data Handler software, including how to get it and install it.&lt;br /&gt;
&lt;br /&gt;
; [[Wiki_Testing/dquick | Chapter 2]] : provides a brief introduction to writing format descriptions and using the OPeNDAP FreeForm ND Data Handler.&lt;br /&gt;
&lt;br /&gt;
; [[Wiki_Testing/tblfmt | Chapter 3]] :provides detailed information about writing format descriptions to facilitate access to data in tabular formats.&lt;br /&gt;
&lt;br /&gt;
; [[Wiki_Testing/arrayfmt | Chapter 4]] : provides detailed information about writing format descriptions to facilitate access to data in non-tabular (array) formats.&lt;br /&gt;
&lt;br /&gt;
; [[Wiki_Testing/hdrfmts | Chapter 5]] : tells you how to work with header formats.&lt;br /&gt;
&lt;br /&gt;
; [[Wiki_Testing/ff-server | Chapter 6]] : describes the operation of the OPeNDAP FreeForm ND Data Handler, with tips for writing format files.&lt;br /&gt;
&lt;br /&gt;
; [[Wiki_Testing/fileserv | Chapter 7]] : describes the OPeNDAP file server.&lt;br /&gt;
&lt;br /&gt;
; [[Wiki_Testing/convs | Chapter 8]] : presents FreeForm ND file name conventions, the search rules for locating format files, and standard command line arguments for FreeForm ND programs.&lt;br /&gt;
&lt;br /&gt;
; [[Wiki_Testing/fmtconv | Chapter 9]] : shows you how to use the FreeForm ND program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert data from one format to another and also how to read the data in a binary file.&lt;br /&gt;
&lt;br /&gt;
; [[Wiki_Testing/datachk | Chapter 10]] : discusses the FreeForm ND program &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;, which you can use to check data distribution and quality.&lt;br /&gt;
&lt;br /&gt;
;[[Wiki_Testing/hdfutils | Appnedix A]] : provides explanations for a small selection of tools that will be useful for programmers working with the HDF file format.&lt;br /&gt;
&lt;br /&gt;
; [[Wiki_Testing/errors | Appendix B]] : presents a list of common FreeForm ND error messages.  These are the error messages that may be issued by the FreeForm ND utilities, such as &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, not the OPeNDAP FreeForm ND Data Handler.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A position box is often used in this book to indicate column position&lt;br /&gt;
of field values in data files. It is shown at the beginning of a data&lt;br /&gt;
list in the documentation, but does not appear in the data file&lt;br /&gt;
itself.  It looks something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1         2         3         4         5         6&lt;br /&gt;
012345678901234567890123456789012345678901234567890&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/errors&amp;diff=2045</id>
		<title>Wiki Testing/errors</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/errors&amp;diff=2045"/>
		<updated>2008-02-06T17:33:16Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Error Messages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Error Handling=&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND error handling system captures errors, such as improper usage, code problems, and system errors, and places them in an error queue. For each error captured, error type and a short message are placed in the message queue. If a fatal error occurs, the program stops executing and displays all error messages in the queue.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Error Messages==&lt;br /&gt;
&lt;br /&gt;
The following is a list of some possible error messages with suggestions for corrections.&lt;br /&gt;
&lt;br /&gt;
; Problem opening, reading, or writing to file : Check that all file names and paths are correct. &lt;br /&gt;
; Problem making format :  Make sure there is a format file describing the data file formats. Check that input and output format descriptions in the format file accurately describe the data. &lt;br /&gt;
; Problem making header format : If a header exists in the data file, it must be described in a format file. Check that the header description accurately describes the header in your data file. &lt;br /&gt;
; Problem getting value :&lt;br /&gt;
; Problem processing variable list :  The data formats may not be described correctly or there may be some inconsistencies in the data. Check also for unprintable characters at the end of the data file. &lt;br /&gt;
; File length / Record length mismatch :&lt;br /&gt;
; Record Length or CR Problem :  This usually happens because the input format description is not correct. Make sure the format description&#039;s last position is the last character before the end-of-line character. If you have a header, make sure it is described correctly. The header&#039;s length must include all characters up until the last end-of-line-character before the data begins. &lt;br /&gt;
; Binary Overflow : Try using a larger output variable type such as a long instead of a short. Be sure you have given enough space for the values to be written. See Chapter  for more information. &lt;br /&gt;
; Variable not found : The variable names in your output format must match the variable names in the input format unless you are using conversion variables. &lt;br /&gt;
; Data Overflow :     Data overflow does not usually cause a fatal error and FreeForm ND functions try to anticipate them. If overflow occurs for a particular value, ***&#039;s are written to that value&#039;s location. If you find these in your output, check your variable positions and precision. Increase field width or use a &amp;quot;larger&amp;quot; data type. Be sure the output format specifies space for the output variable. For instance, FreeForm ND adds a leading zero in front of decimal points. If the original data did not have a leading zero, the output will have one more digit than the input. &lt;br /&gt;
; Insufficient memory allocation :  The application has run out of memory. Try using the -b (local buffer size) option, or modify autoexec.bat and config.sys and comment out devices, TSR&#039;s, etc.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/errors&amp;diff=2044</id>
		<title>Wiki Testing/errors</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/errors&amp;diff=2044"/>
		<updated>2008-02-06T17:32:36Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Error Messages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Error Handling=&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND error handling system captures errors, such as improper usage, code problems, and system errors, and places them in an error queue. For each error captured, error type and a short message are placed in the message queue. If a fatal error occurs, the program stops executing and displays all error messages in the queue.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Error Messages==&lt;br /&gt;
&lt;br /&gt;
The following is a list of some possible error messages with suggestions for corrections.&lt;br /&gt;
&lt;br /&gt;
; Problem opening, reading, or writing to file :&lt;br /&gt;
    Check that all file names and paths are correct. &lt;br /&gt;
; Problem making format :&lt;br /&gt;
    Make sure there is a format file describing the data file formats. Check that input and output format descriptions in the format file accurately describe the data. &lt;br /&gt;
; Problem making header format :&lt;br /&gt;
    If a header exists in the data file, it must be described in a format file. Check that the header description accurately describes the header in your data file. &lt;br /&gt;
; Problem getting value :&lt;br /&gt;
; Problem processing variable list :&lt;br /&gt;
    The data formats may not be described correctly or there may be some inconsistencies in the data. Check also for unprintable characters at the end of the data file. &lt;br /&gt;
; File length / Record length mismatch :&lt;br /&gt;
; Record Length or CR Problem :&lt;br /&gt;
    This usually happens because the input format description is not correct. Make sure the format description&#039;s last position is the last character before the end-of-line character. If you have a header, make sure it is described correctly. The header&#039;s length must include all characters up until the last end-of-line-character before the data begins. &lt;br /&gt;
; Binary Overflow :&lt;br /&gt;
    Try using a larger output variable type such as a long instead of a short. Be sure you have given enough space for the values to be written. See Chapter  for more information. &lt;br /&gt;
; Variable not found :&lt;br /&gt;
    The variable names in your output format must match the variable names in the input format unless you are using conversion variables. &lt;br /&gt;
; Data Overflow :     Data overflow does not usually cause a fatal error and FreeForm ND functions try to anticipate them. If overflow occurs for a particular value, ***&#039;s are written to that value&#039;s location. If you find these in your output, check your variable positions and precision. Increase field width or use a &amp;quot;larger&amp;quot; data type. Be sure the output format specifies space for the output variable. For instance, FreeForm ND adds a leading zero in front of decimal points. If the original data did not have a leading zero, the output will have one more digit than the input. &lt;br /&gt;
; Insufficient memory allocation :&lt;br /&gt;
    The application has run out of memory. Try using the -b (local buffer size) option, or modify autoexec.bat and config.sys and comment out devices, TSR&#039;s, etc.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/errors&amp;diff=2043</id>
		<title>Wiki Testing/errors</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/errors&amp;diff=2043"/>
		<updated>2008-02-06T17:32:15Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Error Messages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Error Handling=&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND error handling system captures errors, such as improper usage, code problems, and system errors, and places them in an error queue. For each error captured, error type and a short message are placed in the message queue. If a fatal error occurs, the program stops executing and displays all error messages in the queue.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Error Messages==&lt;br /&gt;
&lt;br /&gt;
The following is a list of some possible error messages with suggestions for corrections.&lt;br /&gt;
&lt;br /&gt;
; Problem opening, reading, or writing to file :&lt;br /&gt;
    Check that all file names and paths are correct. &lt;br /&gt;
; Problem making format :&lt;br /&gt;
    Make sure there is a format file describing the data file formats. Check that input and output format descriptions in the format file accurately describe the data. &lt;br /&gt;
; Problem making header format :&lt;br /&gt;
    If a header exists in the data file, it must be described in a format file. Check that the header description accurately describes the header in your data file. &lt;br /&gt;
; Problem getting value :&lt;br /&gt;
; Problem processing variable list :&lt;br /&gt;
    The data formats may not be described correctly or there may be some inconsistencies in the data. Check also for unprintable characters at the end of the data file. &lt;br /&gt;
; File length / Record length mismatch :&lt;br /&gt;
; Record Length or CR Problem :&lt;br /&gt;
    This usually happens because the input format description is not correct. Make sure the format description&#039;s last position is the last character before the end-of-line character. If you have a header, make sure it is described correctly. The header&#039;s length must include all characters up until the last end-of-line-character before the data begins. &lt;br /&gt;
; Binary Overflow :&lt;br /&gt;
    Try using a larger output variable type such as a long instead of a short. Be sure you have given enough space for the values to be written. See Chapter  for more information. &lt;br /&gt;
; Variable not found :&lt;br /&gt;
    The variable names in your output format must match the variable names in the input format unless you are using conversion variables. &lt;br /&gt;
; Data Overflow :&lt;br /&gt;
    Data overflow does not usually cause a fatal error and FreeForm ND functions try to anticipate them. If overflow occurs for a particular value, ***&#039;s are written to that value&#039;s location. If you find these in your output, check your variable positions and precision. Increase field width or use a &amp;quot;larger&amp;quot; data type. Be sure the output format specifies space for the output variable. For instance, FreeForm ND adds a leading zero in front of decimal points. If the original data did not have a leading zero, the output will have one more digit than the input. &lt;br /&gt;
; Insufficient memory allocation :&lt;br /&gt;
    The application has run out of memory. Try using the -b (local buffer size) option, or modify autoexec.bat and config.sys and comment out devices, TSR&#039;s, etc.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/errors&amp;diff=2042</id>
		<title>Wiki Testing/errors</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/errors&amp;diff=2042"/>
		<updated>2008-02-06T17:31:53Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Error Messages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Error Handling=&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND error handling system captures errors, such as improper usage, code problems, and system errors, and places them in an error queue. For each error captured, error type and a short message are placed in the message queue. If a fatal error occurs, the program stops executing and displays all error messages in the queue.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Error Messages==&lt;br /&gt;
&lt;br /&gt;
The following is a list of some possible error messages with suggestions for corrections.&lt;br /&gt;
&lt;br /&gt;
; Problem opening, reading, or writing to file :&lt;br /&gt;
    Check that all file names and paths are correct. &lt;br /&gt;
; Problem making format :&lt;br /&gt;
    Make sure there is a format file describing the data file formats. Check that input and output format descriptions in the format file accurately describe the data. &lt;br /&gt;
; Problem making header format :&lt;br /&gt;
    If a header exists in the data file, it must be described in a format file. Check that the header description accurately describes the header in your data file. &lt;br /&gt;
; Problem getting value :&lt;br /&gt;
; Problem processing variable list :&lt;br /&gt;
    The data formats may not be described correctly or there may be some inconsistencies in the data. Check also for unprintable characters at the end of the data file. &lt;br /&gt;
; File length / Record length mismatch :&lt;br /&gt;
; Record Length or CR Problem :&lt;br /&gt;
    This usually happens because the input format description is not correct. Make sure the format description&#039;s last position is the last character before the end-of-line character. If you have a header, make sure it is described correctly. The header&#039;s length must include all characters up until the last end-of-line-character before the data begins. &lt;br /&gt;
; Binary Overflow :&lt;br /&gt;
    Try using a larger output variable type such as a long instead of a short. Be sure you have given enough space for the values to be written. See Chapter  for more information. &lt;br /&gt;
; Variable not found :&lt;br /&gt;
    The variable names in your output format must match the variable names in the input format unless you are using conversion variables. &lt;br /&gt;
; Data Overflow :&lt;br /&gt;
******&lt;br /&gt;
    Data overflow does not usually cause a fatal error and FreeForm ND functions try to anticipate them. If overflow occurs for a particular value, ***&#039;s are written to that value&#039;s location. If you find these in your output, check your variable positions and precision. Increase field width or use a &amp;quot;larger&amp;quot; data type. Be sure the output format specifies space for the output variable. For instance, FreeForm ND adds a leading zero in front of decimal points. If the original data did not have a leading zero, the output will have one more digit than the input. &lt;br /&gt;
; Insufficient memory allocation :&lt;br /&gt;
    The application has run out of memory. Try using the -b (local buffer size) option, or modify autoexec.bat and config.sys and comment out devices, TSR&#039;s, etc.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/errors&amp;diff=2041</id>
		<title>Wiki Testing/errors</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/errors&amp;diff=2041"/>
		<updated>2008-02-06T17:30:13Z</updated>

		<summary type="html">&lt;p&gt;Yuan: New page: =Error Handling=  The FreeForm ND error handling system captures errors, such as improper usage, code problems, and system errors, and places them in an error queue. For each error capture...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Error Handling=&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND error handling system captures errors, such as improper usage, code problems, and system errors, and places them in an error queue. For each error captured, error type and a short message are placed in the message queue. If a fatal error occurs, the program stops executing and displays all error messages in the queue.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Error Messages==&lt;br /&gt;
&lt;br /&gt;
The following is a list of some possible error messages with suggestions for corrections.&lt;br /&gt;
&lt;br /&gt;
; Problem opening, reading, or writing to file :&lt;br /&gt;
    Check that all file names and paths are correct. &lt;br /&gt;
; Problem making format :&lt;br /&gt;
    Make sure there is a format file describing the data file formats. Check that input and output format descriptions in the format file accurately describe the data. &lt;br /&gt;
Problem making header format&lt;br /&gt;
    If a header exists in the data file, it must be described in a format file. Check that the header description accurately describes the header in your data file. &lt;br /&gt;
Problem getting value&lt;br /&gt;
Problem processing variable list&lt;br /&gt;
    The data formats may not be described correctly or there may be some inconsistencies in the data. Check also for unprintable characters at the end of the data file. &lt;br /&gt;
File length / Record length mismatch&lt;br /&gt;
Record Length or CR Problem&lt;br /&gt;
    This usually happens because the input format description is not correct. Make sure the format description&#039;s last position is the last character before the end-of-line character. If you have a header, make sure it is described correctly. The header&#039;s length must include all characters up until the last end-of-line-character before the data begins. &lt;br /&gt;
Binary Overflow&lt;br /&gt;
    Try using a larger output variable type such as a long instead of a short. Be sure you have given enough space for the values to be written. See Chapter  for more information. &lt;br /&gt;
Variable not found&lt;br /&gt;
    The variable names in your output format must match the variable names in the input format unless you are using conversion variables. &lt;br /&gt;
Data Overflow&lt;br /&gt;
******&lt;br /&gt;
    Data overflow does not usually cause a fatal error and FreeForm ND functions try to anticipate them. If overflow occurs for a particular value, ***&#039;s are written to that value&#039;s location. If you find these in your output, check your variable positions and precision. Increase field width or use a &amp;quot;larger&amp;quot; data type. Be sure the output format specifies space for the output variable. For instance, FreeForm ND adds a leading zero in front of decimal points. If the original data did not have a leading zero, the output will have one more digit than the input. &lt;br /&gt;
Insufficient memory allocation&lt;br /&gt;
    The application has run out of memory. Try using the -b (local buffer size) option, or modify autoexec.bat and config.sys and comment out devices, TSR&#039;s, etc.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/hdfutils&amp;diff=2040</id>
		<title>Wiki Testing/hdfutils</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/hdfutils&amp;diff=2040"/>
		<updated>2008-02-06T17:28:00Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* &amp;lt;font color=&amp;#039;green&amp;#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=HDF Utilities=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes three utilities for use with HDF (hierarchical&lt;br /&gt;
data format) files: &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt;.&lt;br /&gt;
These programs were built using both the FreeForm library and the HDF&lt;br /&gt;
library, which was developed at the National Center for Supercomputer&lt;br /&gt;
Applications (NCSA).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; program converts binary and ASCII data files to HDF&lt;br /&gt;
files and converts multiplexed band interleaved by pixel image files&lt;br /&gt;
into a series of single parameter files. The &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; program is&lt;br /&gt;
used to separate and reformat data files containing headers and data&lt;br /&gt;
into separate header and data files, or to translate them into HDF&lt;br /&gt;
files. The &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; program extracts point data from HDF files&lt;br /&gt;
into binary or ASCII format.&lt;br /&gt;
&lt;br /&gt;
It is assumed in this chapter that you have a working familiarity with&lt;br /&gt;
HDF terminology and conventions. See the HDF user documentation for&lt;br /&gt;
detailed information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: Do not try the examples in this chapter. The example file set is&lt;br /&gt;
incomplete.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; you can convert data files with formats described&lt;br /&gt;
in a FreeForm format file into HDF files. You should follow FreeForm&lt;br /&gt;
naming conventions for the data and format files. For details about&lt;br /&gt;
FreeForm conventions, see ([[Wiki_Testing/convs | Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;A dBASE input file must be converted to ASCII or binary using&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; before you can run &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; on it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The HDF file resulting from a conversion consists either of a group of&lt;br /&gt;
scientific datasets (SDS&#039;s), one for each variable in the input data&lt;br /&gt;
file, or of a &#039;&#039;vgroup&#039;&#039; containing all the variables as one&lt;br /&gt;
&#039;&#039;vdata&#039;&#039;. If you are working with grid data, you will want SDS&#039;s&lt;br /&gt;
(the default) in the output HDF file. A vdata (&amp;lt;font color=&#039;green&#039;&amp;gt;-vd&amp;lt;/font&amp;gt; option) is the&lt;br /&gt;
appropriate choice for point data.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    makehdf input_file [-r rows] [-c columns] [-v var_file] [-d HDF_description_file]&lt;br /&gt;
&lt;br /&gt;
    [-xl x_label -yl y_label] [-xu x_units -yu y_units] [-xf x_format -yf y_format] [-id file_id] [-vd [vdata_file]] [-dmx [-sep]] [-df] [-md missing_data_file] [-dof HDF_file] &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;input_file&#039;&#039; :&lt;br /&gt;
Name of the input data file. Following FreeForm naming conventions,&lt;br /&gt;
the standard extensions for data files are &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; for ASCII&lt;br /&gt;
format and &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; for binary.&lt;br /&gt;
&lt;br /&gt;
; -r rows :&lt;br /&gt;
Option flag followed by the number of rows in each resulting&lt;br /&gt;
scientific dataset. The number of rows must be specified through&lt;br /&gt;
this option on the command line, or in an equivalence table, or in a&lt;br /&gt;
header (&amp;lt;font color=&#039;green&#039;&amp;gt;.hdr&amp;lt;/font&amp;gt;) file defined according to FreeForm standards.&lt;br /&gt;
&lt;br /&gt;
; -c columns :&lt;br /&gt;
Option flag followed by the number of columns in each resulting&lt;br /&gt;
scientific dataset. The number of columns must be specified through&lt;br /&gt;
this option on the command line, or in an equivalence table, or in a&lt;br /&gt;
header (&amp;lt;font color=&#039;green&#039;&amp;gt;.hdr&amp;lt;/font&amp;gt;) file defined according to FreeForm standards.&lt;br /&gt;
For information about equivalence tables, see the GeoVu Tools&lt;br /&gt;
Reference Guide.&lt;br /&gt;
&lt;br /&gt;
; -v var_file :&lt;br /&gt;
Option flag followed by the name of the variable file. The file&lt;br /&gt;
contains names of the variables in the input data file to be&lt;br /&gt;
processed by &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt;. Variable names in \var{var_file} can be&lt;br /&gt;
separated by one or more spaces or each name can be on a separate&lt;br /&gt;
line.&lt;br /&gt;
&lt;br /&gt;
; -d HDF_description_file :&lt;br /&gt;
Option flag followed by the name of the file containing a&lt;br /&gt;
description of the input file. The description will be stored as a&lt;br /&gt;
file annotation in the resulting HDF file.&lt;br /&gt;
&lt;br /&gt;
; -xl x_label -yl y_label :&lt;br /&gt;
Option flags followed by strings (labels) describing the x and y&lt;br /&gt;
axes; labels must be in quotes (&amp;lt;font color=&#039;green&#039;&amp;gt;&amp;quot; &amp;quot;&amp;lt;/font&amp;gt;) if more than one word.&lt;br /&gt;
&lt;br /&gt;
; -xu x_units -yu y_units :&lt;br /&gt;
Option flags followed by strings indicating the measurement units&lt;br /&gt;
for the x and y axes; strings must be in quotes (&amp;lt;font color=&#039;green&#039;&amp;gt;&amp;quot; &amp;quot;&amp;lt;/font&amp;gt;) if more than&lt;br /&gt;
one word.&lt;br /&gt;
&lt;br /&gt;
; - xf x_format -yf y_format :&lt;br /&gt;
Option flags followed by strings indicating the formats to be used&lt;br /&gt;
in displaying scale for the x and y dimensions; strings must be in&lt;br /&gt;
quotes (&amp;lt;font color=&#039;green&#039;&amp;gt;&amp;quot; &amp;quot;&amp;lt;/font&amp;gt;) if more than one word.&lt;br /&gt;
&lt;br /&gt;
; - id file_id :&lt;br /&gt;
Option flag followed by a string that will be stored as the ID of&lt;br /&gt;
the resulting HDF file.&lt;br /&gt;
&lt;br /&gt;
; - vd [vdata_file] :&lt;br /&gt;
Option flag indicating that the output HDF file should contain a&lt;br /&gt;
vdata. The optional file name specifies the name of the output HDF&lt;br /&gt;
file; the default is &amp;lt;font color=&#039;green&#039;&amp;gt;input_file.HDF&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; - dmx [-sep] :&lt;br /&gt;
The option flag &amp;lt;font color=&#039;green&#039;&amp;gt;-dmx&amp;lt;/font&amp;gt; indicates that input data should be&lt;br /&gt;
demultiplexed from band interleaved by pixel to band sequential form&lt;br /&gt;
in &amp;lt;font color=&#039;green&#039;&amp;gt;input_file.dmx&amp;lt;/font&amp;gt;. If &amp;lt;font color=&#039;green&#039;&amp;gt;-dmx&amp;lt;/font&amp;gt; is followed by &amp;lt;font color=&#039;green&#039;&amp;gt;-sep&amp;lt;/font&amp;gt;,&lt;br /&gt;
the input data are demultiplexed into separate variable files called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;data_file.1&amp;lt;/font&amp;gt; \ldots &amp;lt;font color=&#039;green&#039;&amp;gt;data_file.n&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; - df :&lt;br /&gt;
To use this option, the input file (&amp;lt;font color=&#039;green&#039;&amp;gt;data_file.ext&amp;lt;/font&amp;gt;) must be a&lt;br /&gt;
binary demultiplexed (band sequential) file.  For each input&lt;br /&gt;
variable in the applicable FreeForm format description file, there&lt;br /&gt;
is a corresponding demultiplexed section in the output HDF file.&lt;br /&gt;
&lt;br /&gt;
; - md missing_data_file :&lt;br /&gt;
Option flag followed by the name of the file defining missing data&lt;br /&gt;
(data you want to exclude). Use this option only along with the&lt;br /&gt;
vdata (-vd) option. Each line in the missing data file has the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable_name lower_limit upper_limit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The precision of the upper and lower limits matches the precision of&lt;br /&gt;
the input data.&lt;br /&gt;
&lt;br /&gt;
; - dof HDF_file :&lt;br /&gt;
Option flag followed by the name of the output HDF file. If you do&lt;br /&gt;
not use the &amp;lt;font color=&#039;green&#039;&amp;gt;-dof&amp;lt;/font&amp;gt; option, the default output file name is&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;input_file.HDF&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
&lt;br /&gt;
You will use &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; to store &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; as an HDF file.&lt;br /&gt;
The HDF file will consist of two SDS&#039;s, one each for the two variables&lt;br /&gt;
latitude and longitude. Each SDS will have four rows and five columns.&lt;br /&gt;
&lt;br /&gt;
To convert &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to an HDF file, enter the following&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
makehdf latlon.dat -r 4 -c 5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; translates &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into HDF, processing&lt;br /&gt;
information is displayed on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1   Caches (1150 bytes) Processed: 800 bytes written to latlon.dmx&lt;br /&gt;
Writing latlon.HDF and calculating maxima and minima ...&lt;br /&gt;
&lt;br /&gt;
Variable latitude:&lt;br /&gt;
Minimum: -86.432712  Maximum 89.170904&lt;br /&gt;
Variable longitude:&lt;br /&gt;
Minimum: -176.161101  Maximum 165.066193&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output from &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; is an HDF file named &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.HDF&amp;lt;/font&amp;gt;&lt;br /&gt;
(by default). It contains the minimum and maximum values for the two&lt;br /&gt;
variables as well as the two SDS&#039;s.&lt;br /&gt;
&lt;br /&gt;
A temporary file named &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dmx&amp;lt;/font&amp;gt; was also created. It contains&lt;br /&gt;
the data from latlon.dat in demultiplexed form . The data was&lt;br /&gt;
converted from its original multiplexed form to enable &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt;&lt;br /&gt;
to write sections of data to SDS&#039;s.&lt;br /&gt;
&lt;br /&gt;
If you start with a demultiplexed file such as &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dmx&amp;lt;/font&amp;gt;, the&lt;br /&gt;
translation process is much quicker, particularly for large data&lt;br /&gt;
files. As an illustration, try this. Rename &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dmx&amp;lt;/font&amp;gt; to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; (renaming is necessary for &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; to find the&lt;br /&gt;
format description file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default). Enter the&lt;br /&gt;
following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
makehdf latlon.bin -df -r 4 -c 5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output file again is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.HDF&amp;lt;/font&amp;gt;, but notice that no&lt;br /&gt;
demultiplexing was done.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; program translates files with headers and data into&lt;br /&gt;
separate header and data files or into HDF files. If the translation&lt;br /&gt;
is to separate header and data files, the header file can include&lt;br /&gt;
indexing information.&lt;br /&gt;
&lt;br /&gt;
The combination of header and data records in a file is often used for&lt;br /&gt;
point data sets that include a number of observations made at one or&lt;br /&gt;
more stations or locations in space. The header records contain&lt;br /&gt;
information about the stations or locations of the measurements. The&lt;br /&gt;
data records hold the observational data. A station record usually&lt;br /&gt;
indicates how many data records follow it. The structure of such a&lt;br /&gt;
file is similar to the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Header for Station 1&lt;br /&gt;
Observation 1 for Station 1&lt;br /&gt;
Observation 2 for Station 1&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
Observation N for Station 1&lt;br /&gt;
&lt;br /&gt;
Header for Station 2&lt;br /&gt;
Observation 1 for Station 2&lt;br /&gt;
Observation 2 for Station 2&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
Observation N for Station 2&lt;br /&gt;
&lt;br /&gt;
Header for Station 3&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Many applications have difficulty reading this sort of heterogeneous&lt;br /&gt;
data file. One solution is to split the data into two homogeneous&lt;br /&gt;
files, one containing the headers, the other containing the data. With&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt;, you can easily create the separate data and header&lt;br /&gt;
files. To use &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; for this purpose, the input and output&lt;br /&gt;
formats for the record headers and the data must be described in a&lt;br /&gt;
FreeForm format description file. To use &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; for&lt;br /&gt;
translating files to HDF, the input format must be described in a&lt;br /&gt;
FreeForm format description file. You should follow FreeForm naming&lt;br /&gt;
conventions for the data and format files. For details about FreeForm&lt;br /&gt;
conventions, see ([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
\proto{&amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; \var{input_file} [\var{output_data_file} &amp;gt; \var{output_header_file}]}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; \var{input_file}  :&lt;br /&gt;
Name of the file to be processed. Following FreeForm naming&lt;br /&gt;
conventions, the standard extensions for data files are &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
for ASCII format and &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; for binary.&lt;br /&gt;
&lt;br /&gt;
; \var{output_data_file}  :&lt;br /&gt;
Name of the output file into which data are transferred with the&lt;br /&gt;
format specified in the applicable FreeForm format description file.&lt;br /&gt;
The standard extensions are the same as for input files. If an&lt;br /&gt;
output file name is not specified, the default is standard output.&lt;br /&gt;
&lt;br /&gt;
; \var{output_header_file}  :&lt;br /&gt;
Name of the output file into which headers from the input file are&lt;br /&gt;
transferred with the format specified in the applicable FreeForm&lt;br /&gt;
format description file. If an output header file name is not&lt;br /&gt;
specified, the default is standard output.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Index Creation===&lt;br /&gt;
&lt;br /&gt;
You can use the two variables begin and extent (described below) in&lt;br /&gt;
the format description for the output record headers to indicate the&lt;br /&gt;
location and size of the data block associated with each record&lt;br /&gt;
header. If you then use &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt;, the header file that results&lt;br /&gt;
can be used as an index to the data file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;begin&amp;lt;/font&amp;gt; :&lt;br /&gt;
Indicates the offset to the beginning of the data associated with a&lt;br /&gt;
particular header. If the data is being translated to HDF, the units&lt;br /&gt;
are records; if not, the units are bytes.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;extent&amp;lt;/font&amp;gt; :&lt;br /&gt;
Indicates the number of records (HDF) or bytes (non-HDF) associated&lt;br /&gt;
with each header record.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
You will use &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; to extract the headers and data from a&lt;br /&gt;
rawinsonde (a device for gathering meteorological data) ASCII data&lt;br /&gt;
file named &amp;lt;font color=&#039;green&#039;&amp;gt;hara.dat&amp;lt;/font&amp;gt; (HARA = Historic Arctic Rawinsonde Archive)&lt;br /&gt;
and create two output files-&amp;lt;font color=&#039;green&#039;&amp;gt;23338.dat&amp;lt;/font&amp;gt; containing the ASCII data&lt;br /&gt;
and &amp;lt;font color=&#039;green&#039;&amp;gt;23338hdr.dat&amp;lt;/font&amp;gt; containing the ASCII headers. The format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;hara.fmt&amp;lt;/font&amp;gt; should contain the necessary format&lt;br /&gt;
descriptions.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;hara.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ASCII_input_record_header &amp;quot;ASCII Location Record input format&amp;quot;&lt;br /&gt;
WMO_station_ID_number 1 5 char 0&lt;br /&gt;
latitude 6 10 long 2&lt;br /&gt;
longitude_east 11 15 long 2&lt;br /&gt;
year 17 18 uchar 0&lt;br /&gt;
month 19 20 uchar 0&lt;br /&gt;
day 21 22 uchar 0&lt;br /&gt;
hour 23 24 uchar 0&lt;br /&gt;
flag_processing_1 28 28 char 0&lt;br /&gt;
flag_processing_2 29 29 char 0&lt;br /&gt;
flag_processing_3 30 30 char 0&lt;br /&gt;
station_type 31 31 char 0&lt;br /&gt;
sea_level_elev 32 36 long 0&lt;br /&gt;
instrument_type 37 38 uchar 0&lt;br /&gt;
number_of_observations 40 42 ushort 0&lt;br /&gt;
identification_code 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;Historical Arctic Rawinsonde Archive input format&amp;quot;&lt;br /&gt;
atmospheric_pressure 1 5 long 1&lt;br /&gt;
geopotential_height 7 11 long 0&lt;br /&gt;
temperature_deg 13 16 short 0&lt;br /&gt;
dewpoint_depression 18 20 short 0&lt;br /&gt;
wind_direction 22 24 short 0&lt;br /&gt;
wind_speed_m/s 26 28 short 0&lt;br /&gt;
flag_qg 30 30 char 0&lt;br /&gt;
flag_qg1 31 31 char 0&lt;br /&gt;
flag_qt 33 33 char 0&lt;br /&gt;
flag_qt1 34 34 char 0&lt;br /&gt;
flag_qd 36 36 char 0&lt;br /&gt;
flag_qd1 37 37 char 0&lt;br /&gt;
flag_qw 39 39 char 0&lt;br /&gt;
flag_qw1 40 40 char 0&lt;br /&gt;
flag_qp 42 42 char 0&lt;br /&gt;
flag_levck 43 43 char 0&lt;br /&gt;
&lt;br /&gt;
ASCII_output_record_header &amp;quot;ASCII Location Record output format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
ASCII_output_data &amp;quot;Historical Arctic Rawinsonde Archive output format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To &amp;quot;split&amp;quot; &amp;lt;font color=&#039;green&#039;&amp;gt;hara.dat&amp;lt;/font&amp;gt;, enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
splitdat hara.dat 23338.dat &amp;gt; 23338hdr.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data values from &amp;lt;font color=&#039;green&#039;&amp;gt;hara.dat&amp;lt;/font&amp;gt; are stored in &amp;lt;font color=&#039;green&#039;&amp;gt;23338.dat&amp;lt;/font&amp;gt; and&lt;br /&gt;
the headers in &amp;lt;font color=&#039;green&#039;&amp;gt;23338hdr.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Because the variables begin and extent were used in the header output&lt;br /&gt;
format in &amp;lt;font color=&#039;green&#039;&amp;gt;hara.fmt&amp;lt;/font&amp;gt; to indicate data offset and number of&lt;br /&gt;
records, &amp;lt;font color=&#039;green&#039;&amp;gt;23338hdr.dat&amp;lt;/font&amp;gt; has two columns of data showing offset and&lt;br /&gt;
extent. Thus, it can serve as an index into &amp;lt;font color=&#039;green&#039;&amp;gt;23338.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===HDF Translation===&lt;br /&gt;
&lt;br /&gt;
If output files are not specified on the &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; command line,&lt;br /&gt;
a file named &amp;lt;font color=&#039;green&#039;&amp;gt;input_file.HDF&amp;lt;/font&amp;gt; is created. It is hierarchically&lt;br /&gt;
named and organized as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
vgroup&lt;br /&gt;
&lt;br /&gt;
input_file_name&lt;br /&gt;
&lt;br /&gt;
/      \&lt;br /&gt;
&lt;br /&gt;
/        \&lt;br /&gt;
&lt;br /&gt;
vdata1       vdata2&lt;br /&gt;
&amp;quot;PointIndex&amp;quot;      &amp;quot;input_file_name&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;vdata1&amp;lt;/font&amp;gt; contains the record headers&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;vdata2&amp;lt;/font&amp;gt; contains the data&lt;br /&gt;
*If writing to a Vset (represented by a vgroup), both output&lt;br /&gt;
formats are converted to binary, if not binary already.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
To create the file &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt; from &amp;lt;font color=&#039;green&#039;&amp;gt;hara.dat&amp;lt;/font&amp;gt;, enter the&lt;br /&gt;
following abbreviated command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
splitdat hara.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output formats in &amp;lt;font color=&#039;green&#039;&amp;gt;hara.fmt&amp;lt;/font&amp;gt; are automatically converted to&lt;br /&gt;
binary, and subsequently the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;hara.dat&amp;lt;/font&amp;gt; are also&lt;br /&gt;
converted to binary for HDF storage.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; program is a versatile tool for extracting point&lt;br /&gt;
data  from HDF files containing scientific datasets and Vsets. The&lt;br /&gt;
extraction can be done into any binary or ASCII format described in a&lt;br /&gt;
FreeForm format description file. Before using &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; on an HDF&lt;br /&gt;
file, you should pack the file using the NCSA-developed HDF utility&lt;br /&gt;
hdfpack.&lt;br /&gt;
&lt;br /&gt;
You can use &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; to extract headers and data from an HDF file&lt;br /&gt;
into separate files or to extract just the data. It&#039;s a good idea to&lt;br /&gt;
define GeoVu keywords in an equivalence table to facilitate access to&lt;br /&gt;
HDF objects. For information about equivalence tables, see the GeoVu&lt;br /&gt;
Tools Reference Guide. The input and output formats must be described&lt;br /&gt;
in a FreeForm format description file. You should follow FreeForm&lt;br /&gt;
naming conventions for the data and format files. For details about&lt;br /&gt;
FreeForm conventions, see ([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
If a format description file is not specified on the command line, the&lt;br /&gt;
output format is taken by default from the FreeForm output format&lt;br /&gt;
annotation stored in the HDF file. If there is no annotation, a&lt;br /&gt;
default ASCII output format is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;An equivalence table takes precedence over&lt;br /&gt;
everything. (vdata=1963, SDS=702)&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have not specified an HDF object in an equivalence table,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; uses the following sequence to determine the appropriate&lt;br /&gt;
source for output:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Output the first vdata with class name Data.&lt;br /&gt;
#Output the largest vdata.&lt;br /&gt;
#Output the first SDS.&lt;br /&gt;
&lt;br /&gt;
If no vdatas exist in the file, but an SDS is found, it is extracted&lt;br /&gt;
and a default ASCII output format is used.&lt;br /&gt;
&lt;br /&gt;
===Extracting Headers and Data===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; command takes the following form when you want to&lt;br /&gt;
extract headers and data from HDF files into separate files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pntshow input_HDF_file [-h [output_header_file]] [-hof output_header_format_file]&lt;br /&gt;
&lt;br /&gt;
    [-hof output_header_format_file] [-d [output_data_file]] [-dof output_data_format_file]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; \var{input_HDF_file} :&lt;br /&gt;
Name of the input HDF file, which has been packed using&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;hdfpack&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; \hdfh :&lt;br /&gt;
Option flag followed optionally by the name of the file designated&lt;br /&gt;
to contain the record headers currently stored in a vdata with a&lt;br /&gt;
class name of Index. If an output header file name is not specified,&lt;br /&gt;
the default is standard output.&lt;br /&gt;
&lt;br /&gt;
; \hdfhof :&lt;br /&gt;
Option flag followed by the name of the FreeForm format file that&lt;br /&gt;
describes the format for the headers extracted to standard output or&lt;br /&gt;
output_header_file.&lt;br /&gt;
&lt;br /&gt;
; \hdfd :&lt;br /&gt;
Option flag followed optionally by the name of the file designated&lt;br /&gt;
to contain the data currently stored in a vdata with a class name of&lt;br /&gt;
Data. If an output file name is not specified, the default is&lt;br /&gt;
standard output.&lt;br /&gt;
&lt;br /&gt;
; \hdfdof :&lt;br /&gt;
Option flag followed by the name of the FreeForm format file that&lt;br /&gt;
describes the format for data extracted to standard output or&lt;br /&gt;
\var{output_data_file}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
You will extract data and headers from &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt; (created by&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; in a previous example). This file contains two vdatas:&lt;br /&gt;
one has the class name Data and the other has the class name Index.&lt;br /&gt;
Because this file is extremely small, no appending links were created&lt;br /&gt;
in the file, so there is no need to pack the file before using&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt;, though you can if you wish.&lt;br /&gt;
&lt;br /&gt;
To extract data and headers from &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt;, enter the following&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pntshow hara.HDF -d haradata.dat -h harahdrs.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data from the vdata designated as Data in &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt; are now&lt;br /&gt;
stored in &amp;lt;font color=&#039;green&#039;&amp;gt;haradata.dat&amp;lt;/font&amp;gt;. The data are in their original format&lt;br /&gt;
because the original output format was stored by &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; in the&lt;br /&gt;
HDF file. The header data from the vdata designated as Index in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt; are now stored in &amp;lt;font color=&#039;green&#039;&amp;gt;harahdrs.dat&amp;lt;/font&amp;gt;. In addition to&lt;br /&gt;
the original header data, the variables begin and extent have also&lt;br /&gt;
been extracted to &amp;lt;font color=&#039;green&#039;&amp;gt;harahdrs.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Extracting Data Only===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; command takes the following form when you want to&lt;br /&gt;
extract just the data from an HDF file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pntshow input_HDF_file [-of default_output_format_file]&lt;br /&gt;
&lt;br /&gt;
    [&amp;gt; output_file]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; \var{input_HDF_file} :&lt;br /&gt;
Name of the input HDF file, which has been packed using &amp;lt;font color=&#039;green&#039;&amp;gt;hdfpack&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; \hdfof :&lt;br /&gt;
Option flag followed by the name of the FreeForm format file that&lt;br /&gt;
describes the format for data extracted to standard output or&lt;br /&gt;
\var{output_file.}&lt;br /&gt;
&lt;br /&gt;
; \var{output_file} :&lt;br /&gt;
Name of the output file into which data is transferred. If an output&lt;br /&gt;
file name is not specified, the default is standard output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Examples====&lt;br /&gt;
&lt;br /&gt;
You can use &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; to extract designated variables from an HDF&lt;br /&gt;
file. In this example, you will extract temperature and pressure&lt;br /&gt;
values from &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt; to an ASCII format. First, the following&lt;br /&gt;
format description file must exist.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;haradata.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ASCII_output_data &amp;quot;ASCII format for pressure, temp&amp;quot;&lt;br /&gt;
atmospheric_pressure 1 10 long 1&lt;br /&gt;
temperature_deg 15 25 float 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create a file named &amp;lt;font color=&#039;green&#039;&amp;gt;temppres.dat&amp;lt;/font&amp;gt; containing only the&lt;br /&gt;
temperature and pressure variables, enter either of the following&lt;br /&gt;
commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pntshow hara.HDF -of haradata.fmt &amp;gt; temppres.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pntshow hara.HDF -d temppres.dat -dof haradata.fmt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use the first command, &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; searches &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt;&lt;br /&gt;
for a vdata named Data. Since &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt; contains only one vdata&lt;br /&gt;
named &amp;lt;font color=&#039;green&#039;&amp;gt;Data&amp;lt;/font&amp;gt;, this vdata is extracted by default with the format&lt;br /&gt;
specified in &amp;lt;font color=&#039;green&#039;&amp;gt;haradata.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The results are the same if you use the second command. Now, try&lt;br /&gt;
running &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; on the previously created file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.HDF&amp;lt;/font&amp;gt;,&lt;br /&gt;
which contains two SDS&#039;s. Use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pntshow latlon.HDF &amp;gt; latlon.SDS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.SDS&amp;lt;/font&amp;gt; file now contains the latitude and longitude&lt;br /&gt;
values extracted from &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.HDF&amp;lt;/font&amp;gt;. They have the default ASCII&lt;br /&gt;
output format. You could have used the -of option to specify an output&lt;br /&gt;
format included in a FreeForm format description file.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/hdfutils&amp;diff=2039</id>
		<title>Wiki Testing/hdfutils</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/hdfutils&amp;diff=2039"/>
		<updated>2008-02-06T17:27:34Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* &amp;lt;font color=&amp;#039;green&amp;#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=HDF Utilities=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes three utilities for use with HDF (hierarchical&lt;br /&gt;
data format) files: &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt;.&lt;br /&gt;
These programs were built using both the FreeForm library and the HDF&lt;br /&gt;
library, which was developed at the National Center for Supercomputer&lt;br /&gt;
Applications (NCSA).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; program converts binary and ASCII data files to HDF&lt;br /&gt;
files and converts multiplexed band interleaved by pixel image files&lt;br /&gt;
into a series of single parameter files. The &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; program is&lt;br /&gt;
used to separate and reformat data files containing headers and data&lt;br /&gt;
into separate header and data files, or to translate them into HDF&lt;br /&gt;
files. The &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; program extracts point data from HDF files&lt;br /&gt;
into binary or ASCII format.&lt;br /&gt;
&lt;br /&gt;
It is assumed in this chapter that you have a working familiarity with&lt;br /&gt;
HDF terminology and conventions. See the HDF user documentation for&lt;br /&gt;
detailed information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: Do not try the examples in this chapter. The example file set is&lt;br /&gt;
incomplete.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; you can convert data files with formats described&lt;br /&gt;
in a FreeForm format file into HDF files. You should follow FreeForm&lt;br /&gt;
naming conventions for the data and format files. For details about&lt;br /&gt;
FreeForm conventions, see ([[Wiki_Testing/convs | Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;A dBASE input file must be converted to ASCII or binary using&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; before you can run &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; on it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The HDF file resulting from a conversion consists either of a group of&lt;br /&gt;
scientific datasets (SDS&#039;s), one for each variable in the input data&lt;br /&gt;
file, or of a &#039;&#039;vgroup&#039;&#039; containing all the variables as one&lt;br /&gt;
&#039;&#039;vdata&#039;&#039;. If you are working with grid data, you will want SDS&#039;s&lt;br /&gt;
(the default) in the output HDF file. A vdata (&amp;lt;font color=&#039;green&#039;&amp;gt;-vd&amp;lt;/font&amp;gt; option) is the&lt;br /&gt;
appropriate choice for point data.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    makehdf input_file [-r rows] [-c columns] [-v var_file] [-d HDF_description_file]&lt;br /&gt;
&lt;br /&gt;
    [-xl x_label -yl y_label] [-xu x_units -yu y_units] [-xf x_format -yf y_format] [-id file_id] [-vd [vdata_file]] [-dmx [-sep]] [-df] [-md missing_data_file] [-dof HDF_file] &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;input_file&#039;&#039; :&lt;br /&gt;
Name of the input data file. Following FreeForm naming conventions,&lt;br /&gt;
the standard extensions for data files are &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; for ASCII&lt;br /&gt;
format and &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; for binary.&lt;br /&gt;
&lt;br /&gt;
; -r rows :&lt;br /&gt;
Option flag followed by the number of rows in each resulting&lt;br /&gt;
scientific dataset. The number of rows must be specified through&lt;br /&gt;
this option on the command line, or in an equivalence table, or in a&lt;br /&gt;
header (&amp;lt;font color=&#039;green&#039;&amp;gt;.hdr&amp;lt;/font&amp;gt;) file defined according to FreeForm standards.&lt;br /&gt;
&lt;br /&gt;
; -c columns :&lt;br /&gt;
Option flag followed by the number of columns in each resulting&lt;br /&gt;
scientific dataset. The number of columns must be specified through&lt;br /&gt;
this option on the command line, or in an equivalence table, or in a&lt;br /&gt;
header (&amp;lt;font color=&#039;green&#039;&amp;gt;.hdr&amp;lt;/font&amp;gt;) file defined according to FreeForm standards.&lt;br /&gt;
For information about equivalence tables, see the GeoVu Tools&lt;br /&gt;
Reference Guide.&lt;br /&gt;
&lt;br /&gt;
; -v var_file :&lt;br /&gt;
Option flag followed by the name of the variable file. The file&lt;br /&gt;
contains names of the variables in the input data file to be&lt;br /&gt;
processed by &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt;. Variable names in \var{var_file} can be&lt;br /&gt;
separated by one or more spaces or each name can be on a separate&lt;br /&gt;
line.&lt;br /&gt;
&lt;br /&gt;
; -d HDF_description_file :&lt;br /&gt;
Option flag followed by the name of the file containing a&lt;br /&gt;
description of the input file. The description will be stored as a&lt;br /&gt;
file annotation in the resulting HDF file.&lt;br /&gt;
&lt;br /&gt;
; -xl x_label -yl y_label :&lt;br /&gt;
Option flags followed by strings (labels) describing the x and y&lt;br /&gt;
axes; labels must be in quotes (&amp;lt;font color=&#039;green&#039;&amp;gt;&amp;quot; &amp;quot;&amp;lt;/font&amp;gt;) if more than one word.&lt;br /&gt;
&lt;br /&gt;
; -xu x_units -yu y_units :&lt;br /&gt;
Option flags followed by strings indicating the measurement units&lt;br /&gt;
for the x and y axes; strings must be in quotes (&amp;lt;font color=&#039;green&#039;&amp;gt;&amp;quot; &amp;quot;&amp;lt;/font&amp;gt;) if more than&lt;br /&gt;
one word.&lt;br /&gt;
&lt;br /&gt;
; - xf x_format -yf y_format :&lt;br /&gt;
Option flags followed by strings indicating the formats to be used&lt;br /&gt;
in displaying scale for the x and y dimensions; strings must be in&lt;br /&gt;
quotes (&amp;lt;font color=&#039;green&#039;&amp;gt;&amp;quot; &amp;quot;&amp;lt;/font&amp;gt;) if more than one word.&lt;br /&gt;
&lt;br /&gt;
; - id file_id :&lt;br /&gt;
Option flag followed by a string that will be stored as the ID of&lt;br /&gt;
the resulting HDF file.&lt;br /&gt;
&lt;br /&gt;
; - vd [vdata_file] :&lt;br /&gt;
Option flag indicating that the output HDF file should contain a&lt;br /&gt;
vdata. The optional file name specifies the name of the output HDF&lt;br /&gt;
file; the default is &amp;lt;font color=&#039;green&#039;&amp;gt;input_file.HDF&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; - dmx [-sep] :&lt;br /&gt;
The option flag &amp;lt;font color=&#039;green&#039;&amp;gt;-dmx&amp;lt;/font&amp;gt; indicates that input data should be&lt;br /&gt;
demultiplexed from band interleaved by pixel to band sequential form&lt;br /&gt;
in &amp;lt;font color=&#039;green&#039;&amp;gt;input_file.dmx&amp;lt;/font&amp;gt;. If &amp;lt;font color=&#039;green&#039;&amp;gt;-dmx&amp;lt;/font&amp;gt; is followed by &amp;lt;font color=&#039;green&#039;&amp;gt;-sep&amp;lt;/font&amp;gt;,&lt;br /&gt;
the input data are demultiplexed into separate variable files called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;data_file.1&amp;lt;/font&amp;gt; \ldots &amp;lt;font color=&#039;green&#039;&amp;gt;data_file.n&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; - df :&lt;br /&gt;
To use this option, the input file (&amp;lt;font color=&#039;green&#039;&amp;gt;data_file.ext&amp;lt;/font&amp;gt;) must be a&lt;br /&gt;
binary demultiplexed (band sequential) file.  For each input&lt;br /&gt;
variable in the applicable FreeForm format description file, there&lt;br /&gt;
is a corresponding demultiplexed section in the output HDF file.&lt;br /&gt;
&lt;br /&gt;
; - md missing_data_file :&lt;br /&gt;
Option flag followed by the name of the file defining missing data&lt;br /&gt;
(data you want to exclude). Use this option only along with the&lt;br /&gt;
vdata (-vd) option. Each line in the missing data file has the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable_name lower_limit upper_limit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The precision of the upper and lower limits matches the precision of&lt;br /&gt;
the input data.&lt;br /&gt;
&lt;br /&gt;
; - dof HDF_file :&lt;br /&gt;
Option flag followed by the name of the output HDF file. If you do&lt;br /&gt;
not use the &amp;lt;font color=&#039;green&#039;&amp;gt;-dof&amp;lt;/font&amp;gt; option, the default output file name is&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;input_file.HDF&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
&lt;br /&gt;
You will use &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; to store &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; as an HDF file.&lt;br /&gt;
The HDF file will consist of two SDS&#039;s, one each for the two variables&lt;br /&gt;
latitude and longitude. Each SDS will have four rows and five columns.&lt;br /&gt;
&lt;br /&gt;
To convert &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to an HDF file, enter the following&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
makehdf latlon.dat -r 4 -c 5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; translates &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into HDF, processing&lt;br /&gt;
information is displayed on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1   Caches (1150 bytes) Processed: 800 bytes written to latlon.dmx&lt;br /&gt;
Writing latlon.HDF and calculating maxima and minima ...&lt;br /&gt;
&lt;br /&gt;
Variable latitude:&lt;br /&gt;
Minimum: -86.432712  Maximum 89.170904&lt;br /&gt;
Variable longitude:&lt;br /&gt;
Minimum: -176.161101  Maximum 165.066193&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output from &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; is an HDF file named &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.HDF&amp;lt;/font&amp;gt;&lt;br /&gt;
(by default). It contains the minimum and maximum values for the two&lt;br /&gt;
variables as well as the two SDS&#039;s.&lt;br /&gt;
&lt;br /&gt;
A temporary file named &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dmx&amp;lt;/font&amp;gt; was also created. It contains&lt;br /&gt;
the data from latlon.dat in demultiplexed form . The data was&lt;br /&gt;
converted from its original multiplexed form to enable &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt;&lt;br /&gt;
to write sections of data to SDS&#039;s.&lt;br /&gt;
&lt;br /&gt;
If you start with a demultiplexed file such as &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dmx&amp;lt;/font&amp;gt;, the&lt;br /&gt;
translation process is much quicker, particularly for large data&lt;br /&gt;
files. As an illustration, try this. Rename &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dmx&amp;lt;/font&amp;gt; to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; (renaming is necessary for &amp;lt;font color=&#039;green&#039;&amp;gt;makehdf&amp;lt;/font&amp;gt; to find the&lt;br /&gt;
format description file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default). Enter the&lt;br /&gt;
following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
makehdf latlon.bin -df -r 4 -c 5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output file again is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.HDF&amp;lt;/font&amp;gt;, but notice that no&lt;br /&gt;
demultiplexing was done.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; program translates files with headers and data into&lt;br /&gt;
separate header and data files or into HDF files. If the translation&lt;br /&gt;
is to separate header and data files, the header file can include&lt;br /&gt;
indexing information.&lt;br /&gt;
&lt;br /&gt;
The combination of header and data records in a file is often used for&lt;br /&gt;
point data sets that include a number of observations made at one or&lt;br /&gt;
more stations or locations in space. The header records contain&lt;br /&gt;
information about the stations or locations of the measurements. The&lt;br /&gt;
data records hold the observational data. A station record usually&lt;br /&gt;
indicates how many data records follow it. The structure of such a&lt;br /&gt;
file is similar to the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Header for Station 1&lt;br /&gt;
Observation 1 for Station 1&lt;br /&gt;
Observation 2 for Station 1&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
Observation N for Station 1&lt;br /&gt;
&lt;br /&gt;
Header for Station 2&lt;br /&gt;
Observation 1 for Station 2&lt;br /&gt;
Observation 2 for Station 2&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
Observation N for Station 2&lt;br /&gt;
&lt;br /&gt;
Header for Station 3&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Many applications have difficulty reading this sort of heterogeneous&lt;br /&gt;
data file. One solution is to split the data into two homogeneous&lt;br /&gt;
files, one containing the headers, the other containing the data. With&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt;, you can easily create the separate data and header&lt;br /&gt;
files. To use &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; for this purpose, the input and output&lt;br /&gt;
formats for the record headers and the data must be described in a&lt;br /&gt;
FreeForm format description file. To use &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; for&lt;br /&gt;
translating files to HDF, the input format must be described in a&lt;br /&gt;
FreeForm format description file. You should follow FreeForm naming&lt;br /&gt;
conventions for the data and format files. For details about FreeForm&lt;br /&gt;
conventions, see ([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
\proto{&amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; \var{input_file} [\var{output_data_file} &amp;gt; \var{output_header_file}]}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; \var{input_file}  :&lt;br /&gt;
Name of the file to be processed. Following FreeForm naming&lt;br /&gt;
conventions, the standard extensions for data files are &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
for ASCII format and &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; for binary.&lt;br /&gt;
&lt;br /&gt;
; \var{output_data_file}  :&lt;br /&gt;
Name of the output file into which data are transferred with the&lt;br /&gt;
format specified in the applicable FreeForm format description file.&lt;br /&gt;
The standard extensions are the same as for input files. If an&lt;br /&gt;
output file name is not specified, the default is standard output.&lt;br /&gt;
&lt;br /&gt;
; \var{output_header_file}  :&lt;br /&gt;
Name of the output file into which headers from the input file are&lt;br /&gt;
transferred with the format specified in the applicable FreeForm&lt;br /&gt;
format description file. If an output header file name is not&lt;br /&gt;
specified, the default is standard output.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Index Creation===&lt;br /&gt;
&lt;br /&gt;
You can use the two variables begin and extent (described below) in&lt;br /&gt;
the format description for the output record headers to indicate the&lt;br /&gt;
location and size of the data block associated with each record&lt;br /&gt;
header. If you then use &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt;, the header file that results&lt;br /&gt;
can be used as an index to the data file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;begin&amp;lt;/font&amp;gt; :&lt;br /&gt;
Indicates the offset to the beginning of the data associated with a&lt;br /&gt;
particular header. If the data is being translated to HDF, the units&lt;br /&gt;
are records; if not, the units are bytes.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;extent&amp;lt;/font&amp;gt; :&lt;br /&gt;
Indicates the number of records (HDF) or bytes (non-HDF) associated&lt;br /&gt;
with each header record.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
You will use &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; to extract the headers and data from a&lt;br /&gt;
rawinsonde (a device for gathering meteorological data) ASCII data&lt;br /&gt;
file named &amp;lt;font color=&#039;green&#039;&amp;gt;hara.dat&amp;lt;/font&amp;gt; (HARA = Historic Arctic Rawinsonde Archive)&lt;br /&gt;
and create two output files-&amp;lt;font color=&#039;green&#039;&amp;gt;23338.dat&amp;lt;/font&amp;gt; containing the ASCII data&lt;br /&gt;
and &amp;lt;font color=&#039;green&#039;&amp;gt;23338hdr.dat&amp;lt;/font&amp;gt; containing the ASCII headers. The format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;hara.fmt&amp;lt;/font&amp;gt; should contain the necessary format&lt;br /&gt;
descriptions.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;hara.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ASCII_input_record_header &amp;quot;ASCII Location Record input format&amp;quot;&lt;br /&gt;
WMO_station_ID_number 1 5 char 0&lt;br /&gt;
latitude 6 10 long 2&lt;br /&gt;
longitude_east 11 15 long 2&lt;br /&gt;
year 17 18 uchar 0&lt;br /&gt;
month 19 20 uchar 0&lt;br /&gt;
day 21 22 uchar 0&lt;br /&gt;
hour 23 24 uchar 0&lt;br /&gt;
flag_processing_1 28 28 char 0&lt;br /&gt;
flag_processing_2 29 29 char 0&lt;br /&gt;
flag_processing_3 30 30 char 0&lt;br /&gt;
station_type 31 31 char 0&lt;br /&gt;
sea_level_elev 32 36 long 0&lt;br /&gt;
instrument_type 37 38 uchar 0&lt;br /&gt;
number_of_observations 40 42 ushort 0&lt;br /&gt;
identification_code 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;Historical Arctic Rawinsonde Archive input format&amp;quot;&lt;br /&gt;
atmospheric_pressure 1 5 long 1&lt;br /&gt;
geopotential_height 7 11 long 0&lt;br /&gt;
temperature_deg 13 16 short 0&lt;br /&gt;
dewpoint_depression 18 20 short 0&lt;br /&gt;
wind_direction 22 24 short 0&lt;br /&gt;
wind_speed_m/s 26 28 short 0&lt;br /&gt;
flag_qg 30 30 char 0&lt;br /&gt;
flag_qg1 31 31 char 0&lt;br /&gt;
flag_qt 33 33 char 0&lt;br /&gt;
flag_qt1 34 34 char 0&lt;br /&gt;
flag_qd 36 36 char 0&lt;br /&gt;
flag_qd1 37 37 char 0&lt;br /&gt;
flag_qw 39 39 char 0&lt;br /&gt;
flag_qw1 40 40 char 0&lt;br /&gt;
flag_qp 42 42 char 0&lt;br /&gt;
flag_levck 43 43 char 0&lt;br /&gt;
&lt;br /&gt;
ASCII_output_record_header &amp;quot;ASCII Location Record output format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
ASCII_output_data &amp;quot;Historical Arctic Rawinsonde Archive output format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To &amp;quot;split&amp;quot; &amp;lt;font color=&#039;green&#039;&amp;gt;hara.dat&amp;lt;/font&amp;gt;, enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
splitdat hara.dat 23338.dat &amp;gt; 23338hdr.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data values from &amp;lt;font color=&#039;green&#039;&amp;gt;hara.dat&amp;lt;/font&amp;gt; are stored in &amp;lt;font color=&#039;green&#039;&amp;gt;23338.dat&amp;lt;/font&amp;gt; and&lt;br /&gt;
the headers in &amp;lt;font color=&#039;green&#039;&amp;gt;23338hdr.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Because the variables begin and extent were used in the header output&lt;br /&gt;
format in &amp;lt;font color=&#039;green&#039;&amp;gt;hara.fmt&amp;lt;/font&amp;gt; to indicate data offset and number of&lt;br /&gt;
records, &amp;lt;font color=&#039;green&#039;&amp;gt;23338hdr.dat&amp;lt;/font&amp;gt; has two columns of data showing offset and&lt;br /&gt;
extent. Thus, it can serve as an index into &amp;lt;font color=&#039;green&#039;&amp;gt;23338.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===HDF Translation===&lt;br /&gt;
&lt;br /&gt;
If output files are not specified on the &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; command line,&lt;br /&gt;
a file named &amp;lt;font color=&#039;green&#039;&amp;gt;input_file.HDF&amp;lt;/font&amp;gt; is created. It is hierarchically&lt;br /&gt;
named and organized as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
vgroup&lt;br /&gt;
&lt;br /&gt;
input_file_name&lt;br /&gt;
&lt;br /&gt;
/      \&lt;br /&gt;
&lt;br /&gt;
/        \&lt;br /&gt;
&lt;br /&gt;
vdata1       vdata2&lt;br /&gt;
&amp;quot;PointIndex&amp;quot;      &amp;quot;input_file_name&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;vdata1&amp;lt;/font&amp;gt; contains the record headers&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;vdata2&amp;lt;/font&amp;gt; contains the data&lt;br /&gt;
*If writing to a Vset (represented by a vgroup), both output&lt;br /&gt;
formats are converted to binary, if not binary already.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
To create the file &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt; from &amp;lt;font color=&#039;green&#039;&amp;gt;hara.dat&amp;lt;/font&amp;gt;, enter the&lt;br /&gt;
following abbreviated command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
splitdat hara.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output formats in &amp;lt;font color=&#039;green&#039;&amp;gt;hara.fmt&amp;lt;/font&amp;gt; are automatically converted to&lt;br /&gt;
binary, and subsequently the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;hara.dat&amp;lt;/font&amp;gt; are also&lt;br /&gt;
converted to binary for HDF storage.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; program is a versatile tool for extracting point&lt;br /&gt;
data  from HDF files containing scientific datasets and Vsets. The&lt;br /&gt;
extraction can be done into any binary or ASCII format described in a&lt;br /&gt;
FreeForm format description file. Before using &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; on an HDF&lt;br /&gt;
file, you should pack the file using the NCSA-developed HDF utility&lt;br /&gt;
hdfpack.&lt;br /&gt;
&lt;br /&gt;
You can use &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; to extract headers and data from an HDF file&lt;br /&gt;
into separate files or to extract just the data. It&#039;s a good idea to&lt;br /&gt;
define GeoVu keywords in an equivalence table to facilitate access to&lt;br /&gt;
HDF objects. For information about equivalence tables, see the GeoVu&lt;br /&gt;
Tools Reference Guide. The input and output formats must be described&lt;br /&gt;
in a FreeForm format description file. You should follow FreeForm&lt;br /&gt;
naming conventions for the data and format files. For details about&lt;br /&gt;
FreeForm conventions, see ([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
If a format description file is not specified on the command line, the&lt;br /&gt;
output format is taken by default from the FreeForm output format&lt;br /&gt;
annotation stored in the HDF file. If there is no annotation, a&lt;br /&gt;
default ASCII output format is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;An equivalence table takes precedence over&lt;br /&gt;
everything. (vdata=1963, SDS=702)&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have not specified an HDF object in an equivalence table,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; uses the following sequence to determine the appropriate&lt;br /&gt;
source for output:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Output the first vdata with class name Data.&lt;br /&gt;
#Output the largest vdata.&lt;br /&gt;
#Output the first SDS.&lt;br /&gt;
&lt;br /&gt;
If no vdatas exist in the file, but an SDS is found, it is extracted&lt;br /&gt;
and a default ASCII output format is used.&lt;br /&gt;
&lt;br /&gt;
===Extracting Headers and Data===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; command takes the following form when you want to&lt;br /&gt;
extract headers and data from HDF files into separate files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pntshow input_HDF_file [-h [output_header_file]] [-hof output_header_format_file]&lt;br /&gt;
&lt;br /&gt;
    [-hof output_header_format_file] [-d [output_data_file]] [-dof output_data_format_file]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; \var{input_HDF_file} :&lt;br /&gt;
Name of the input HDF file, which has been packed using&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;hdfpack&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; \hdfh :&lt;br /&gt;
Option flag followed optionally by the name of the file designated&lt;br /&gt;
to contain the record headers currently stored in a vdata with a&lt;br /&gt;
class name of Index. If an output header file name is not specified,&lt;br /&gt;
the default is standard output.&lt;br /&gt;
&lt;br /&gt;
; \hdfhof :&lt;br /&gt;
Option flag followed by the name of the FreeForm format file that&lt;br /&gt;
describes the format for the headers extracted to standard output or&lt;br /&gt;
output_header_file.&lt;br /&gt;
&lt;br /&gt;
; \hdfd :&lt;br /&gt;
Option flag followed optionally by the name of the file designated&lt;br /&gt;
to contain the data currently stored in a vdata with a class name of&lt;br /&gt;
Data. If an output file name is not specified, the default is&lt;br /&gt;
standard output.&lt;br /&gt;
&lt;br /&gt;
; \hdfdof :&lt;br /&gt;
Option flag followed by the name of the FreeForm format file that&lt;br /&gt;
describes the format for data extracted to standard output or&lt;br /&gt;
\var{output_data_file}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
You will extract data and headers from &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt; (created by&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; in a previous example). This file contains two vdatas:&lt;br /&gt;
one has the class name Data and the other has the class name Index.&lt;br /&gt;
Because this file is extremely small, no appending links were created&lt;br /&gt;
in the file, so there is no need to pack the file before using&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt;, though you can if you wish.&lt;br /&gt;
&lt;br /&gt;
To extract data and headers from &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt;, enter the following&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pntshow hara.HDF -d haradata.dat -h harahdrs.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data from the vdata designated as Data in &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt; are now&lt;br /&gt;
stored in &amp;lt;font color=&#039;green&#039;&amp;gt;haradata.dat&amp;lt;/font&amp;gt;. The data are in their original format&lt;br /&gt;
because the original output format was stored by &amp;lt;font color=&#039;green&#039;&amp;gt;splitdat&amp;lt;/font&amp;gt; in the&lt;br /&gt;
HDF file. The header data from the vdata designated as Index in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt; are now stored in &amp;lt;font color=&#039;green&#039;&amp;gt;harahdrs.dat&amp;lt;/font&amp;gt;. In addition to&lt;br /&gt;
the original header data, the variables begin and extent have also&lt;br /&gt;
been extracted to &amp;lt;font color=&#039;green&#039;&amp;gt;harahdrs.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Extracting Data Only===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; command takes the following form when you want to&lt;br /&gt;
extract just the data from an HDF file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pntshow input_HDF_file [-of default_output_format_file]&lt;br /&gt;
&lt;br /&gt;
    [&amp;gt; output_file]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; \var{input_HDF_file} :&lt;br /&gt;
Name of the input HDF file, which has been packed using &amp;lt;font color=&#039;green&#039;&amp;gt;hdfpack&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; \hdfof :&lt;br /&gt;
Option flag followed by the name of the FreeForm format file that&lt;br /&gt;
describes the format for data extracted to standard output or&lt;br /&gt;
\var{output_file.}&lt;br /&gt;
&lt;br /&gt;
; \var{output_file} :&lt;br /&gt;
Name of the output file into which data is transferred. If an output&lt;br /&gt;
file name is not specified, the default is standard output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Examples====&lt;br /&gt;
&lt;br /&gt;
You can use &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; to extract designated variables from an HDF&lt;br /&gt;
file. In this example, you will extract temperature and pressure&lt;br /&gt;
values from &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt; to an ASCII format. First, the following&lt;br /&gt;
format description file must exist.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;haradata.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ASCII_output_data &amp;quot;ASCII format for pressure, temp&amp;quot;&lt;br /&gt;
atmospheric_pressure 1 10 long 1&lt;br /&gt;
temperature_deg 15 25 float 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create a file named &amp;lt;font color=&#039;green&#039;&amp;gt;temppres.dat&amp;lt;/font&amp;gt; containing only the&lt;br /&gt;
temperature and pressure variables, enter either of the following&lt;br /&gt;
commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pntshow hara.HDF -of haradata.fmt &amp;gt; temppres.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pntshow hara.HDF -d temppres.dat -dof haradata.fmt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use the first command, &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; searches &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt;&lt;br /&gt;
for a vdata named Data. Since &amp;lt;font color=&#039;green&#039;&amp;gt;hara.HDF&amp;lt;/font&amp;gt; contains only one vdata&lt;br /&gt;
named &amp;lt;font color=&#039;green&#039;&amp;gt;Data&amp;lt;/font&amp;gt;, this vdata is extracted by default with the format&lt;br /&gt;
specified in &amp;lt;font color=&#039;green&#039;&amp;gt;haradata.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The results are the same if you use the second command. Now, try&lt;br /&gt;
running &amp;lt;font color=&#039;green&#039;&amp;gt;pntshow&amp;lt;/font&amp;gt; on the previously created file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.HDF&amp;lt;/font&amp;gt;,&lt;br /&gt;
which contains two SDS&#039;s. Use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pntshow latlon.HDF &amp;gt; latlon.SDS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.SDS&amp;lt;/font&amp;gt; file now contains the latitude and longitude&lt;br /&gt;
values extracted from &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.HDF&amp;lt;/font&amp;gt;. They have the default ASCII&lt;br /&gt;
output format. You could have used the -of option to specify an output&lt;br /&gt;
format included in a FreeForm format description file.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/datachk&amp;diff=2038</id>
		<title>Wiki Testing/datachk</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/datachk&amp;diff=2038"/>
		<updated>2008-02-06T17:22:31Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Variable Summaries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Data Checking=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based utility program &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; creates variable&lt;br /&gt;
summary files, lists of maximum and minimum values, and summaries of&lt;br /&gt;
processing activity. You can use this information to check data&lt;br /&gt;
quality and to examine the distribution of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Generating the Summaries==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A variable summary file (or list file), which contains histogram&lt;br /&gt;
information showing the variable&#039;s distribution in the data file, is&lt;br /&gt;
created for each variable (or designated variables) in the specified&lt;br /&gt;
data file. You can optionally specify an output file in which a&lt;br /&gt;
summary of processing activity is saved.&lt;br /&gt;
&lt;br /&gt;
Variable summaries (list files) can be helpful for performing quality&lt;br /&gt;
control checks of data. For example, you could run &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; on&lt;br /&gt;
an ASCII file, convert the file to binary, and then run &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;&lt;br /&gt;
on the binary file. The output from &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; should be the same&lt;br /&gt;
for both the ASCII and binary files. You can also use variable&lt;br /&gt;
summaries to look at the data distribution in a data set before&lt;br /&gt;
extracting data.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    checkvar input_file [-f format_file] [-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
    [-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file]  [-p precision] [-m maxbins] [-md missing_data_flag] [-mm] [-o processing_summary]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; program needs to find only an input format&lt;br /&gt;
description. Output format descriptions will be ignored. If conversion&lt;br /&gt;
variables are included in input or output formats, no conversion is&lt;br /&gt;
performed when you run &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;, since it ignores output&lt;br /&gt;
formats.&lt;br /&gt;
&lt;br /&gt;
For descriptions of the standard arguments (first eleven arguments&lt;br /&gt;
above), see ([[Wiki_Testing/convs|Section 8.6]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -p precision:&lt;br /&gt;
Option flag followed by the number of decimal places. The number&lt;br /&gt;
represents the power of 10 that data is multiplied by prior to&lt;br /&gt;
binning. A value of 0 bins on one&#039;s, 1 on tenth&#039;s, and so on. This&lt;br /&gt;
option allows an adjustment of the resolution of the &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;&lt;br /&gt;
output.&lt;br /&gt;
The default is 0; maximum is 5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE:If you use the &amp;lt;font color=&#039;green&#039;&amp;gt;-p&amp;lt;/font&amp;gt; option on the command line, the precision set in the relevant format file is overridden. The precision in&lt;br /&gt;
the format file serves as the default. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -m maxbins:&lt;br /&gt;
Option flag followed by the approximate maximum number of bins&lt;br /&gt;
desired in &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; output. The &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; program keeps track of the number of bins filled as the data is processed. The&lt;br /&gt;
smaller the number of bins, the faster &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; runs. By&lt;br /&gt;
keeping the number of bins small, you can check the gross aspects of&lt;br /&gt;
data distribution rather than the details. The number of bins is adjusted dynamically as &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; runs depending on the distribution of data in the input file. If the number of filled bins becomes &amp;gt; 1.5 * maxbins, the width of the bins is doubled to keep the total number near the desired maximum. The default is 100 bins; minimum is 6. Must be &amp;lt; 10,000.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The precision (-p) and maxbins (-m) options have no effect on&lt;br /&gt;
character variables. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; -md missing_data_flag:&lt;br /&gt;
Option flag followed by a flag value that &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; should&lt;br /&gt;
ignore across all variables in creating histogram data. Missing data flags are used in a data file to indicate missing or meaningless data. If you want &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; to ignore more than one value, use the query (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt;) option in conjunction with the variable file (&amp;lt;font color=&#039;green&#039;&amp;gt;-v&amp;lt;/font&amp;gt;) option.&lt;br /&gt;
&lt;br /&gt;
; -mm :&lt;br /&gt;
Option flag indicating that only the maximum and minimum values of variables are calculated and displayed in the processing summary. Variable summary files are not created.&lt;br /&gt;
&lt;br /&gt;
; -o &#039;&#039;processing_summary&#039;&#039; :&lt;br /&gt;
Option flag followed by the name of the file in which summary information displayed during processing is stored.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You will use &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; with a precision of 3 to create a&lt;br /&gt;
processing summary file and summary files for the two variables&lt;br /&gt;
latitude and longitude in the file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create the summary files, enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
checkvar latlon.dat -p 3 -o latlon.sum&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A summary of processing information and the maximum and minimum for&lt;br /&gt;
each variable are displayed on the screen. The following three files&lt;br /&gt;
are created:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt; recaps processing activity, maximums and minimums&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; shows distribution of the latitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt; shows distribution of the longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Interpreting the Summaries==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing and variable summary files output by &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;&lt;br /&gt;
from the example in the previous section are shown and discussed&lt;br /&gt;
below.&lt;br /&gt;
&lt;br /&gt;
===Processing Summary===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you specify an output file on the command line, it stores the&lt;br /&gt;
information that is displayed on the screen during processing. The&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt; was specified as the output file in the example&lt;br /&gt;
above.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Input file : latlon.dat&lt;br /&gt;
Requested precision = 3, Approximate number of sorting bins = 100&lt;br /&gt;
&lt;br /&gt;
Input data format       (latlon.fmt)&lt;br /&gt;
ASCII_input_data       &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
The format contains 2 variables; length is 24.&lt;br /&gt;
&lt;br /&gt;
Output data format       (latlon.fmt)&lt;br /&gt;
binary_output_data       &amp;quot;binary format&amp;quot;&lt;br /&gt;
The format contains 2 variables; length is 16.&lt;br /&gt;
&lt;br /&gt;
Histogram data precision: 3, Number of sorting bins: 20&lt;br /&gt;
latitude: 20 values read&lt;br /&gt;
minimum: -83.223548 found at record  5&lt;br /&gt;
maximum:  77.883119 found at record 12&lt;br /&gt;
Summary file: latitude.lst&lt;br /&gt;
&lt;br /&gt;
Histogram data precision: 3, Number of sorting bins: 20&lt;br /&gt;
longitude: 20 values read&lt;br /&gt;
minimum: -176.161101 found at record 1&lt;br /&gt;
maximum:  149.408117 found at record 4&lt;br /&gt;
Summary file: longitude.lst.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing summary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt; first shows the name of&lt;br /&gt;
the input data file (&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;). If you specified precision and&lt;br /&gt;
a maximum number of bins on the command line, those values are given&lt;br /&gt;
as Requested precision, in this case 3, and Approximate number of&lt;br /&gt;
sorting bins, in this case the default value of 100. If precision is&lt;br /&gt;
not specified, No requested precision is shown.&lt;br /&gt;
&lt;br /&gt;
A summary of each format shows the type of format (in this case, Input&lt;br /&gt;
data format and Output data format) and the name of the format file&lt;br /&gt;
containing the format descriptions (&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;), whether&lt;br /&gt;
specified on the command line or located through the default search&lt;br /&gt;
sequence (as detailed in chapter 4). In this case, it was located by&lt;br /&gt;
default. Since &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; only needs an input format description,&lt;br /&gt;
it ignores output format descriptions. Next, you see the format&lt;br /&gt;
descriptor as resolved by FreeForm ND (e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt;)&lt;br /&gt;
and the format title (e.g., &amp;quot;ASCII format&amp;quot;). Then the number of&lt;br /&gt;
variables in a record and total record length are given; for ASCII,&lt;br /&gt;
record length includes the end-of-line character (1 byte for Unix).&lt;br /&gt;
&lt;br /&gt;
A section for each variable processed by &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; indicates the&lt;br /&gt;
histogram precision and actual number of sorting bins. Under some&lt;br /&gt;
circumstances, the precision of values in the histogram file may be&lt;br /&gt;
different than the precision you specified on the command line. The&lt;br /&gt;
default value for precision, if none is specified on the command line,&lt;br /&gt;
is the precision specified in the relevant format description file or&lt;br /&gt;
5, whichever is smaller. The second line shows the name of the&lt;br /&gt;
variable (latitude, longitude) and the number of values in the data&lt;br /&gt;
file for the variable (20 for both latitude and longitude).&lt;br /&gt;
&lt;br /&gt;
The minimum and maximum values for the variable are shown next&lt;br /&gt;
(-83.223548 is the minimum and 77.883119 is the maximum value for&lt;br /&gt;
latitude). The maximum and minimum values are given here with a&lt;br /&gt;
precision of 6, which is the precision specified in the format&lt;br /&gt;
description file. The locations of the maximum and minimum values in&lt;br /&gt;
the input file are indicated. (-83.223548 is the fifth latitude value&lt;br /&gt;
in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; and 77.883119 is the twelfth). Finally, the name&lt;br /&gt;
of the histogram data (or variable summary) file generated for each&lt;br /&gt;
variable is given (&amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
===Variable Summaries===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The name of each variable summary file (list file) output by&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; is of the form &amp;lt;font color=&#039;green&#039;&amp;gt;variable.lst&amp;lt;/font&amp;gt; for numeric variables and &amp;lt;font color=&#039;green&#039;&amp;gt;variable.cst&amp;lt;/font&amp;gt; for character variables. The data in *&amp;lt;font color=&#039;green&#039;&amp;gt;.lst&amp;lt;/font&amp;gt;, and *&amp;lt;font color=&#039;green&#039;&amp;gt;.cst&amp;lt;/font&amp;gt; files can be loaded into histogram plot programs for graphical representation. (You must be familiar enough&lt;br /&gt;
with your program of choice to manipulate the data as necessary in order to achieve the desired result.) In Unix, there is no need to abbreviate the base file name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: If you use the -v option, the order of variables in var_file has&lt;br /&gt;
no effect on the numbering of base file names of the variable summary files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The two example variable summary files, &amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt;, are shown next.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| &lt;br /&gt;
|&lt;br /&gt;
{| border=&amp;quot;2&amp;quot;&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| -83.224  1 &lt;br /&gt;
|-&lt;br /&gt;
| -69.274  1&lt;br /&gt;
|-&lt;br /&gt;
| -65.865  1&lt;br /&gt;
|-&lt;br /&gt;
| -63.212  1&lt;br /&gt;
|-&lt;br /&gt;
| -63.003  1&lt;br /&gt;
|-&lt;br /&gt;
| -47.304  1&lt;br /&gt;
|-&lt;br /&gt;
| -34.578  1&lt;br /&gt;
|-&lt;br /&gt;
| -28.287  1&lt;br /&gt;
|-&lt;br /&gt;
| -12.967  1&lt;br /&gt;
|-&lt;br /&gt;
| -0.929  1&lt;br /&gt;
|-&lt;br /&gt;
| 11.624  1&lt;br /&gt;
|-&lt;br /&gt;
| 12.588  1&lt;br /&gt;
|-&lt;br /&gt;
| 27.331  1&lt;br /&gt;
|-&lt;br /&gt;
| 29.918  1&lt;br /&gt;
|-&lt;br /&gt;
| 35.086  1&lt;br /&gt;
|-&lt;br /&gt;
| 35.130  1&lt;br /&gt;
|-&lt;br /&gt;
| 38.818  1&lt;br /&gt;
|-&lt;br /&gt;
| 54.118  1&lt;br /&gt;
|-&lt;br /&gt;
| 77.652  1&lt;br /&gt;
|-&lt;br /&gt;
| 77.883  1&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
||&lt;br /&gt;
{| border=&amp;quot;2&amp;quot;&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| -176.162  1&lt;br /&gt;
|-&lt;br /&gt;
| -155.234  1&lt;br /&gt;
|-&lt;br /&gt;
| -153.544  1&lt;br /&gt;
|-&lt;br /&gt;
| -136.941  1&lt;br /&gt;
|-&lt;br /&gt;
| -113.661  1&lt;br /&gt;
|-&lt;br /&gt;
| -79.178  1&lt;br /&gt;
|-&lt;br /&gt;
| -77.506  1&lt;br /&gt;
|-&lt;br /&gt;
| -55.442  1&lt;br /&gt;
|-&lt;br /&gt;
| -21.644  1&lt;br /&gt;
|-&lt;br /&gt;
| 0.777  1&lt;br /&gt;
|-&lt;br /&gt;
| 30.172  1&lt;br /&gt;
|-&lt;br /&gt;
| 35.591  1&lt;br /&gt;
|-&lt;br /&gt;
| 36.356  1&lt;br /&gt;
|-&lt;br /&gt;
| 38.875  1&lt;br /&gt;
|-&lt;br /&gt;
| 55.319  1&lt;br /&gt;
|-&lt;br /&gt;
| 62.152  1&lt;br /&gt;
|-&lt;br /&gt;
| 91.411  1&lt;br /&gt;
|-&lt;br /&gt;
| 134.124  1&lt;br /&gt;
|-&lt;br /&gt;
| 144.804  1&lt;br /&gt;
|-&lt;br /&gt;
| 149.408  1&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable summary files consist of two columns. The first indicates&lt;br /&gt;
boundary values for data bins and the second gives the number of data&lt;br /&gt;
points in each bin. Because a precision of 3 was specified in the&lt;br /&gt;
example, each boundary value has three decimal places. The boundary&lt;br /&gt;
values are determined dynamically by &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; and often do not&lt;br /&gt;
correspond to data values in the input file, even if the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; and data file precisions are the same.&lt;br /&gt;
&lt;br /&gt;
The first data bin in &amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; contains data points in the&lt;br /&gt;
range -83.224 (inclusive) to -69.274 (exclusive); neither boundary&lt;br /&gt;
number exists in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. The first bin has one data point,&lt;br /&gt;
-83.223548. The fourth data bin contains latitude values from -63.212&lt;br /&gt;
(inclusive) to -63.003 (exclusive), again with neither boundary value&lt;br /&gt;
occurring in the data file. The data point in the fourth bin is&lt;br /&gt;
-63.211962.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/datachk&amp;diff=2037</id>
		<title>Wiki Testing/datachk</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/datachk&amp;diff=2037"/>
		<updated>2008-02-06T17:20:33Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Data Checking=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based utility program &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; creates variable&lt;br /&gt;
summary files, lists of maximum and minimum values, and summaries of&lt;br /&gt;
processing activity. You can use this information to check data&lt;br /&gt;
quality and to examine the distribution of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Generating the Summaries==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A variable summary file (or list file), which contains histogram&lt;br /&gt;
information showing the variable&#039;s distribution in the data file, is&lt;br /&gt;
created for each variable (or designated variables) in the specified&lt;br /&gt;
data file. You can optionally specify an output file in which a&lt;br /&gt;
summary of processing activity is saved.&lt;br /&gt;
&lt;br /&gt;
Variable summaries (list files) can be helpful for performing quality&lt;br /&gt;
control checks of data. For example, you could run &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; on&lt;br /&gt;
an ASCII file, convert the file to binary, and then run &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;&lt;br /&gt;
on the binary file. The output from &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; should be the same&lt;br /&gt;
for both the ASCII and binary files. You can also use variable&lt;br /&gt;
summaries to look at the data distribution in a data set before&lt;br /&gt;
extracting data.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    checkvar input_file [-f format_file] [-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
    [-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file]  [-p precision] [-m maxbins] [-md missing_data_flag] [-mm] [-o processing_summary]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; program needs to find only an input format&lt;br /&gt;
description. Output format descriptions will be ignored. If conversion&lt;br /&gt;
variables are included in input or output formats, no conversion is&lt;br /&gt;
performed when you run &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;, since it ignores output&lt;br /&gt;
formats.&lt;br /&gt;
&lt;br /&gt;
For descriptions of the standard arguments (first eleven arguments&lt;br /&gt;
above), see ([[Wiki_Testing/convs|Section 8.6]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -p precision:&lt;br /&gt;
Option flag followed by the number of decimal places. The number&lt;br /&gt;
represents the power of 10 that data is multiplied by prior to&lt;br /&gt;
binning. A value of 0 bins on one&#039;s, 1 on tenth&#039;s, and so on. This&lt;br /&gt;
option allows an adjustment of the resolution of the &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;&lt;br /&gt;
output.&lt;br /&gt;
The default is 0; maximum is 5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE:If you use the &amp;lt;font color=&#039;green&#039;&amp;gt;-p&amp;lt;/font&amp;gt; option on the command line, the precision set in the relevant format file is overridden. The precision in&lt;br /&gt;
the format file serves as the default. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -m maxbins:&lt;br /&gt;
Option flag followed by the approximate maximum number of bins&lt;br /&gt;
desired in &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; output. The &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; program keeps track of the number of bins filled as the data is processed. The&lt;br /&gt;
smaller the number of bins, the faster &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; runs. By&lt;br /&gt;
keeping the number of bins small, you can check the gross aspects of&lt;br /&gt;
data distribution rather than the details. The number of bins is adjusted dynamically as &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; runs depending on the distribution of data in the input file. If the number of filled bins becomes &amp;gt; 1.5 * maxbins, the width of the bins is doubled to keep the total number near the desired maximum. The default is 100 bins; minimum is 6. Must be &amp;lt; 10,000.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The precision (-p) and maxbins (-m) options have no effect on&lt;br /&gt;
character variables. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; -md missing_data_flag:&lt;br /&gt;
Option flag followed by a flag value that &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; should&lt;br /&gt;
ignore across all variables in creating histogram data. Missing data flags are used in a data file to indicate missing or meaningless data. If you want &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; to ignore more than one value, use the query (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt;) option in conjunction with the variable file (&amp;lt;font color=&#039;green&#039;&amp;gt;-v&amp;lt;/font&amp;gt;) option.&lt;br /&gt;
&lt;br /&gt;
; -mm :&lt;br /&gt;
Option flag indicating that only the maximum and minimum values of variables are calculated and displayed in the processing summary. Variable summary files are not created.&lt;br /&gt;
&lt;br /&gt;
; -o &#039;&#039;processing_summary&#039;&#039; :&lt;br /&gt;
Option flag followed by the name of the file in which summary information displayed during processing is stored.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You will use &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; with a precision of 3 to create a&lt;br /&gt;
processing summary file and summary files for the two variables&lt;br /&gt;
latitude and longitude in the file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create the summary files, enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
checkvar latlon.dat -p 3 -o latlon.sum&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A summary of processing information and the maximum and minimum for&lt;br /&gt;
each variable are displayed on the screen. The following three files&lt;br /&gt;
are created:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt; recaps processing activity, maximums and minimums&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; shows distribution of the latitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt; shows distribution of the longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Interpreting the Summaries==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing and variable summary files output by &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;&lt;br /&gt;
from the example in the previous section are shown and discussed&lt;br /&gt;
below.&lt;br /&gt;
&lt;br /&gt;
===Processing Summary===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you specify an output file on the command line, it stores the&lt;br /&gt;
information that is displayed on the screen during processing. The&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt; was specified as the output file in the example&lt;br /&gt;
above.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Input file : latlon.dat&lt;br /&gt;
Requested precision = 3, Approximate number of sorting bins = 100&lt;br /&gt;
&lt;br /&gt;
Input data format       (latlon.fmt)&lt;br /&gt;
ASCII_input_data       &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
The format contains 2 variables; length is 24.&lt;br /&gt;
&lt;br /&gt;
Output data format       (latlon.fmt)&lt;br /&gt;
binary_output_data       &amp;quot;binary format&amp;quot;&lt;br /&gt;
The format contains 2 variables; length is 16.&lt;br /&gt;
&lt;br /&gt;
Histogram data precision: 3, Number of sorting bins: 20&lt;br /&gt;
latitude: 20 values read&lt;br /&gt;
minimum: -83.223548 found at record  5&lt;br /&gt;
maximum:  77.883119 found at record 12&lt;br /&gt;
Summary file: latitude.lst&lt;br /&gt;
&lt;br /&gt;
Histogram data precision: 3, Number of sorting bins: 20&lt;br /&gt;
longitude: 20 values read&lt;br /&gt;
minimum: -176.161101 found at record 1&lt;br /&gt;
maximum:  149.408117 found at record 4&lt;br /&gt;
Summary file: longitude.lst.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing summary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt; first shows the name of&lt;br /&gt;
the input data file (&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;). If you specified precision and&lt;br /&gt;
a maximum number of bins on the command line, those values are given&lt;br /&gt;
as Requested precision, in this case 3, and Approximate number of&lt;br /&gt;
sorting bins, in this case the default value of 100. If precision is&lt;br /&gt;
not specified, No requested precision is shown.&lt;br /&gt;
&lt;br /&gt;
A summary of each format shows the type of format (in this case, Input&lt;br /&gt;
data format and Output data format) and the name of the format file&lt;br /&gt;
containing the format descriptions (&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;), whether&lt;br /&gt;
specified on the command line or located through the default search&lt;br /&gt;
sequence (as detailed in chapter 4). In this case, it was located by&lt;br /&gt;
default. Since &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; only needs an input format description,&lt;br /&gt;
it ignores output format descriptions. Next, you see the format&lt;br /&gt;
descriptor as resolved by FreeForm ND (e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt;)&lt;br /&gt;
and the format title (e.g., &amp;quot;ASCII format&amp;quot;). Then the number of&lt;br /&gt;
variables in a record and total record length are given; for ASCII,&lt;br /&gt;
record length includes the end-of-line character (1 byte for Unix).&lt;br /&gt;
&lt;br /&gt;
A section for each variable processed by &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; indicates the&lt;br /&gt;
histogram precision and actual number of sorting bins. Under some&lt;br /&gt;
circumstances, the precision of values in the histogram file may be&lt;br /&gt;
different than the precision you specified on the command line. The&lt;br /&gt;
default value for precision, if none is specified on the command line,&lt;br /&gt;
is the precision specified in the relevant format description file or&lt;br /&gt;
5, whichever is smaller. The second line shows the name of the&lt;br /&gt;
variable (latitude, longitude) and the number of values in the data&lt;br /&gt;
file for the variable (20 for both latitude and longitude).&lt;br /&gt;
&lt;br /&gt;
The minimum and maximum values for the variable are shown next&lt;br /&gt;
(-83.223548 is the minimum and 77.883119 is the maximum value for&lt;br /&gt;
latitude). The maximum and minimum values are given here with a&lt;br /&gt;
precision of 6, which is the precision specified in the format&lt;br /&gt;
description file. The locations of the maximum and minimum values in&lt;br /&gt;
the input file are indicated. (-83.223548 is the fifth latitude value&lt;br /&gt;
in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; and 77.883119 is the twelfth). Finally, the name&lt;br /&gt;
of the histogram data (or variable summary) file generated for each&lt;br /&gt;
variable is given (&amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
===Variable Summaries===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The name of each variable summary file (list file) output by&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; is of the form &amp;lt;font color=&#039;green&#039;&amp;gt;variable.lst&amp;lt;/font&amp;gt; for numeric variables&lt;br /&gt;
and &amp;lt;font color=&#039;green&#039;&amp;gt;variable.cst&amp;lt;/font&amp;gt; for character variables. The data in&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;.lst&amp;lt;/font&amp;gt;, and *&amp;lt;font color=&#039;green&#039;&amp;gt;.cst&amp;lt;/font&amp;gt; files can be loaded into histogram plot&lt;br /&gt;
programs for graphical representation. (You must be familiar enough&lt;br /&gt;
with your program of choice to manipulate the data as necessary in&lt;br /&gt;
order to achieve the desired result.) In Unix, there is no need to&lt;br /&gt;
abbreviate the base file name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;If you use the -v option, the order of variables in var_file has&lt;br /&gt;
no effect on the numbering of base file names of the variable&lt;br /&gt;
summary files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two example variable summary files, &amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt;, are shown next.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| &lt;br /&gt;
|&lt;br /&gt;
{| border=&amp;quot;2&amp;quot;&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| -83.224  1 &lt;br /&gt;
|-&lt;br /&gt;
| -69.274  1&lt;br /&gt;
|-&lt;br /&gt;
| -65.865  1&lt;br /&gt;
|-&lt;br /&gt;
| -63.212  1&lt;br /&gt;
|-&lt;br /&gt;
| -63.003  1&lt;br /&gt;
|-&lt;br /&gt;
| -47.304  1&lt;br /&gt;
|-&lt;br /&gt;
| -34.578  1&lt;br /&gt;
|-&lt;br /&gt;
| -28.287  1&lt;br /&gt;
|-&lt;br /&gt;
| -12.967  1&lt;br /&gt;
|-&lt;br /&gt;
| -0.929  1&lt;br /&gt;
|-&lt;br /&gt;
| 11.624  1&lt;br /&gt;
|-&lt;br /&gt;
| 12.588  1&lt;br /&gt;
|-&lt;br /&gt;
| 27.331  1&lt;br /&gt;
|-&lt;br /&gt;
| 29.918  1&lt;br /&gt;
|-&lt;br /&gt;
| 35.086  1&lt;br /&gt;
|-&lt;br /&gt;
| 35.130  1&lt;br /&gt;
|-&lt;br /&gt;
| 38.818  1&lt;br /&gt;
|-&lt;br /&gt;
| 54.118  1&lt;br /&gt;
|-&lt;br /&gt;
| 77.652  1&lt;br /&gt;
|-&lt;br /&gt;
| 77.883  1&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
||&lt;br /&gt;
{| border=&amp;quot;2&amp;quot;&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| -176.162  1&lt;br /&gt;
|-&lt;br /&gt;
| -155.234  1&lt;br /&gt;
|-&lt;br /&gt;
| -153.544  1&lt;br /&gt;
|-&lt;br /&gt;
| -136.941  1&lt;br /&gt;
|-&lt;br /&gt;
| -113.661  1&lt;br /&gt;
|-&lt;br /&gt;
| -79.178  1&lt;br /&gt;
|-&lt;br /&gt;
| -77.506  1&lt;br /&gt;
|-&lt;br /&gt;
| -55.442  1&lt;br /&gt;
|-&lt;br /&gt;
| -21.644  1&lt;br /&gt;
|-&lt;br /&gt;
| 0.777  1&lt;br /&gt;
|-&lt;br /&gt;
| 30.172  1&lt;br /&gt;
|-&lt;br /&gt;
| 35.591  1&lt;br /&gt;
|-&lt;br /&gt;
| 36.356  1&lt;br /&gt;
|-&lt;br /&gt;
| 38.875  1&lt;br /&gt;
|-&lt;br /&gt;
| 55.319  1&lt;br /&gt;
|-&lt;br /&gt;
| 62.152  1&lt;br /&gt;
|-&lt;br /&gt;
| 91.411  1&lt;br /&gt;
|-&lt;br /&gt;
| 134.124  1&lt;br /&gt;
|-&lt;br /&gt;
| 144.804  1&lt;br /&gt;
|-&lt;br /&gt;
| 149.408  1&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The variable summary files consist of two columns. The first indicates&lt;br /&gt;
boundary values for data bins and the second gives the number of data&lt;br /&gt;
points in each bin. Because a precision of 3 was specified in the&lt;br /&gt;
example, each boundary value has three decimal places. The boundary&lt;br /&gt;
values are determined dynamically by &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; and often do not&lt;br /&gt;
correspond to data values in the input file, even if the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; and data file precisions are the same.&lt;br /&gt;
&lt;br /&gt;
The first data bin in &amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; contains data points in the&lt;br /&gt;
range -83.224 (inclusive) to -69.274 (exclusive); neither boundary&lt;br /&gt;
number exists in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. The first bin has one data point,&lt;br /&gt;
-83.223548. The fourth data bin contains latitude values from -63.212&lt;br /&gt;
(inclusive) to -63.003 (exclusive), again with neither boundary value&lt;br /&gt;
occurring in the data file. The data point in the fourth bin is&lt;br /&gt;
-63.211962.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/datachk&amp;diff=2036</id>
		<title>Wiki Testing/datachk</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/datachk&amp;diff=2036"/>
		<updated>2008-02-06T17:20:04Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Generating the Summaries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Data Checking=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based utility program &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; creates variable&lt;br /&gt;
summary files, lists of maximum and minimum values, and summaries of&lt;br /&gt;
processing activity. You can use this information to check data&lt;br /&gt;
quality and to examine the distribution of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Generating the Summaries==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A variable summary file (or list file), which contains histogram&lt;br /&gt;
information showing the variable&#039;s distribution in the data file, is&lt;br /&gt;
created for each variable (or designated variables) in the specified&lt;br /&gt;
data file. You can optionally specify an output file in which a&lt;br /&gt;
summary of processing activity is saved.&lt;br /&gt;
&lt;br /&gt;
Variable summaries (list files) can be helpful for performing quality&lt;br /&gt;
control checks of data. For example, you could run &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; on&lt;br /&gt;
an ASCII file, convert the file to binary, and then run &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;&lt;br /&gt;
on the binary file. The output from &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; should be the same&lt;br /&gt;
for both the ASCII and binary files. You can also use variable&lt;br /&gt;
summaries to look at the data distribution in a data set before&lt;br /&gt;
extracting data.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    checkvar input_file [-f format_file] [-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
    [-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file]  [-p precision] [-m maxbins] [-md missing_data_flag] [-mm] [-o processing_summary]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; program needs to find only an input format&lt;br /&gt;
description. Output format descriptions will be ignored. If conversion&lt;br /&gt;
variables are included in input or output formats, no conversion is&lt;br /&gt;
performed when you run &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;, since it ignores output&lt;br /&gt;
formats.&lt;br /&gt;
&lt;br /&gt;
For descriptions of the standard arguments (first eleven arguments&lt;br /&gt;
above), see ([[Wiki_Testing/convs|Section 8.6]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -p precision:&lt;br /&gt;
Option flag followed by the number of decimal places. The number&lt;br /&gt;
represents the power of 10 that data is multiplied by prior to&lt;br /&gt;
binning. A value of 0 bins on one&#039;s, 1 on tenth&#039;s, and so on. This&lt;br /&gt;
option allows an adjustment of the resolution of the &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;&lt;br /&gt;
output.&lt;br /&gt;
The default is 0; maximum is 5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE:If you use the &amp;lt;font color=&#039;green&#039;&amp;gt;-p&amp;lt;/font&amp;gt; option on the command line, the precision set in the relevant format file is overridden. The precision in&lt;br /&gt;
the format file serves as the default. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -m maxbins:&lt;br /&gt;
Option flag followed by the approximate maximum number of bins&lt;br /&gt;
desired in &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; output. The &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; program keeps track of the number of bins filled as the data is processed. The&lt;br /&gt;
smaller the number of bins, the faster &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; runs. By&lt;br /&gt;
keeping the number of bins small, you can check the gross aspects of&lt;br /&gt;
data distribution rather than the details. The number of bins is adjusted dynamically as &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; runs depending on the distribution of data in the input file. If the number of filled bins becomes &amp;gt; 1.5 * maxbins, the width of the bins is doubled to keep the total number near the desired maximum. The default is 100 bins; minimum is 6. Must be &amp;lt; 10,000.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The precision (-p) and maxbins (-m) options have no effect on&lt;br /&gt;
character variables. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; -md missing_data_flag:&lt;br /&gt;
Option flag followed by a flag value that &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; should&lt;br /&gt;
ignore across all variables in creating histogram data. Missing data flags are used in a data file to indicate missing or meaningless data. If you want &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; to ignore more than one value, use the query (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt;) option in conjunction with the variable file (&amp;lt;font color=&#039;green&#039;&amp;gt;-v&amp;lt;/font&amp;gt;) option.&lt;br /&gt;
&lt;br /&gt;
; -mm :&lt;br /&gt;
Option flag indicating that only the maximum and minimum values of variables are calculated and displayed in the processing summary. Variable summary files are not created.&lt;br /&gt;
&lt;br /&gt;
; -o &#039;&#039;processing_summary&#039;&#039; :&lt;br /&gt;
Option flag followed by the name of the file in which summary information displayed during processing is stored.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You will use &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; with a precision of 3 to create a&lt;br /&gt;
processing summary file and summary files for the two variables&lt;br /&gt;
latitude and longitude in the file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create the summary files, enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
checkvar latlon.dat -p 3 -o latlon.sum&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A summary of processing information and the maximum and minimum for&lt;br /&gt;
each variable are displayed on the screen. The following three files&lt;br /&gt;
are created:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt; recaps processing activity, maximums and minimums&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; shows distribution of the latitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt; shows distribution of the longitude values&lt;br /&gt;
in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Interpreting the Summaries==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing and variable summary files output by &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;&lt;br /&gt;
from the example in the previous section are shown and discussed&lt;br /&gt;
below.&lt;br /&gt;
&lt;br /&gt;
===Processing Summary===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you specify an output file on the command line, it stores the&lt;br /&gt;
information that is displayed on the screen during processing. The&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt; was specified as the output file in the example&lt;br /&gt;
above.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Input file : latlon.dat&lt;br /&gt;
Requested precision = 3, Approximate number of sorting bins = 100&lt;br /&gt;
&lt;br /&gt;
Input data format       (latlon.fmt)&lt;br /&gt;
ASCII_input_data       &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
The format contains 2 variables; length is 24.&lt;br /&gt;
&lt;br /&gt;
Output data format       (latlon.fmt)&lt;br /&gt;
binary_output_data       &amp;quot;binary format&amp;quot;&lt;br /&gt;
The format contains 2 variables; length is 16.&lt;br /&gt;
&lt;br /&gt;
Histogram data precision: 3, Number of sorting bins: 20&lt;br /&gt;
latitude: 20 values read&lt;br /&gt;
minimum: -83.223548 found at record  5&lt;br /&gt;
maximum:  77.883119 found at record 12&lt;br /&gt;
Summary file: latitude.lst&lt;br /&gt;
&lt;br /&gt;
Histogram data precision: 3, Number of sorting bins: 20&lt;br /&gt;
longitude: 20 values read&lt;br /&gt;
minimum: -176.161101 found at record 1&lt;br /&gt;
maximum:  149.408117 found at record 4&lt;br /&gt;
Summary file: longitude.lst.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing summary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt; first shows the name of&lt;br /&gt;
the input data file (&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;). If you specified precision and&lt;br /&gt;
a maximum number of bins on the command line, those values are given&lt;br /&gt;
as Requested precision, in this case 3, and Approximate number of&lt;br /&gt;
sorting bins, in this case the default value of 100. If precision is&lt;br /&gt;
not specified, No requested precision is shown.&lt;br /&gt;
&lt;br /&gt;
A summary of each format shows the type of format (in this case, Input&lt;br /&gt;
data format and Output data format) and the name of the format file&lt;br /&gt;
containing the format descriptions (&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;), whether&lt;br /&gt;
specified on the command line or located through the default search&lt;br /&gt;
sequence (as detailed in chapter 4). In this case, it was located by&lt;br /&gt;
default. Since &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; only needs an input format description,&lt;br /&gt;
it ignores output format descriptions. Next, you see the format&lt;br /&gt;
descriptor as resolved by FreeForm ND (e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt;)&lt;br /&gt;
and the format title (e.g., &amp;quot;ASCII format&amp;quot;). Then the number of&lt;br /&gt;
variables in a record and total record length are given; for ASCII,&lt;br /&gt;
record length includes the end-of-line character (1 byte for Unix).&lt;br /&gt;
&lt;br /&gt;
A section for each variable processed by &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; indicates the&lt;br /&gt;
histogram precision and actual number of sorting bins. Under some&lt;br /&gt;
circumstances, the precision of values in the histogram file may be&lt;br /&gt;
different than the precision you specified on the command line. The&lt;br /&gt;
default value for precision, if none is specified on the command line,&lt;br /&gt;
is the precision specified in the relevant format description file or&lt;br /&gt;
5, whichever is smaller. The second line shows the name of the&lt;br /&gt;
variable (latitude, longitude) and the number of values in the data&lt;br /&gt;
file for the variable (20 for both latitude and longitude).&lt;br /&gt;
&lt;br /&gt;
The minimum and maximum values for the variable are shown next&lt;br /&gt;
(-83.223548 is the minimum and 77.883119 is the maximum value for&lt;br /&gt;
latitude). The maximum and minimum values are given here with a&lt;br /&gt;
precision of 6, which is the precision specified in the format&lt;br /&gt;
description file. The locations of the maximum and minimum values in&lt;br /&gt;
the input file are indicated. (-83.223548 is the fifth latitude value&lt;br /&gt;
in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; and 77.883119 is the twelfth). Finally, the name&lt;br /&gt;
of the histogram data (or variable summary) file generated for each&lt;br /&gt;
variable is given (&amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
===Variable Summaries===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The name of each variable summary file (list file) output by&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; is of the form &amp;lt;font color=&#039;green&#039;&amp;gt;variable.lst&amp;lt;/font&amp;gt; for numeric variables&lt;br /&gt;
and &amp;lt;font color=&#039;green&#039;&amp;gt;variable.cst&amp;lt;/font&amp;gt; for character variables. The data in&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;.lst&amp;lt;/font&amp;gt;, and *&amp;lt;font color=&#039;green&#039;&amp;gt;.cst&amp;lt;/font&amp;gt; files can be loaded into histogram plot&lt;br /&gt;
programs for graphical representation. (You must be familiar enough&lt;br /&gt;
with your program of choice to manipulate the data as necessary in&lt;br /&gt;
order to achieve the desired result.) In Unix, there is no need to&lt;br /&gt;
abbreviate the base file name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;If you use the -v option, the order of variables in var_file has&lt;br /&gt;
no effect on the numbering of base file names of the variable&lt;br /&gt;
summary files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two example variable summary files, &amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt;, are shown next.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| &lt;br /&gt;
|&lt;br /&gt;
{| border=&amp;quot;2&amp;quot;&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| -83.224  1 &lt;br /&gt;
|-&lt;br /&gt;
| -69.274  1&lt;br /&gt;
|-&lt;br /&gt;
| -65.865  1&lt;br /&gt;
|-&lt;br /&gt;
| -63.212  1&lt;br /&gt;
|-&lt;br /&gt;
| -63.003  1&lt;br /&gt;
|-&lt;br /&gt;
| -47.304  1&lt;br /&gt;
|-&lt;br /&gt;
| -34.578  1&lt;br /&gt;
|-&lt;br /&gt;
| -28.287  1&lt;br /&gt;
|-&lt;br /&gt;
| -12.967  1&lt;br /&gt;
|-&lt;br /&gt;
| -0.929  1&lt;br /&gt;
|-&lt;br /&gt;
| 11.624  1&lt;br /&gt;
|-&lt;br /&gt;
| 12.588  1&lt;br /&gt;
|-&lt;br /&gt;
| 27.331  1&lt;br /&gt;
|-&lt;br /&gt;
| 29.918  1&lt;br /&gt;
|-&lt;br /&gt;
| 35.086  1&lt;br /&gt;
|-&lt;br /&gt;
| 35.130  1&lt;br /&gt;
|-&lt;br /&gt;
| 38.818  1&lt;br /&gt;
|-&lt;br /&gt;
| 54.118  1&lt;br /&gt;
|-&lt;br /&gt;
| 77.652  1&lt;br /&gt;
|-&lt;br /&gt;
| 77.883  1&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
||&lt;br /&gt;
{| border=&amp;quot;2&amp;quot;&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| -176.162  1&lt;br /&gt;
|-&lt;br /&gt;
| -155.234  1&lt;br /&gt;
|-&lt;br /&gt;
| -153.544  1&lt;br /&gt;
|-&lt;br /&gt;
| -136.941  1&lt;br /&gt;
|-&lt;br /&gt;
| -113.661  1&lt;br /&gt;
|-&lt;br /&gt;
| -79.178  1&lt;br /&gt;
|-&lt;br /&gt;
| -77.506  1&lt;br /&gt;
|-&lt;br /&gt;
| -55.442  1&lt;br /&gt;
|-&lt;br /&gt;
| -21.644  1&lt;br /&gt;
|-&lt;br /&gt;
| 0.777  1&lt;br /&gt;
|-&lt;br /&gt;
| 30.172  1&lt;br /&gt;
|-&lt;br /&gt;
| 35.591  1&lt;br /&gt;
|-&lt;br /&gt;
| 36.356  1&lt;br /&gt;
|-&lt;br /&gt;
| 38.875  1&lt;br /&gt;
|-&lt;br /&gt;
| 55.319  1&lt;br /&gt;
|-&lt;br /&gt;
| 62.152  1&lt;br /&gt;
|-&lt;br /&gt;
| 91.411  1&lt;br /&gt;
|-&lt;br /&gt;
| 134.124  1&lt;br /&gt;
|-&lt;br /&gt;
| 144.804  1&lt;br /&gt;
|-&lt;br /&gt;
| 149.408  1&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The variable summary files consist of two columns. The first indicates&lt;br /&gt;
boundary values for data bins and the second gives the number of data&lt;br /&gt;
points in each bin. Because a precision of 3 was specified in the&lt;br /&gt;
example, each boundary value has three decimal places. The boundary&lt;br /&gt;
values are determined dynamically by &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; and often do not&lt;br /&gt;
correspond to data values in the input file, even if the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; and data file precisions are the same.&lt;br /&gt;
&lt;br /&gt;
The first data bin in &amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; contains data points in the&lt;br /&gt;
range -83.224 (inclusive) to -69.274 (exclusive); neither boundary&lt;br /&gt;
number exists in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. The first bin has one data point,&lt;br /&gt;
-83.223548. The fourth data bin contains latitude values from -63.212&lt;br /&gt;
(inclusive) to -63.003 (exclusive), again with neither boundary value&lt;br /&gt;
occurring in the data file. The data point in the fourth bin is&lt;br /&gt;
-63.211962.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/datachk&amp;diff=2035</id>
		<title>Wiki Testing/datachk</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/datachk&amp;diff=2035"/>
		<updated>2008-02-06T17:17:58Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Generating the Summaries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Data Checking=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based utility program &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; creates variable&lt;br /&gt;
summary files, lists of maximum and minimum values, and summaries of&lt;br /&gt;
processing activity. You can use this information to check data&lt;br /&gt;
quality and to examine the distribution of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Generating the Summaries==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A variable summary file (or list file), which contains histogram&lt;br /&gt;
information showing the variable&#039;s distribution in the data file, is&lt;br /&gt;
created for each variable (or designated variables) in the specified&lt;br /&gt;
data file. You can optionally specify an output file in which a&lt;br /&gt;
summary of processing activity is saved.&lt;br /&gt;
&lt;br /&gt;
Variable summaries (list files) can be helpful for performing quality&lt;br /&gt;
control checks of data. For example, you could run &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; on&lt;br /&gt;
an ASCII file, convert the file to binary, and then run &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;&lt;br /&gt;
on the binary file. The output from &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; should be the same&lt;br /&gt;
for both the ASCII and binary files. You can also use variable&lt;br /&gt;
summaries to look at the data distribution in a data set before&lt;br /&gt;
extracting data.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    checkvar input_file [-f format_file] [-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
    [-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file]  [-p precision] [-m maxbins] [-md missing_data_flag] [-mm] [-o processing_summary]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; program needs to find only an input format&lt;br /&gt;
description. Output format descriptions will be ignored. If conversion&lt;br /&gt;
variables are included in input or output formats, no conversion is&lt;br /&gt;
performed when you run &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;, since it ignores output&lt;br /&gt;
formats.&lt;br /&gt;
&lt;br /&gt;
For descriptions of the standard arguments (first eleven arguments&lt;br /&gt;
above), see ([[Wiki_Testing/convs|Section 8.6]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -p precision:&lt;br /&gt;
Option flag followed by the number of decimal places. The number&lt;br /&gt;
represents the power of 10 that data is multiplied by prior to&lt;br /&gt;
binning. A value of 0 bins on one&#039;s, 1 on tenth&#039;s, and so on. This&lt;br /&gt;
option allows an adjustment of the resolution of the &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;&lt;br /&gt;
output.&lt;br /&gt;
The default is 0; maximum is 5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE:If you use the &amp;lt;font color=&#039;green&#039;&amp;gt;-p&amp;lt;/font&amp;gt; option on the command line, the precision set in the relevant format file is overridden. The precision in&lt;br /&gt;
the format file serves as the default. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -m maxbins:&lt;br /&gt;
Option flag followed by the approximate maximum number of bins&lt;br /&gt;
desired in &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; output. The &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; program keeps track of the number of bins filled as the data is processed. The&lt;br /&gt;
smaller the number of bins, the faster &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; runs. By&lt;br /&gt;
keeping the number of bins small, you can check the gross aspects of&lt;br /&gt;
data distribution rather than the details. The number of bins is adjusted dynamically as &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; runs depending on the distribution of data in the input file. If the number of filled bins becomes &amp;gt; 1.5 * maxbins, the width of the bins is doubled to keep the total number near the desired maximum. The default is 100 bins; minimum is 6. Must be &amp;lt; 10,000.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The precision (-p) and maxbins (-m) options have no effect on&lt;br /&gt;
character variables. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; -md missing_data_flag:&lt;br /&gt;
Option flag followed by a flag value that &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; should&lt;br /&gt;
ignore across all variables in creating histogram data. Missing data flags are used in a data file to indicate missing or meaningless data. If you want &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; to ignore more than one value, use the query (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt;) option in conjunction with the variable file (&amp;lt;font color=&#039;green&#039;&amp;gt;-v&amp;lt;/font&amp;gt;) option.&lt;br /&gt;
&lt;br /&gt;
; -mm :&lt;br /&gt;
Option flag indicating that only the maximum and minimum values of variables are calculated and displayed in the processing summary. Variable summary files are not created.&lt;br /&gt;
&lt;br /&gt;
; -o :&lt;br /&gt;
Option flag followed by the name of the file in which summary information displayed during processing is stored.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You will use &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; with a precision of 3 to create a&lt;br /&gt;
processing summary file and summary files for the two variables&lt;br /&gt;
latitude and longitude in the file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create the summary files, enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
checkvar latlon.dat -p 3 -o latlon.sum&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A summary of processing information and the maximum and minimum for&lt;br /&gt;
each variable are displayed on the screen. The following three files&lt;br /&gt;
are created:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt; recaps processing activity, maximums and minimums&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; shows distribution of the latitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt; shows distribution of the longitude values&lt;br /&gt;
in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Interpreting the Summaries==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing and variable summary files output by &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt;&lt;br /&gt;
from the example in the previous section are shown and discussed&lt;br /&gt;
below.&lt;br /&gt;
&lt;br /&gt;
===Processing Summary===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you specify an output file on the command line, it stores the&lt;br /&gt;
information that is displayed on the screen during processing. The&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt; was specified as the output file in the example&lt;br /&gt;
above.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Input file : latlon.dat&lt;br /&gt;
Requested precision = 3, Approximate number of sorting bins = 100&lt;br /&gt;
&lt;br /&gt;
Input data format       (latlon.fmt)&lt;br /&gt;
ASCII_input_data       &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
The format contains 2 variables; length is 24.&lt;br /&gt;
&lt;br /&gt;
Output data format       (latlon.fmt)&lt;br /&gt;
binary_output_data       &amp;quot;binary format&amp;quot;&lt;br /&gt;
The format contains 2 variables; length is 16.&lt;br /&gt;
&lt;br /&gt;
Histogram data precision: 3, Number of sorting bins: 20&lt;br /&gt;
latitude: 20 values read&lt;br /&gt;
minimum: -83.223548 found at record  5&lt;br /&gt;
maximum:  77.883119 found at record 12&lt;br /&gt;
Summary file: latitude.lst&lt;br /&gt;
&lt;br /&gt;
Histogram data precision: 3, Number of sorting bins: 20&lt;br /&gt;
longitude: 20 values read&lt;br /&gt;
minimum: -176.161101 found at record 1&lt;br /&gt;
maximum:  149.408117 found at record 4&lt;br /&gt;
Summary file: longitude.lst.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing summary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.sum&amp;lt;/font&amp;gt; first shows the name of&lt;br /&gt;
the input data file (&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;). If you specified precision and&lt;br /&gt;
a maximum number of bins on the command line, those values are given&lt;br /&gt;
as Requested precision, in this case 3, and Approximate number of&lt;br /&gt;
sorting bins, in this case the default value of 100. If precision is&lt;br /&gt;
not specified, No requested precision is shown.&lt;br /&gt;
&lt;br /&gt;
A summary of each format shows the type of format (in this case, Input&lt;br /&gt;
data format and Output data format) and the name of the format file&lt;br /&gt;
containing the format descriptions (&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;), whether&lt;br /&gt;
specified on the command line or located through the default search&lt;br /&gt;
sequence (as detailed in chapter 4). In this case, it was located by&lt;br /&gt;
default. Since &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; only needs an input format description,&lt;br /&gt;
it ignores output format descriptions. Next, you see the format&lt;br /&gt;
descriptor as resolved by FreeForm ND (e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt;)&lt;br /&gt;
and the format title (e.g., &amp;quot;ASCII format&amp;quot;). Then the number of&lt;br /&gt;
variables in a record and total record length are given; for ASCII,&lt;br /&gt;
record length includes the end-of-line character (1 byte for Unix).&lt;br /&gt;
&lt;br /&gt;
A section for each variable processed by &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; indicates the&lt;br /&gt;
histogram precision and actual number of sorting bins. Under some&lt;br /&gt;
circumstances, the precision of values in the histogram file may be&lt;br /&gt;
different than the precision you specified on the command line. The&lt;br /&gt;
default value for precision, if none is specified on the command line,&lt;br /&gt;
is the precision specified in the relevant format description file or&lt;br /&gt;
5, whichever is smaller. The second line shows the name of the&lt;br /&gt;
variable (latitude, longitude) and the number of values in the data&lt;br /&gt;
file for the variable (20 for both latitude and longitude).&lt;br /&gt;
&lt;br /&gt;
The minimum and maximum values for the variable are shown next&lt;br /&gt;
(-83.223548 is the minimum and 77.883119 is the maximum value for&lt;br /&gt;
latitude). The maximum and minimum values are given here with a&lt;br /&gt;
precision of 6, which is the precision specified in the format&lt;br /&gt;
description file. The locations of the maximum and minimum values in&lt;br /&gt;
the input file are indicated. (-83.223548 is the fifth latitude value&lt;br /&gt;
in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; and 77.883119 is the twelfth). Finally, the name&lt;br /&gt;
of the histogram data (or variable summary) file generated for each&lt;br /&gt;
variable is given (&amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
===Variable Summaries===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The name of each variable summary file (list file) output by&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; is of the form &amp;lt;font color=&#039;green&#039;&amp;gt;variable.lst&amp;lt;/font&amp;gt; for numeric variables&lt;br /&gt;
and &amp;lt;font color=&#039;green&#039;&amp;gt;variable.cst&amp;lt;/font&amp;gt; for character variables. The data in&lt;br /&gt;
*&amp;lt;font color=&#039;green&#039;&amp;gt;.lst&amp;lt;/font&amp;gt;, and *&amp;lt;font color=&#039;green&#039;&amp;gt;.cst&amp;lt;/font&amp;gt; files can be loaded into histogram plot&lt;br /&gt;
programs for graphical representation. (You must be familiar enough&lt;br /&gt;
with your program of choice to manipulate the data as necessary in&lt;br /&gt;
order to achieve the desired result.) In Unix, there is no need to&lt;br /&gt;
abbreviate the base file name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;If you use the -v option, the order of variables in var_file has&lt;br /&gt;
no effect on the numbering of base file names of the variable&lt;br /&gt;
summary files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two example variable summary files, &amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt;, are shown next.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| &lt;br /&gt;
|&lt;br /&gt;
{| border=&amp;quot;2&amp;quot;&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| -83.224  1 &lt;br /&gt;
|-&lt;br /&gt;
| -69.274  1&lt;br /&gt;
|-&lt;br /&gt;
| -65.865  1&lt;br /&gt;
|-&lt;br /&gt;
| -63.212  1&lt;br /&gt;
|-&lt;br /&gt;
| -63.003  1&lt;br /&gt;
|-&lt;br /&gt;
| -47.304  1&lt;br /&gt;
|-&lt;br /&gt;
| -34.578  1&lt;br /&gt;
|-&lt;br /&gt;
| -28.287  1&lt;br /&gt;
|-&lt;br /&gt;
| -12.967  1&lt;br /&gt;
|-&lt;br /&gt;
| -0.929  1&lt;br /&gt;
|-&lt;br /&gt;
| 11.624  1&lt;br /&gt;
|-&lt;br /&gt;
| 12.588  1&lt;br /&gt;
|-&lt;br /&gt;
| 27.331  1&lt;br /&gt;
|-&lt;br /&gt;
| 29.918  1&lt;br /&gt;
|-&lt;br /&gt;
| 35.086  1&lt;br /&gt;
|-&lt;br /&gt;
| 35.130  1&lt;br /&gt;
|-&lt;br /&gt;
| 38.818  1&lt;br /&gt;
|-&lt;br /&gt;
| 54.118  1&lt;br /&gt;
|-&lt;br /&gt;
| 77.652  1&lt;br /&gt;
|-&lt;br /&gt;
| 77.883  1&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
||&lt;br /&gt;
{| border=&amp;quot;2&amp;quot;&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;longitude.lst&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| -176.162  1&lt;br /&gt;
|-&lt;br /&gt;
| -155.234  1&lt;br /&gt;
|-&lt;br /&gt;
| -153.544  1&lt;br /&gt;
|-&lt;br /&gt;
| -136.941  1&lt;br /&gt;
|-&lt;br /&gt;
| -113.661  1&lt;br /&gt;
|-&lt;br /&gt;
| -79.178  1&lt;br /&gt;
|-&lt;br /&gt;
| -77.506  1&lt;br /&gt;
|-&lt;br /&gt;
| -55.442  1&lt;br /&gt;
|-&lt;br /&gt;
| -21.644  1&lt;br /&gt;
|-&lt;br /&gt;
| 0.777  1&lt;br /&gt;
|-&lt;br /&gt;
| 30.172  1&lt;br /&gt;
|-&lt;br /&gt;
| 35.591  1&lt;br /&gt;
|-&lt;br /&gt;
| 36.356  1&lt;br /&gt;
|-&lt;br /&gt;
| 38.875  1&lt;br /&gt;
|-&lt;br /&gt;
| 55.319  1&lt;br /&gt;
|-&lt;br /&gt;
| 62.152  1&lt;br /&gt;
|-&lt;br /&gt;
| 91.411  1&lt;br /&gt;
|-&lt;br /&gt;
| 134.124  1&lt;br /&gt;
|-&lt;br /&gt;
| 144.804  1&lt;br /&gt;
|-&lt;br /&gt;
| 149.408  1&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The variable summary files consist of two columns. The first indicates&lt;br /&gt;
boundary values for data bins and the second gives the number of data&lt;br /&gt;
points in each bin. Because a precision of 3 was specified in the&lt;br /&gt;
example, each boundary value has three decimal places. The boundary&lt;br /&gt;
values are determined dynamically by &amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; and often do not&lt;br /&gt;
correspond to data values in the input file, even if the&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;checkvar&amp;lt;/font&amp;gt; and data file precisions are the same.&lt;br /&gt;
&lt;br /&gt;
The first data bin in &amp;lt;font color=&#039;green&#039;&amp;gt;latitude.lst&amp;lt;/font&amp;gt; contains data points in the&lt;br /&gt;
range -83.224 (inclusive) to -69.274 (exclusive); neither boundary&lt;br /&gt;
number exists in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. The first bin has one data point,&lt;br /&gt;
-83.223548. The fourth data bin contains latitude values from -63.212&lt;br /&gt;
(inclusive) to -63.003 (exclusive), again with neither boundary value&lt;br /&gt;
occurring in the data file. The data point in the fourth bin is&lt;br /&gt;
-63.211962.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2034</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2034"/>
		<updated>2008-02-06T17:05:32Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* File Names and Context */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
; -ol log_file: Puts a log of processing information into the specified &#039;&#039;log_file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; -el error_log_file: Creates an error log file that contains whatever error messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; -ep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually acknowledge each important error by typing something on the keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; &#039;&#039;binary_data_file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
table 9.3. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;center&amp;gt;&lt;br /&gt;
 The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing b. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type s or l to swap short or long integers&lt;br /&gt;
respectively, or type f or d to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type p. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type P to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type q to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter l to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter q to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The P displays the&lt;br /&gt;
current file position and length, and q closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry -o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;: The following output appears on the screen:  &lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([[Wiki_Testing/convs| Chapter 8]] ).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude values in the ASCII format given in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;. This provides the context needed for FreeForm ND programs to determine which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format, &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs) which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2033</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2033"/>
		<updated>2008-02-06T17:02:31Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Including a Query */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
; -ol log_file: Puts a log of processing information into the specified &#039;&#039;log_file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; -el error_log_file: Creates an error log file that contains whatever error messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; -ep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually acknowledge each important error by typing something on the keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; &#039;&#039;binary_data_file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
table 9.3. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;center&amp;gt;&lt;br /&gt;
 The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing b. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type s or l to swap short or long integers&lt;br /&gt;
respectively, or type f or d to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type p. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type P to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type q to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter l to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter q to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The P displays the&lt;br /&gt;
current file position and length, and q closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry -o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;: The following output appears on the screen:  &lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2032</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2032"/>
		<updated>2008-02-06T17:02:16Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Including a Query */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
; -ol log_file: Puts a log of processing information into the specified &#039;&#039;log_file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; -el error_log_file: Creates an error log file that contains whatever error messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; -ep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually acknowledge each important error by typing something on the keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; &#039;&#039;binary_data_file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
table 9.3. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;center&amp;gt;&lt;br /&gt;
 The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing b. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type s or l to swap short or long integers&lt;br /&gt;
respectively, or type f or d to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type p. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type P to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type q to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter l to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter q to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The P displays the&lt;br /&gt;
current file position and length, and q closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry -o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;:&lt;br /&gt;
The following output appears on the screen:  &lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2031</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2031"/>
		<updated>2008-02-06T17:01:38Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Including a Query */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
; -ol log_file: Puts a log of processing information into the specified &#039;&#039;log_file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; -el error_log_file: Creates an error log file that contains whatever error messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; -ep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually acknowledge each important error by typing something on the keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; &#039;&#039;binary_data_file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
table 9.3. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;center&amp;gt;&lt;br /&gt;
 The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing b. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type s or l to swap short or long integers&lt;br /&gt;
respectively, or type f or d to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type p. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type P to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type q to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter l to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter q to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The P displays the&lt;br /&gt;
current file position and length, and q closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry -o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;:&lt;br /&gt;
The following output appears on the screen:  &amp;lt;pre&amp;gt; 54.118314 -136.940570 27.331551 -155.233735 11.624981 -113.660611 77.652742  -79.177679 77.883119  -77.505502 35.130219 -153.543091 35.086084  -21.643402 &amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2030</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2030"/>
		<updated>2008-02-06T17:01:21Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Including a Query */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
; -ol log_file: Puts a log of processing information into the specified &#039;&#039;log_file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; -el error_log_file: Creates an error log file that contains whatever error messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; -ep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually acknowledge each important error by typing something on the keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; &#039;&#039;binary_data_file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
table 9.3. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;center&amp;gt;&lt;br /&gt;
 The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing b. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type s or l to swap short or long integers&lt;br /&gt;
respectively, or type f or d to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type p. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type P to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type q to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter l to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter q to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The P displays the&lt;br /&gt;
current file position and length, and q closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry -o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;:&lt;br /&gt;
The following output appears on the screen:  &amp;lt;pre&amp;gt; 54.118314 -136.940570 27.331551 -155.233735 11.624981 -113.660611 77.652742  -79.177679 77.883119  -77.505502 35.130219 -153.543091 35.086084  -21.643402 &amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2029</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2029"/>
		<updated>2008-02-06T17:00:19Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Reading the Binary File */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
; -ol log_file: Puts a log of processing information into the specified &#039;&#039;log_file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; -el error_log_file: Creates an error log file that contains whatever error messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; -ep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually acknowledge each important error by typing something on the keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; &#039;&#039;binary_data_file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
table 9.3. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;center&amp;gt;&lt;br /&gt;
 The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing b. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type s or l to swap short or long integers&lt;br /&gt;
respectively, or type f or d to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type p. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type P to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type q to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter l to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter q to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The P displays the&lt;br /&gt;
current file position and length, and q closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry&lt;br /&gt;
-o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;:&lt;br /&gt;
The following output appears on the screen:  &amp;lt;pre&amp;gt; 54.118314 -136.940570 27.331551 -155.233735 11.624981 -113.660611 77.652742  -79.177679 77.883119  -77.505502 35.130219 -153.543091 35.086084  -21.643402 &amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2028</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2028"/>
		<updated>2008-02-06T16:59:39Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Reading the Binary File */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
; -ol log_file: Puts a log of processing information into the specified &#039;&#039;log_file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; -el error_log_file: Creates an error log file that contains whatever error messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; -ep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually acknowledge each important error by typing something on the keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; &#039;&#039;binary_data_file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
table 9.3. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;center&amp;gt;&lt;br /&gt;
 The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing b. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type s or l to swap short or long integers&lt;br /&gt;
respectively, or type f or d to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type p. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type P to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type q to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter l to view each&lt;br /&gt;
value (or press Return to view each value after the first).&lt;br /&gt;
#Enter q to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The P displays the&lt;br /&gt;
current file position and length, and q closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry&lt;br /&gt;
-o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;:&lt;br /&gt;
The following output appears on the screen:  &amp;lt;pre&amp;gt; 54.118314 -136.940570 27.331551 -155.233735 11.624981 -113.660611 77.652742  -79.177679 77.883119  -77.505502 35.130219 -153.543091 35.086084  -21.643402 &amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2027</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2027"/>
		<updated>2008-02-06T16:58:44Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Reading the Binary File */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
; -ol log_file: Puts a log of processing information into the specified &#039;&#039;log_file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; -el error_log_file: Creates an error log file that contains whatever error messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; -ep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually acknowledge each important error by typing something on the keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; &#039;&#039;binary_data_file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
table 9.3. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;center&amp;gt;&lt;br /&gt;
 The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing b. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type s or l to swap short or long integers&lt;br /&gt;
respectively, or type f or d to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type p. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type P to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type q to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as doubles, so enter d to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter q to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to readfile from an input command file rather than directly from the command line. The example command file latlon.in is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is latlon.in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for long) cause the first 6 values in the file to be displayed. The sequence p0 causes a return to the top (position 0) of the file. A position number (0) must be followed by a blank space. The 2 l&#039;s display the first two values again. The P displays the current file position and length, and q closes readfile.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision of the long variables in latlon2.fmt.&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter l to view each&lt;br /&gt;
value (or press Return to view each value after the first).&lt;br /&gt;
#Enter q to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The P displays the&lt;br /&gt;
current file position and length, and q closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry&lt;br /&gt;
-o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;:&lt;br /&gt;
The following output appears on the screen:  &amp;lt;pre&amp;gt; 54.118314 -136.940570 27.331551 -155.233735 11.624981 -113.660611 77.652742  -79.177679 77.883119  -77.505502 35.130219 -153.543091 35.086084  -21.643402 &amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2026</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2026"/>
		<updated>2008-02-06T16:57:26Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Reading the Binary File */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
; -ol log_file: Puts a log of processing information into the specified &#039;&#039;log_file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; -el error_log_file: Creates an error log file that contains whatever error messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; -ep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually acknowledge each important error by typing something on the keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; &#039;&#039;binary_data_file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
table 9.3. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;center&amp;gt;&lt;br /&gt;
 The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing b. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type s or l to swap short or long integers&lt;br /&gt;
respectively, or type f or d to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type p. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type P to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type q to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as doubles, so enter d to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter q to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter l to view each&lt;br /&gt;
value (or press Return to view each value after the first).&lt;br /&gt;
#Enter q to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The P displays the&lt;br /&gt;
current file position and length, and q closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry&lt;br /&gt;
-o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;:&lt;br /&gt;
The following output appears on the screen:  &amp;lt;pre&amp;gt; 54.118314 -136.940570 27.331551 -155.233735 11.624981 -113.660611 77.652742  -79.177679 77.883119  -77.505502 35.130219 -153.543091 35.086084  -21.643402 &amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2025</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2025"/>
		<updated>2008-02-06T16:56:09Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Reading the Binary File */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
; -ol log_file: Puts a log of processing information into the specified &#039;&#039;log_file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; -el error_log_file: Creates an error log file that contains whatever error messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; -ep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually acknowledge each important error by typing something on the keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; &#039;&#039;binary_data_file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
table 9.3. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;center&amp;gt;&lt;br /&gt;
 The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing b. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type s or l to swap short or long integers&lt;br /&gt;
respectively, or type f or d to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type p. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type P to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type q to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as doubles, so enter d to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter q to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter \inp{l} to view each&lt;br /&gt;
value (or press Return to view each value after the first).&lt;br /&gt;
#Enter \inp{q} to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input&lt;br /&gt;
command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The \inp{P} displays the&lt;br /&gt;
current file position and length, and \inp{q} closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry&lt;br /&gt;
-o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;:&lt;br /&gt;
The following output appears on the screen:  &amp;lt;pre&amp;gt; 54.118314 -136.940570 27.331551 -155.233735 11.624981 -113.660611 77.652742  -79.177679 77.883119  -77.505502 35.130219 -153.543091 35.086084  -21.643402 &amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2024</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2024"/>
		<updated>2008-02-06T16:54:54Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* &amp;lt;font color=&amp;#039;green&amp;#039;&amp;gt;readfile&amp;lt;/font&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
; -ol log_file: Puts a log of processing information into the specified &#039;&#039;log_file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; -el error_log_file: Creates an error log file that contains whatever error messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; -ep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually acknowledge each important error by typing something on the keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; &#039;&#039;binary_data_file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
table 9.3. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;center&amp;gt;&lt;br /&gt;
 The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing b. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type s or l to swap short or long integers&lt;br /&gt;
respectively, or type f or d to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type p. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type P to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type q to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as doubles, so enter \inp{d} to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter \inp{q} to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter \inp{l} to view each&lt;br /&gt;
value (or press Return to view each value after the first).&lt;br /&gt;
#Enter \inp{q} to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input&lt;br /&gt;
command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The \inp{P} displays the&lt;br /&gt;
current file position and length, and \inp{q} closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry&lt;br /&gt;
-o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;:&lt;br /&gt;
The following output appears on the screen:  &amp;lt;pre&amp;gt; 54.118314 -136.940570 27.331551 -155.233735 11.624981 -113.660611 77.652742  -79.177679 77.883119  -77.505502 35.130219 -153.543091 35.086084  -21.643402 &amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2023</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2023"/>
		<updated>2008-02-06T16:53:36Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* &amp;lt;font color=&amp;#039;green&amp;#039;&amp;gt;readfile&amp;lt;/font&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
; -ol log_file: Puts a log of processing information into the specified &#039;&#039;log_file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; -el error_log_file: Creates an error log file that contains whatever error messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; -ep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually acknowledge each important error by typing something on the keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; &#039;&#039;binary_data_file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
table 9.3. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;center&amp;gt;&lt;br /&gt;
 The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing \inp{b}. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type \inp{s} or \inp{l} to swap short or long integers&lt;br /&gt;
respectively, or type \inp{f} or \inp{d} to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type \inp{p}. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type \inp{P} to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type \inp{q} to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as doubles, so enter \inp{d} to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter \inp{q} to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter \inp{l} to view each&lt;br /&gt;
value (or press Return to view each value after the first).&lt;br /&gt;
#Enter \inp{q} to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input&lt;br /&gt;
command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The \inp{P} displays the&lt;br /&gt;
current file position and length, and \inp{q} closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry&lt;br /&gt;
-o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;:&lt;br /&gt;
The following output appears on the screen:  &amp;lt;pre&amp;gt; 54.118314 -136.940570 27.331551 -155.233735 11.624981 -113.660611 77.652742  -79.177679 77.883119  -77.505502 35.130219 -153.543091 35.086084  -21.643402 &amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2022</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2022"/>
		<updated>2008-02-06T16:52:33Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* &amp;lt;font color=&amp;#039;green&amp;#039;&amp;gt;chkform&amp;lt;/font&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
; -ol log_file: Puts a log of processing information into the specified &#039;&#039;log_file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; -el error_log_file: Creates an error log file that contains whatever error messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; -ep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually acknowledge each important error by typing something on the keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; \var{binary_data_file}&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
\tableref{ff,tab,readfileopts}. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
\caption{The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing \inp{b}. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type \inp{s} or \inp{l} to swap short or long integers&lt;br /&gt;
respectively, or type \inp{f} or \inp{d} to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type \inp{p}. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type \inp{P} to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type \inp{q} to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as doubles, so enter \inp{d} to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter \inp{q} to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter \inp{l} to view each&lt;br /&gt;
value (or press Return to view each value after the first).&lt;br /&gt;
#Enter \inp{q} to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input&lt;br /&gt;
command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The \inp{P} displays the&lt;br /&gt;
current file position and length, and \inp{q} closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry&lt;br /&gt;
-o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;:&lt;br /&gt;
The following output appears on the screen:  &amp;lt;pre&amp;gt; 54.118314 -136.940570 27.331551 -155.233735 11.624981 -113.660611 77.652742  -79.177679 77.883119  -77.505502 35.130219 -153.543091 35.086084  -21.643402 &amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2021</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2021"/>
		<updated>2008-02-06T16:49:07Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* &amp;lt;font color=&amp;#039;green&amp;#039;&amp;gt;newform&amp;lt;/font&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &#039;&#039;input_file&#039;&#039; [-f format_file] [-if-if input_format_file] [-of output_format_file]&lt;br /&gt;
&lt;br /&gt;
[-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([[Wiki_Testing/convs|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/fmtconv|Section 9.3]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs,argument&amp;lt;/cite&amp;gt;]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; \dashol : Puts a log of processing information into the specified&lt;br /&gt;
\var{log_file}.&lt;br /&gt;
&lt;br /&gt;
; \dashel : Creates an error log file that contains whatever error&lt;br /&gt;
messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; \dashep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually&lt;br /&gt;
acknowledge each important error by typing something on the&lt;br /&gt;
keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to&lt;br /&gt;
prompt, but will continue processing until either the file is&lt;br /&gt;
procesed, or there is an error preventing more processing.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; \var{binary_data_file}&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
\tableref{ff,tab,readfileopts}. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
\caption{The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing \inp{b}. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type \inp{s} or \inp{l} to swap short or long integers&lt;br /&gt;
respectively, or type \inp{f} or \inp{d} to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type \inp{p}. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type \inp{P} to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type \inp{q} to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as doubles, so enter \inp{d} to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter \inp{q} to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter \inp{l} to view each&lt;br /&gt;
value (or press Return to view each value after the first).&lt;br /&gt;
#Enter \inp{q} to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input&lt;br /&gt;
command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The \inp{P} displays the&lt;br /&gt;
current file position and length, and \inp{q} closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry&lt;br /&gt;
-o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;:&lt;br /&gt;
The following output appears on the screen:  &amp;lt;pre&amp;gt; 54.118314 -136.940570 27.331551 -155.233735 11.624981 -113.660611 77.652742  -79.177679 77.883119  -77.505502 35.130219 -153.543091 35.086084  -21.643402 &amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2020</id>
		<title>Wiki Testing/fmtconv</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/fmtconv&amp;diff=2020"/>
		<updated>2008-02-06T16:46:22Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* &amp;lt;font color=&amp;#039;green&amp;#039;&amp;gt;newform&amp;lt;/font&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Format Conversion=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND utility program newform lets you convert data from one&lt;br /&gt;
format to another. This allows you to pass data to applications in the&lt;br /&gt;
format they require. You may also want to create binary archives for&lt;br /&gt;
efficient data storage and access. With newform, conversion of ASCII&lt;br /&gt;
data to binary format is straightforward. If you wish to read the data&lt;br /&gt;
in a binary file, you can convert it to ASCII with newform, or use the&lt;br /&gt;
interactive program readfile. You can also convert data from one ASCII&lt;br /&gt;
format to another ASCII format with newform.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The FreeForm ND-based program &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;[[Wiki_Testing/Footnotes|(4)]] is a general tool for changing the format ofa data file. The only required command line argument, if you use FreeForm ND naming conventions, is the name of the input data file.&lt;br /&gt;
The reformatted data is written to standard output (the screen) unless&lt;br /&gt;
you specify an output file. If you reformat to binary, you will&lt;br /&gt;
generally want to store the output in a file.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved in a conversion before you&lt;br /&gt;
can use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to perform the conversion. The standard&lt;br /&gt;
extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you do not&lt;br /&gt;
explicitly specify the format description file on the command line,&lt;br /&gt;
which is unnecessary if you use FreeForm ND naming conventions,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([[Wiki_Testing/convs|Chapter 8]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; \var{input_file} [\dashf] [\dashif] [\dashof]&lt;br /&gt;
[\dashft] [\dashift] [\dashoft] [\dashb] [\dashc] [\dashvv] [\dashq]&lt;br /&gt;
[\dasho]&lt;br /&gt;
&lt;br /&gt;
For descriptions of the arguments, see ([http://www &amp;lt;cite&amp;gt; ff,convs,argument&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
If you want to convert an ASCII file to a binary file, and you follow&lt;br /&gt;
the FreeForm ND naming conventions, the command is simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where datafile is the file name of your choosing.&lt;br /&gt;
&lt;br /&gt;
If data files and format files are not in the current directory or in&lt;br /&gt;
the same directory, you can specify the appropriate path name.  For&lt;br /&gt;
example, if the input data file is not in the current directory, you&lt;br /&gt;
can enter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform /path/datafile.dat -o datafile.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read the data in the resulting binary file, you can reformat back&lt;br /&gt;
to ASCII using the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform datafile.bin -o datafile.ext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program, described in&lt;br /&gt;
([[Wiki_Testing/convs|Section 8.6]]).&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Though &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; is useful for checking data formats, it is&lt;br /&gt;
limited by requiring a format file to specify an output format.  Since&lt;br /&gt;
some OPeNDAP FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not&lt;br /&gt;
require an output format, this is extra work for the dataset&lt;br /&gt;
administrator.  For these occasions, OPeNDAP FreeForm ND provides a simpler&lt;br /&gt;
format-checking program, called &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; program attempts to read an ASCII file, using the&lt;br /&gt;
specified input format.  If the format allows the file to be read&lt;br /&gt;
&lt;br /&gt;
properly, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; says so.  However, if the input format&lt;br /&gt;
contains errors, or does not accurately reflect the contents of the&lt;br /&gt;
given data file, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; delivers an error message, and attempts&lt;br /&gt;
to provide a rudimentary diagnosis of the problem.&lt;br /&gt;
&lt;br /&gt;
You must create a format description file (or files) with format&lt;br /&gt;
descriptions for the data files involved before you can use&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; to chack the format.  As with &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, the&lt;br /&gt;
standard extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;. If you&lt;br /&gt;
do not explicitly specify the format description file on the command&lt;br /&gt;
line (unnecessary if you use FreeForm ND naming conventions)&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; follows the FreeForm ND search sequence to find a format&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
For details about FreeForm ND naming conventions and the search&lt;br /&gt;
sequence, see ([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform input_file [-if input_format_file] [-ift &amp;quot;title&amp;quot;] [-b local_buffer_size]&lt;br /&gt;
[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the arguments are described in&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs,argument&amp;lt;/cite&amp;gt;]).  The following are specific to&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
; \dashol : Puts a log of processing information into the specified&lt;br /&gt;
\var{log_file}.&lt;br /&gt;
&lt;br /&gt;
; \dashel : Creates an error log file that contains whatever error&lt;br /&gt;
messages are issued by &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; \dashep : In normal operation, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; asks you to manually&lt;br /&gt;
acknowledge each important error by typing something on the&lt;br /&gt;
keyboard.  If you use this option, &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; will not stop to&lt;br /&gt;
prompt, but will continue processing until either the file is&lt;br /&gt;
procesed, or there is an error preventing more processing.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As in the above examples, if you have an ASCII data file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt;, supposedly described in a format file called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;chkform&amp;lt;/font&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkform datafile.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If processing is successful, you will see something like the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_file_header  &amp;quot;Latitude/Longitude Limits&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 1 header record (71 bytes)&lt;br /&gt;
Each record contains 6 fields and is 71 characters long.&lt;br /&gt;
&lt;br /&gt;
(llmaxmin.fmt) ASCII_input_data &amp;quot;lat/lon&amp;quot;&lt;br /&gt;
File llmaxmin.dat contains 10 data records (230 bytes)&lt;br /&gt;
Each record contains 3 fields and is 23 characters long.&lt;br /&gt;
&lt;br /&gt;
100&lt;br /&gt;
&lt;br /&gt;
No errors found (11 lines checked)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;, a simple interactive binary file&lt;br /&gt;
reader. The program has one required command line argument, the name&lt;br /&gt;
of the file to be read. You do not have to write format descriptions&lt;br /&gt;
to use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; \var{binary_data_file}&lt;br /&gt;
&lt;br /&gt;
When the program starts, it shows the available options, shown in&lt;br /&gt;
\tableref{ff,tab,readfileopts}. At the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; prompt, type&lt;br /&gt;
these option codes to view binary encoded values. (Pressing return&lt;br /&gt;
repeats the last option.)&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
\caption{The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program options}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;c&amp;lt;/font&amp;gt; || char --- 1 byte character&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;s&amp;lt;/font&amp;gt; || short --- 2 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;l&amp;lt;/font&amp;gt; || long --- 4 byte signed integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;f&amp;lt;/font&amp;gt; || float --- 4 byte single-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;d&amp;lt;/font&amp;gt; || double --- 8 byte double-precision floating point&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;uc&amp;lt;/font&amp;gt; || uchar --- 1 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;us&amp;lt;/font&amp;gt; || ushort --- 2 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;ul&amp;lt;/font&amp;gt; || ulong --- 4 byte unsigned integer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;b&amp;lt;/font&amp;gt; || Toggle between &amp;quot;big-endian&amp;quot; and your machine&#039;s native byte&lt;br /&gt;
order&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;p&amp;lt;/font&amp;gt; || Set new file position&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;P&amp;lt;/font&amp;gt; ||Show present file position and length&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;h&amp;lt;/font&amp;gt; || Display this help screen&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&#039;green&#039;&amp;gt;q&amp;lt;/font&amp;gt; || Quit&lt;br /&gt;
 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The options let you interactively read your way through the specified&lt;br /&gt;
binary file. The first position in the file is 0. You must type the&lt;br /&gt;
character(s) indicating variable type (e.g., us for unsigned short) to&lt;br /&gt;
view each value, so you need to know the data types of variables in&lt;br /&gt;
the file and the order in which they occur. If successive variables&lt;br /&gt;
are of the same type, you can press Return to view each value after&lt;br /&gt;
the first of that type.&lt;br /&gt;
&lt;br /&gt;
You can toggle the byte-order switch on and off by typing \inp{b}. The&lt;br /&gt;
byte-order option is used to read a binary data file that requires&lt;br /&gt;
byte swapping. This is the case when you need cross-platform access to&lt;br /&gt;
a file that is not byte-swapped, for example, if you are on a Unix&lt;br /&gt;
machine reading data from a CD-ROM formatted for a PC. When the switch&lt;br /&gt;
is on, type \inp{s} or \inp{l} to swap short or long integers&lt;br /&gt;
respectively, or type \inp{f} or \inp{d} to swap floats or doubles.&lt;br /&gt;
The &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; program does not byte swap the file itself (the&lt;br /&gt;
file is unchanged) but byte swaps the data values internally for&lt;br /&gt;
display purposes only.&lt;br /&gt;
&lt;br /&gt;
To go to another position in the file, type \inp{p}. You are prompted&lt;br /&gt;
to enter the new file position in bytes. If, for example, each value&lt;br /&gt;
in the file is 4 bytes long and you type 16, you will be positioned at&lt;br /&gt;
the first byte of the fifth value. If you split fields (by not&lt;br /&gt;
repositioning at the beginning of a field), the results will probably&lt;br /&gt;
be garbage. Type \inp{P} to find out your current position in the file&lt;br /&gt;
and total file length in bytes. Type \inp{q} to exit from&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also use an input command file rather than entering commands&lt;br /&gt;
directly. In that case, the &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; command has the following&lt;br /&gt;
form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile binary_data_file &amp;lt; input_command_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating a Binary Archive==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By storing data files in binary, you save disk space and make access&lt;br /&gt;
by applications more efficient. An ASCII data file can take two to&lt;br /&gt;
five times the disk space of a comparable binary data file. Not only&lt;br /&gt;
is there less information in each byte, but extra bytes are needed for&lt;br /&gt;
decimal points, delimiters, and end-of-line markers.&lt;br /&gt;
&lt;br /&gt;
It is very easy to create a binary archive using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; as the&lt;br /&gt;
following examples show. The input data for these examples are in the&lt;br /&gt;
ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; (shown below). They consist of 20 random&lt;br /&gt;
latitude and longitude values. The size of the file on a Unix system&lt;br /&gt;
is 460 bytes.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-47.303545 -176.161101&lt;br /&gt;
-0.928001    0.777265&lt;br /&gt;
-28.286662   35.591879&lt;br /&gt;
12.588231  149.408117&lt;br /&gt;
-83.223548   55.319598&lt;br /&gt;
54.118314 -136.940570&lt;br /&gt;
38.818812   91.411330&lt;br /&gt;
-34.577065   30.172129&lt;br /&gt;
27.331551 -155.233735&lt;br /&gt;
11.624981 -113.660611&lt;br /&gt;
77.652742  -79.177679&lt;br /&gt;
77.883119  -77.505502&lt;br /&gt;
-65.864879  -55.441896&lt;br /&gt;
-63.211962  134.124014&lt;br /&gt;
35.130219 -153.543091&lt;br /&gt;
29.918847  144.804390&lt;br /&gt;
-69.273601   38.875778&lt;br /&gt;
-63.002874   36.356024&lt;br /&gt;
35.086084  -21.643402&lt;br /&gt;
-12.966961   62.152266&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple ASCII to Binary Conversion===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to convert the ASCII data&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The input&lt;br /&gt;
and output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.bin&lt;br /&gt;
/ and latlon.dat. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 8 double 6&lt;br /&gt;
longitude 9 16 double 6&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binary and ASCII variables both have the same names. The binary&lt;br /&gt;
variable latitude occupies positions 1 to 8 and longitude occupies&lt;br /&gt;
positions 9-16. The corresponding ASCII variables occupy positions&lt;br /&gt;
1-10 and 12-22. Both the binary and ASCII variables are stored as&lt;br /&gt;
doubles and have a precision of 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary===&lt;br /&gt;
&lt;br /&gt;
To convert from an ASCII representation of the numbers in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to a binary representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example files.&lt;br /&gt;
#Enter the following command:  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; newform latlon.dat -o latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because FreeForm ND filenaming conventions have been used,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will locate and use &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; for the&lt;br /&gt;
translation. The &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; program creates a new data file&lt;br /&gt;
(effectively a binary archive) called &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;. The size of&lt;br /&gt;
the archive file is 2/3 the size of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Additionally,&lt;br /&gt;
the data do not have to be converted to machine-readable&lt;br /&gt;
representation by applications.&lt;br /&gt;
&lt;br /&gt;
There are two methods for checking the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to&lt;br /&gt;
make sure they converted correctly. You can reformat back to ASCII and&lt;br /&gt;
view the resulting file, or use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconverting to Native Format===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the following &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; command to reformat the binary data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; to its native ASCII format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -o latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.rf&amp;lt;/font&amp;gt; matches (but does not overwrite) the&lt;br /&gt;
original input file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. You can confirm this by using a&lt;br /&gt;
file comparison utility. The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; command is generally available on&lt;br /&gt;
Unix platforms.&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; to compare the &amp;lt;font color=&#039;green&#039;&amp;gt;latlon&amp;lt;/font&amp;gt; ASCII files, enter the&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff latlon.dat latlon.rf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output should be something along these lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files are effectively identical.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several implementations of the &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility don&#039;t print anything&lt;br /&gt;
if the two input files are identical.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: The &amp;lt;font color=&#039;green&#039;&amp;gt;diff&amp;lt;/font&amp;gt; utility may detect a difference in other similar&lt;br /&gt;
cases because FreeForm ND adds a leading zero in front of a decimal&lt;br /&gt;
and interprets a blank as a zero if the field is described as a&lt;br /&gt;
number. (A blank described as a character is interpreted as a&lt;br /&gt;
blank.) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to read the data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as doubles, so enter \inp{d} to view each value (or press Return to view each value after the first).&lt;br /&gt;
#Enter \inp{q} to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Conversion to a More Portable Binary===&lt;br /&gt;
&lt;br /&gt;
In this example, you will use &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to reformat the latitude&lt;br /&gt;
and longitude values in the ASCII data file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; into&lt;br /&gt;
binary longs in the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt;. The input and&lt;br /&gt;
output data formats are described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is what&#039;s in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for data files latlon.dat&lt;br /&gt;
/ and latlon2.bin. Each record in both files contains two fields,&lt;br /&gt;
/ latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII format&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_data &amp;quot;binary format&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ASCII and binary variables both have the same names. The ASCII&lt;br /&gt;
variable latitude occupies positions 1-10 and longitude occupies&lt;br /&gt;
positions 12-22. The ASCII variables are defined to be of type double.&lt;br /&gt;
The binary variables occupy four bytes each (positions 1-4 and 5-8)&lt;br /&gt;
and are of type long. The precision for all is 6.&lt;br /&gt;
&lt;br /&gt;
===Converting to Binary Long===&lt;br /&gt;
&lt;br /&gt;
In the previous example, both the ASCII and binary variables were&lt;br /&gt;
defined to be doubles. Binary longs, which are 4-byte integers, may be&lt;br /&gt;
more portable across different platforms than binary doubles or&lt;br /&gt;
floats.&lt;br /&gt;
&lt;br /&gt;
To convert the ASCII data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary longs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Change to the directory that contains the FreeForm ND example&lt;br /&gt;
files.&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -o latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the binary archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; with the 20&lt;br /&gt;
latitude and longitude values in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; stored as binary&lt;br /&gt;
longs.&lt;br /&gt;
&lt;br /&gt;
This example duplicates one in chapter 2. If you completed that&lt;br /&gt;
example, an error message will indicate that &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; exists.&lt;br /&gt;
You can rename, move, or delete the existing file.&lt;br /&gt;
&lt;br /&gt;
The size of the archive file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.bin&amp;lt;/font&amp;gt; is about 1/3 the size&lt;br /&gt;
of &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;. Also, the data do not have to be converted to&lt;br /&gt;
machine representation by applications. The main tradeoff in achieving&lt;br /&gt;
savings in space and access time is that although binary longs are&lt;br /&gt;
more portable than binary doubles or floats, any binary representation&lt;br /&gt;
is less portable than ASCII.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;CAUTION: There may be a loss of precision when input data of&lt;br /&gt;
type double is converted to long. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reading the Binary File===&lt;br /&gt;
&lt;br /&gt;
Once again, you can use &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; to check the data in the binary&lt;br /&gt;
archive you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; readfile latlon2.bin  &amp;lt;/pre&amp;gt;&lt;br /&gt;
#The data are stored as longs, so enter \inp{l} to view each&lt;br /&gt;
value (or press Return to view each value after the first).&lt;br /&gt;
#Enter \inp{q} to quit &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If desired, you can enter the commands to &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; from an input&lt;br /&gt;
command file rather than directly from the command line. The example&lt;br /&gt;
command file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt; is shown next.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.in&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
llllllp0 llPq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 6 l&#039;s (l for &amp;lt;font color=&#039;green&#039;&amp;gt;long&amp;lt;/font&amp;gt;) cause the first 6 values in the file to be&lt;br /&gt;
displayed. The sequence p0 causes a return to the top (position 0) of&lt;br /&gt;
the file. A position number (0) must be followed by a blank space. The&lt;br /&gt;
2 l&#039;s display the first two values again. The \inp{P} displays the&lt;br /&gt;
current file position and length, and \inp{q} closes &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you enter the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
readfile latlon2.bin &amp;lt; latlon.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you should see the following output on the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
long:    -928001&lt;br /&gt;
long:     777265&lt;br /&gt;
long:  -28286662&lt;br /&gt;
long:   35591879&lt;br /&gt;
New File Position = 0&lt;br /&gt;
long:  -47303545&lt;br /&gt;
long: -176161101&lt;br /&gt;
File Position: 8       File Length: 160&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating point numbers have been multiplied by 106, the precision&lt;br /&gt;
of the long variables in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Including a Query===&lt;br /&gt;
&lt;br /&gt;
You can use the query option (&amp;lt;font color=&#039;green&#039;&amp;gt;-q&amp;lt;/font&amp;gt; \var{query_file}) to specify&lt;br /&gt;
exactly which records in the data file &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; should process.&lt;br /&gt;
The query file contains query criteria. Query syntax is summarized in&lt;br /&gt;
Appendix C.&lt;br /&gt;
&lt;br /&gt;
In this example, you will specify a query so that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
reformat only those value pairs in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; where latitude is&lt;br /&gt;
positive and longitude is negative into the binary file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;. The input and output data formats are described in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon2.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The query criteria are specified in the following file, called&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.qry&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[latitude] &amp;gt; 0 &amp;amp; [longitude] &amp;lt; 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert the desired data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to binary and then&lt;br /&gt;
view the results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Enter the following command:   &amp;lt;pre&amp;gt; newform latlon.dat -f latlon2.fmt -q llposneg.qry&lt;br /&gt;
-o llposneg.bin  &amp;lt;/pre&amp;gt;  The &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt; file now contains the positive/negative latitude/longitude pairs in binary form.&lt;br /&gt;
#To view the data, first convert the data in &amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
back to ASCII format:  newform llposneg.bin -f latlon2.fmt -o llposneg.dat&lt;br /&gt;
#Enter the appropriate command to display the data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llposneg.dat&amp;lt;/font&amp;gt;, e.g. &amp;lt;font color=&#039;green&#039;&amp;gt;more&amp;lt;/font&amp;gt;:&lt;br /&gt;
The following output appears on the screen:  &amp;lt;pre&amp;gt; 54.118314 -136.940570 27.331551 -155.233735 11.624981 -113.660611 77.652742  -79.177679 77.883119  -77.505502 35.130219 -153.543091 35.086084  -21.643402 &amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: As demonstrated in the examples above, you can check the data in&lt;br /&gt;
a binary file either by using &amp;lt;font color=&#039;green&#039;&amp;gt;readfile&amp;lt;/font&amp;gt; or by converting the&lt;br /&gt;
data back to ASCII using &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; and then viewing it.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Names and Context==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding examples, the read/write type (input or output) was&lt;br /&gt;
not included in the format descriptors (&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_data&amp;lt;/font&amp;gt; and&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;binary_data&amp;lt;/font&amp;gt;). FreeForm ND naming conventions were used, so&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; can determine from the context which format should be&lt;br /&gt;
used for input and which for output. Consider the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The input file extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; and the output file extension&lt;br /&gt;
is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;. These extensions provide context indicating that ASCII&lt;br /&gt;
should be used as the input format and binary should be used as the&lt;br /&gt;
output format. The format description file that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; will&lt;br /&gt;
look for is the file with the same name as the input file and the&lt;br /&gt;
extension &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to translate the binary archive &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; back to ASCII,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; identifies the input format as binary and uses the ASCII&lt;br /&gt;
format for output. The ASCII data is written to the screen because an&lt;br /&gt;
output file was not specified.&lt;br /&gt;
&lt;br /&gt;
For information about FreeForm ND file name conventions, see&lt;br /&gt;
([http://www &amp;lt;cite&amp;gt; ff,convs&amp;lt;/cite&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Data File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are working with data files that do not use FreeForm ND naming&lt;br /&gt;
conventions, you need to more explicitly define the context. For&lt;br /&gt;
example, the files &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.ll&amp;lt;/font&amp;gt; all have latitude and longitude&lt;br /&gt;
values in the ASCII format given in the format description file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat.fmt&amp;lt;/font&amp;gt;. If you wanted to archive these files in binary&lt;br /&gt;
format, you could not use a command of the form used in the previous&lt;br /&gt;
examples, i.e., &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dat&amp;lt;/font&amp;gt; -o &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
with &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt; as the default format description file.&lt;br /&gt;
&lt;br /&gt;
First, the ASCII data files do not have the extension &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;,&lt;br /&gt;
which identifies them as ASCII files. Second, you would need five&lt;br /&gt;
separate format description files, all with the same content:&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.fmt&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.fmt&amp;lt;/font&amp;gt;,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;lldat4.fmt&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat5.fmt&amp;lt;/font&amp;gt;. Creating the format&lt;br /&gt;
description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; solves both problems.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file that describes latlon&lt;br /&gt;
/ data in files with the extension .ll&lt;br /&gt;
&lt;br /&gt;
ASCII_input_data &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 10 double 6&lt;br /&gt;
longitude 12 22 double 6&lt;br /&gt;
&lt;br /&gt;
binary_output_data &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
latitude 1 4 long 6&lt;br /&gt;
longitude 5 8 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name used for the format description file, &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;, follows&lt;br /&gt;
the FreeForm ND convention that one format description file can be&lt;br /&gt;
utilized for multiple data files, all with the same extension, if the&lt;br /&gt;
format description file is named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. Also, the read/write&lt;br /&gt;
type (input or output) is made explicit by including it in the format&lt;br /&gt;
descriptors &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; and &amp;lt;font color=&#039;green&#039;&amp;gt;binary_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
This provides the context needed for FreeForm ND programs to determine&lt;br /&gt;
which format to use for input and which for output.&lt;br /&gt;
&lt;br /&gt;
Use the following commands to produce binary versions of the ASCII&lt;br /&gt;
input files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform lldat1.ll -o llbin1.ll&lt;br /&gt;
newform lldat2.ll -o llbin2.ll&lt;br /&gt;
newform lldat3.ll -o llbin3.ll&lt;br /&gt;
newform lldat4.ll -o llbin4.ll&lt;br /&gt;
newform lldat5.ll -o llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to convert back to ASCII, you can switch the words input&lt;br /&gt;
and output in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You could then&lt;br /&gt;
use the following commands to convert back to native ASCII format with&lt;br /&gt;
output written to the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llbin1.ll&lt;br /&gt;
newform llbin2.ll&lt;br /&gt;
newform llbin3.ll&lt;br /&gt;
newform llbin4.ll&lt;br /&gt;
newform llbin5.ll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is also possible to convert back to ASCII without switching the&lt;br /&gt;
read/write types input and output in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt;. You can specify&lt;br /&gt;
input and output formats by title instead. In this case, you want to&lt;br /&gt;
use the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the input format and the&lt;br /&gt;
input format in &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; as the output format. Use the following&lt;br /&gt;
command to convert &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; back to ASCII:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform &amp;lt;font color=&#039;green&#039;&amp;gt;llbin1.ll&amp;lt;/font&amp;gt; -ift &amp;quot;binary format for .ll latlon data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;ASCII format for .ll latlon data&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports back the read/write type actually&lt;br /&gt;
used. Since &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt; was used as the output format,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; reports it as &amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_output_data&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;llvals.asc&amp;lt;/font&amp;gt; (not included in the example file set) to the binary&lt;br /&gt;
file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.bin&amp;lt;/font&amp;gt;, and the input and output data formats are&lt;br /&gt;
described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. The data file names do not provide the&lt;br /&gt;
context allowing &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt; to find &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; by default, so&lt;br /&gt;
you must include all file names on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform llvals.asc -f latlon.fmt -o latlon3.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Nonstandard&amp;quot; Format Description File Names===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using a format description file that does not follow&lt;br /&gt;
FreeForm ND file naming conventions, you must include its name on the&lt;br /&gt;
command line. Assume that you want to convert the ASCII data file&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt; to the binary file &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;, and the input&lt;br /&gt;
and output data formats are both described in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt; (not&lt;br /&gt;
included in the example file set). The data file names follow FreeForm&lt;br /&gt;
ND conventions, but the name of the format description file does not,&lt;br /&gt;
so it will not be located through the default search sequence. Use the&lt;br /&gt;
following command to convert to binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -f llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Suppose now that the input format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt; and&lt;br /&gt;
the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;llvals.frm&amp;lt;/font&amp;gt;. You do not need to explicitly&lt;br /&gt;
specify the input format description file because it will be located&lt;br /&gt;
by default, but you must specify the output format description file&lt;br /&gt;
name. In this case, the command would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.dat -of llvals.frm -o latlon.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can always unambiguously specify the names of format description&lt;br /&gt;
files and data files, whether or not their names follow FreeForm ND&lt;br /&gt;
conventions. Assume you want to look only at longitude values in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; and that you want them defined as integers (longs)&lt;br /&gt;
which are right-justified at column 30. You will reformat the&lt;br /&gt;
specified binary data in &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt; into ASCII data in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt; and then view it. The input format is found in&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;, the output format in &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for viewing longitude as an&lt;br /&gt;
/ integer value right-justified at column 30.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;ASCII output format, right-justified at 30&amp;quot;&lt;br /&gt;
longitude 20 30 long 6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, you have decided to look at the first 5 longitude values. Use the following command to unambiguously designate all files involved:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform latlon.bin -if latlon.fmt -of longonly.fmt -c 5&lt;br /&gt;
-o longonly.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you view &amp;lt;font color=&#039;green&#039;&amp;gt;longonly.dat&amp;lt;/font&amp;gt;, you should see the following 5 values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1         2         3         4&lt;br /&gt;
1234567890123456789012345678901234567890&lt;br /&gt;
&lt;br /&gt;
-176161101&lt;br /&gt;
777265&lt;br /&gt;
35591879&lt;br /&gt;
149408117&lt;br /&gt;
55319598&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changing ASCII Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may encounter situations where a specific ASCII format is&lt;br /&gt;
required, and your data cannot be used in its native ASCII format.&lt;br /&gt;
With &amp;lt;font color=&#039;green&#039;&amp;gt;newform&amp;lt;/font&amp;gt;, you can easily reformat one ASCII format to&lt;br /&gt;
another. In this example, you will reformat California earthquake data&lt;br /&gt;
from one ASCII format to three other ASCII formats commonly used for&lt;br /&gt;
such data.The file &amp;lt;font color=&#039;green&#039;&amp;gt;calif.tap&amp;lt;/font&amp;gt; contains data about earthquakes in&lt;br /&gt;
California with magnitudes &amp;gt; 5.0 since 1980. The data were initially&lt;br /&gt;
distributed by NGDC on tape, hence the &amp;lt;font color=&#039;green&#039;&amp;gt;.tap&amp;lt;/font&amp;gt; extension. The data&lt;br /&gt;
format is described in &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;eqtape.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This is the format description file for the NGDC .tap format,&lt;br /&gt;
/ which is used for data distributed on floppy disks or tapes.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;.tap format&amp;quot;&lt;br /&gt;
source_code 1 3 char 0&lt;br /&gt;
century 4 6 short 0&lt;br /&gt;
year 7 8 short 0&lt;br /&gt;
month 9 10 short 0&lt;br /&gt;
day 11 12 short 0&lt;br /&gt;
hour 13 14 short 0&lt;br /&gt;
minute 15 16 short 0&lt;br /&gt;
second 17 19 short 1&lt;br /&gt;
latitude_abs 20 24 long 3&lt;br /&gt;
latitude_ns 25 25 char 0&lt;br /&gt;
longitude_abs 26 31 long 3&lt;br /&gt;
longitude_ew 32 32 char 0&lt;br /&gt;
depth 33 35 short 0&lt;br /&gt;
magnitude_mb 36 38 short 2&lt;br /&gt;
MB 39 40 constant 0&lt;br /&gt;
isoseismal 41 43 char 0&lt;br /&gt;
intensity 44 44 char 0&lt;br /&gt;
&lt;br /&gt;
/ The NGDC record check format includes&lt;br /&gt;
/ six flags in characters 45 to 50. These&lt;br /&gt;
/ can be treated as one variable to allow&lt;br /&gt;
/ multiple flags to be set in a single pass,&lt;br /&gt;
/ or each can be set by itself.&lt;br /&gt;
&lt;br /&gt;
ngdc_flags 45 50 char 0&lt;br /&gt;
diastrophic 45 45 char 0&lt;br /&gt;
tsunami 46 46 char 0&lt;br /&gt;
seiche 47 47 char 0&lt;br /&gt;
volcanism 48 48 char 0&lt;br /&gt;
non_tectonic 49 49 char 0&lt;br /&gt;
infrasonic 50 50 char 0&lt;br /&gt;
&lt;br /&gt;
fe_region 51 53 short 0&lt;br /&gt;
magnitude_ms 54 55 short 1&lt;br /&gt;
MS 56 57 char 0&lt;br /&gt;
z_h 58 58 char 0&lt;br /&gt;
cultural 59 59 char 0&lt;br /&gt;
other 60 60 char 0&lt;br /&gt;
magnitude_other 61 63 short 2&lt;br /&gt;
other_authority 64 66 char 0&lt;br /&gt;
ide 67 67 char 0&lt;br /&gt;
depth_control 68 68 char 0&lt;br /&gt;
number_stations_qual 69 71 char 0&lt;br /&gt;
time_authority 72 72 char 0&lt;br /&gt;
magnitude_local 73 75 short 2&lt;br /&gt;
local_scale 76 77 char 0&lt;br /&gt;
local_authority 78 80 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Three other formats used for California earthquake data are&lt;br /&gt;
hypoellipse, hypoinverse, and hypo71. Subsets of these formats are&lt;br /&gt;
described in the format description file &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt;. The format&lt;br /&gt;
descriptions include the parameters required by the AcroSpin program&lt;br /&gt;
that is distributed as part of the IASPEI Software Library (Volume 2).&lt;br /&gt;
AcroSpin shows 3D views of earthquake point data.&lt;br /&gt;
&lt;br /&gt;
Here is the &amp;lt;font color=&#039;green&#039;&amp;gt;hypo.fmt&amp;lt;/font&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/ This format description file describes subsets of the&lt;br /&gt;
/ hypoellipse, hypoinverse, and hypo71 formats.&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoellipse format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypoinverse format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 7 8 uchar 0&lt;br /&gt;
minute 9 10 uchar 0&lt;br /&gt;
second 11 14 ushort 2&lt;br /&gt;
latitude_deg_abs 15 16 uchar 0&lt;br /&gt;
latitude_ns 17 17 char 0&lt;br /&gt;
latitude_min 18 21 ushort 2&lt;br /&gt;
longitude_deg_abs 22 24 uchar 0&lt;br /&gt;
longitude_ew 25 25 char 0&lt;br /&gt;
longitude_min 26 29 ushort 2&lt;br /&gt;
depth 30 34 short 2&lt;br /&gt;
magnitude_local 35 36 uchar 1&lt;br /&gt;
number_of_times 37 39 short 0&lt;br /&gt;
maximum_azimuthal_gap 40 42 short 0&lt;br /&gt;
nearest_station 43 45 short 1&lt;br /&gt;
rms_travel_time_residual 46 49 short 2&lt;br /&gt;
&lt;br /&gt;
ASCII_data &amp;quot;hypo71 format&amp;quot;&lt;br /&gt;
year 1 2 uchar 0&lt;br /&gt;
month 3 4 uchar 0&lt;br /&gt;
day 5 6 uchar 0&lt;br /&gt;
hour 8 9 uchar 0&lt;br /&gt;
minute 10 11 uchar 0&lt;br /&gt;
second 12 17 float 2&lt;br /&gt;
latitude_deg_abs 18 20 uchar 0&lt;br /&gt;
latitude_ns 21 21 char 0&lt;br /&gt;
latitude_min 22 26 float 2&lt;br /&gt;
longitude_deg_abs 27 30 uchar 0&lt;br /&gt;
longitude_ew 31 31 char 0&lt;br /&gt;
longitude_min 32 36 float 2&lt;br /&gt;
depth 37 43 float 2&lt;br /&gt;
magnitude_local 44 50 float 2&lt;br /&gt;
number_of_times 51 53 short 0&lt;br /&gt;
maximum_azimuthal_gap 54 57 float 0&lt;br /&gt;
nearest_station 58 62 short 1&lt;br /&gt;
rms_travel_time_residual 63 67 float 2&lt;br /&gt;
error_horizontal 68 72 float 1&lt;br /&gt;
error_vertical 73 77 float 1&lt;br /&gt;
s_waves_used 79 79 char 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The parameters from the California earthquake data in the NGDC format&lt;br /&gt;
needed for use with the AcroSpin program can be extracted and&lt;br /&gt;
converted using the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoellipse format&amp;quot; -o calif.he&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypoinverse format&amp;quot; -o calif.hi&lt;br /&gt;
newform calif.tap -if eqtape.fmt -of hypo.fmt&lt;br /&gt;
&lt;br /&gt;
-oft &amp;quot;hypo71 format&amp;quot; -o calif.h71&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you develop an application that accesses seismicity data in a&lt;br /&gt;
particular ASCII format, you need only to write an appropriate format&lt;br /&gt;
description file in order to convert NGDC data into the format used by&lt;br /&gt;
the application. This lets you make use of the data that NGDC provides&lt;br /&gt;
in a format that works for you.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2019</id>
		<title>Wiki Testing/convs</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2019"/>
		<updated>2008-02-06T15:15:44Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Defining Filters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=FreeForm ND Conventions=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File name conventions have been defined for FreeForm ND. If you follow&lt;br /&gt;
these conventions, FreeForm ND can locate format files through a&lt;br /&gt;
default search sequence. Using the file name conventions also lets you&lt;br /&gt;
reduce the number of arguments on the command line. In addition to&lt;br /&gt;
standard file names, FreeForm ND programs recognize various standard&lt;br /&gt;
command line arguments.&lt;br /&gt;
&lt;br /&gt;
==File Name Conventions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Naming conventions have been established for files accessed by&lt;br /&gt;
FreeForm ND. Although you are not required to follow these&lt;br /&gt;
conventions, using them lets you enter abbreviated commands when you&lt;br /&gt;
are using FreeForm ND-based programs. FreeForm ND can then&lt;br /&gt;
automatically execute several operations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  Determination of input and output formats when they are not explicitly identified in the relevant format descriptions in format files&lt;br /&gt;
*  Location of format files when they are not specified on the command line&lt;br /&gt;
&lt;br /&gt;
==File Name Extensions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extensions for data files are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; :  For ASCII, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; : For dBASE, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dab&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; : binary or anything that is not &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. You should not use mixed case extensions for format&lt;br /&gt;
description files if you want to take advantage of FreeForm ND&#039;s&lt;br /&gt;
default search capabilities. If you explicitly specify the names of&lt;br /&gt;
format description files on the command line, you can use mixed case&lt;br /&gt;
extensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(formerly called format specification files) each of which contained&lt;br /&gt;
variable descriptions for one file. Expected extensions for these&lt;br /&gt;
files were &amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt; (ASCII), &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt; (binary), and &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt; (dBASE). Variable descriptions for one or more files can now be&lt;br /&gt;
incorporated into a single format description file. It is&lt;br /&gt;
recommended that you convert and combine (as appropriate) existing&lt;br /&gt;
variable description files into format description files.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Name Relationships==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND-based programs expect certain relationships between data&lt;br /&gt;
file and format description file names as outlined below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  The data file is named datafile.ext where datafile is the file name of your choosing and ext is the extension. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
*  The corresponding format description file should be named datafile.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;&lt;br /&gt;
*  If one format description file is used for multiple data files, all with the same extension, the format description file should be named ext.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; is the format description file for &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Again, although not required, it is to your advantage to use these&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
==Determining Input and Output Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can optionally include the read/write type (&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;input&amp;lt;/font&amp;gt;&amp;quot; or&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;output&amp;lt;/font&amp;gt;&amp;quot;) in format descriptors, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt;. You may not want to specify the read/write&lt;br /&gt;
type in some circumstances. For example, you may need to translate&lt;br /&gt;
from native ASCII to binary, then back to ASCII. ASCII is the input&lt;br /&gt;
format in the first translation and the output format in the second&lt;br /&gt;
translation, vice versa for binary. You would need to edit the format&lt;br /&gt;
description file before executing the second translation if you&lt;br /&gt;
included read/write type in the format descriptors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;If you use the -ft option, you do not need to edit the format&lt;br /&gt;
description file. See ([[Wiki_Testing/convs|Section 8.6.2]]) later&lt;br /&gt;
in this chapter.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not specify read/write type, FreeForm ND can nevertheless&lt;br /&gt;
determine which format in a format description file is input and which&lt;br /&gt;
is output as long as you have adhered to FreeForm ND filenaming&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*If the input format is not specified, and&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;, assume binary input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, assume dBASE input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;, assume ASCII input.&lt;br /&gt;
**the input data filename extension is anything else, assume binary input.&lt;br /&gt;
*:&lt;br /&gt;
*If the output format is not specified, and&lt;br /&gt;
**the input format is dBASE, the output is ASCII or binary, whichever is found first.&lt;br /&gt;
**the input format is ASCII, the output is binary or dBASE, whichever is found first.&lt;br /&gt;
*:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;The appropriate format descriptions must be in the format&lt;br /&gt;
description file(s) used by FreeForm ND for a translation. If, for&lt;br /&gt;
example, FreeForm ND determines the input format is binary and the&lt;br /&gt;
output format is ASCII, there must be a format description for each&lt;br /&gt;
type. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The checkvar program needs only an input format.&lt;br /&gt;
&lt;br /&gt;
==Locating Format Files==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs use the following search sequence to find a&lt;br /&gt;
format file (format or variable description file) for the data file&lt;br /&gt;
datafile.ext when the format file name is not explicitly specified on&lt;br /&gt;
the command line. In summary, FreeForm ND searches the directory&lt;br /&gt;
specified by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; (defined in a equivalence&lt;br /&gt;
table or in the environment), the current or working directory, and&lt;br /&gt;
the data file&#039;s home directory. The rules are applied in the order&lt;br /&gt;
given below until a format file is found or all rules have been&lt;br /&gt;
exhausted. If the relevant format file does not follow FreeForm ND&lt;br /&gt;
conventions for name or location, it should be explicitly specified on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;GeoVu is a FreeForm ND-based application for data access and&lt;br /&gt;
visualization. FreeForm ND applications other than GeoVu use GeoVu&lt;br /&gt;
keywords. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For information about equivalence tables, see the GeoVu Tools&lt;br /&gt;
Reference Guide, available from the NGDC.&lt;br /&gt;
&lt;br /&gt;
===Search Sequence===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named datafile.fmt.&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. &amp;lt;blockquote&amp;gt;Step 2 is included to accommodate variable description files that were created using previous versions of FreeForm ND. It is recommended that you convert existing variable description files to format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named ext.fmt. If the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; is not found, FreeForm ND continues the search for a format file as follows.&lt;br /&gt;
#Search the current (default) directory for a format description file named datafile.fmt.&lt;br /&gt;
#Search the current directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the current directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. If the data file&#039;s home directory is not the same as the current directory, FreeForm ND continues the search for a format file with steps 7-9. The data file&#039;s home directory is given by the directory path component of the data file name. If the data file name has no directory path component, the home directory search is not done.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
#Search the data file&#039;s home directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Case Sensitivity===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND adheres to the following rules for case sensitivity (in&lt;br /&gt;
applicable operating systems) when it searches for a format file for&lt;br /&gt;
the data file datafile.ext.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*FreeForm ND preserves the case of datafile, for example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.BIN&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.bfm&amp;lt;/font&amp;gt;).&lt;br /&gt;
*FreeForm ND searches for a format file with a lower case extension. That is, the format file must have its extension in lower case no matter what the case of datafile. For example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.dat&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.afm&amp;lt;/font&amp;gt;), and &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bfm&amp;lt;/font&amp;gt;) is the default format file for &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
*In searching for a format description file of type &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;, FreeForm ND preserves the case of ext. For example, for data files named &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.LL&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.LL&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.LL&amp;lt;/font&amp;gt;, the default format description file is &amp;lt;font color=&#039;green&#039;&amp;gt;LL.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Command Line Arguments==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs can take various command line arguments. The most&lt;br /&gt;
widely used or standard arguments are discussed in this section. They&lt;br /&gt;
are used for several different purposes: identifying input and output&lt;br /&gt;
files, identifying format files and titles, changing run-time&lt;br /&gt;
operation parameters, and defining data filters.&lt;br /&gt;
&lt;br /&gt;
The only required argument for any FreeForm ND program is the name of&lt;br /&gt;
the input file or file to be processed. All other arguments are&lt;br /&gt;
optional and can be in any order following the input file name. The&lt;br /&gt;
command line of a FreeForm ND program with the standard arguments has&lt;br /&gt;
the following form:&lt;br /&gt;
&lt;br /&gt;
application_name input_file [-f format_file]&lt;br /&gt;
&lt;br /&gt;
[-if input_format_file] [-of output_format_file] [-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: To see a summary of command line usage for a FreeForm ND&lt;br /&gt;
program, enter the program&#039;s name on the command line without any&lt;br /&gt;
arguments.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Specifying Input and Output Files===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;input_file&#039;&#039;&#039; : Name of the file to be processed. Following FreeForm ND naming&lt;br /&gt;
conventions, the standard extensions for data files are &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; for ASCII format, &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; for binary, and &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; for dBASE.&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;-o output_file&#039;&#039;&#039; : Option flag followed by the name of the output file. The standard extensions are the same as for input files.&lt;br /&gt;
&lt;br /&gt;
===Specifying Format Description Source===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND offers a number of command line options for specifying the&lt;br /&gt;
source of the format descriptions that a program must find in order to&lt;br /&gt;
process data. The proper option or combination of options to use&lt;br /&gt;
depends on how you have constructed your format files.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; -f format_file : Option flag followed by the name of the format description file&lt;br /&gt;
describing both input and output data.&lt;br /&gt;
&lt;br /&gt;
; -if input_format_file : Option flag followed by the name of the format description file describing the input data. Also use this option for an input variable description file written using earlier versions of FreeForm ND.&lt;br /&gt;
&lt;br /&gt;
; -of output_format_file : Option flag followed by the name of the format description file describing the output data. Also use this option for an output variable description file written using earlier versions of FreeForm ND.&lt;br /&gt;
&lt;br /&gt;
; -ft title : Option flag followed by the title (enclosed in quotes) of the format to be used for both input and output data, in which case there is no reformatting. The title follows format type on the first line of a format description in a format description file.&lt;br /&gt;
&lt;br /&gt;
; -ift title : Option flag followed by the title (enclosed in quotes) of the desired input format.&lt;br /&gt;
&lt;br /&gt;
; -oft title : Option flag followed by the title (enclosed in quotes) of the desired output format.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(&amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt;). It is recommended that you&lt;br /&gt;
convert and combine (as appropriate) existing variable description&lt;br /&gt;
files into format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The various options available for specifying the source of a format&lt;br /&gt;
description offer you a great deal of flexibility-in naming files,&lt;br /&gt;
setting up format description files, and on the command line. In using&lt;br /&gt;
these options, you need to consider the content of your format&lt;br /&gt;
description files and how FreeForm ND will interpret the arguments on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
===Changing Run-time Parameters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes three arguments that let you change run-time&lt;br /&gt;
parameters according to your needs. One argument lets you specify&lt;br /&gt;
local buffer size, another indicates the number of records to process,&lt;br /&gt;
and the third indicates which variables to process.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; -b local_buffer_size: Option flag followed by the size of the memory buffer used to&lt;br /&gt;
process the data and format files. Default buffer size is 32,768. You many want to decrease the buffer size if you are running with low memory. Keep in mind that too small a buffer may result in unexpected behavior.&lt;br /&gt;
&lt;br /&gt;
; -c count: Option flag followed by a number that specifies how many data&lt;br /&gt;
records at the head or tail of the file to process. If &amp;lt;math&amp;gt;count &amp;gt; 0&amp;lt;/math&amp;gt;, \var{count} records at the beginning of the file are processed. If &amp;lt;math&amp;gt;count &amp;lt; 0&amp;lt;/math&amp;gt;, \var{count} records at the tail or end of the file are processed.&lt;br /&gt;
&lt;br /&gt;
; -v var_file : Option flag followed by the name of a variable file. The file&lt;br /&gt;
contains names of the variables in the input data file to be processed by the FreeForm ND program. Variable names in var_file can be separated by one or more spaces or each name can be on a separate line.&lt;br /&gt;
&lt;br /&gt;
===Defining Filters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The query option lets you define data filters via a query file so you&lt;br /&gt;
can precisely specify which data to process. The FreeForm ND program&lt;br /&gt;
will process only those records meeting the query criteria.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; -q query_file :&lt;br /&gt;
Option flag followed by the name of the file containing query&lt;br /&gt;
criteria. See ([[Wiki_Testing/fileserv| Chapter 7]]) for a complete description of&lt;br /&gt;
the query syntax.&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2018</id>
		<title>Wiki Testing/convs</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2018"/>
		<updated>2008-02-06T15:14:49Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Changing Run-time Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=FreeForm ND Conventions=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File name conventions have been defined for FreeForm ND. If you follow&lt;br /&gt;
these conventions, FreeForm ND can locate format files through a&lt;br /&gt;
default search sequence. Using the file name conventions also lets you&lt;br /&gt;
reduce the number of arguments on the command line. In addition to&lt;br /&gt;
standard file names, FreeForm ND programs recognize various standard&lt;br /&gt;
command line arguments.&lt;br /&gt;
&lt;br /&gt;
==File Name Conventions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Naming conventions have been established for files accessed by&lt;br /&gt;
FreeForm ND. Although you are not required to follow these&lt;br /&gt;
conventions, using them lets you enter abbreviated commands when you&lt;br /&gt;
are using FreeForm ND-based programs. FreeForm ND can then&lt;br /&gt;
automatically execute several operations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  Determination of input and output formats when they are not explicitly identified in the relevant format descriptions in format files&lt;br /&gt;
*  Location of format files when they are not specified on the command line&lt;br /&gt;
&lt;br /&gt;
==File Name Extensions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extensions for data files are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; :  For ASCII, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; : For dBASE, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dab&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; : binary or anything that is not &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. You should not use mixed case extensions for format&lt;br /&gt;
description files if you want to take advantage of FreeForm ND&#039;s&lt;br /&gt;
default search capabilities. If you explicitly specify the names of&lt;br /&gt;
format description files on the command line, you can use mixed case&lt;br /&gt;
extensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(formerly called format specification files) each of which contained&lt;br /&gt;
variable descriptions for one file. Expected extensions for these&lt;br /&gt;
files were &amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt; (ASCII), &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt; (binary), and &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt; (dBASE). Variable descriptions for one or more files can now be&lt;br /&gt;
incorporated into a single format description file. It is&lt;br /&gt;
recommended that you convert and combine (as appropriate) existing&lt;br /&gt;
variable description files into format description files.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Name Relationships==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND-based programs expect certain relationships between data&lt;br /&gt;
file and format description file names as outlined below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  The data file is named datafile.ext where datafile is the file name of your choosing and ext is the extension. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
*  The corresponding format description file should be named datafile.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;&lt;br /&gt;
*  If one format description file is used for multiple data files, all with the same extension, the format description file should be named ext.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; is the format description file for &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Again, although not required, it is to your advantage to use these&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
==Determining Input and Output Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can optionally include the read/write type (&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;input&amp;lt;/font&amp;gt;&amp;quot; or&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;output&amp;lt;/font&amp;gt;&amp;quot;) in format descriptors, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt;. You may not want to specify the read/write&lt;br /&gt;
type in some circumstances. For example, you may need to translate&lt;br /&gt;
from native ASCII to binary, then back to ASCII. ASCII is the input&lt;br /&gt;
format in the first translation and the output format in the second&lt;br /&gt;
translation, vice versa for binary. You would need to edit the format&lt;br /&gt;
description file before executing the second translation if you&lt;br /&gt;
included read/write type in the format descriptors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;If you use the -ft option, you do not need to edit the format&lt;br /&gt;
description file. See ([[Wiki_Testing/convs|Section 8.6.2]]) later&lt;br /&gt;
in this chapter.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not specify read/write type, FreeForm ND can nevertheless&lt;br /&gt;
determine which format in a format description file is input and which&lt;br /&gt;
is output as long as you have adhered to FreeForm ND filenaming&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*If the input format is not specified, and&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;, assume binary input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, assume dBASE input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;, assume ASCII input.&lt;br /&gt;
**the input data filename extension is anything else, assume binary input.&lt;br /&gt;
*:&lt;br /&gt;
*If the output format is not specified, and&lt;br /&gt;
**the input format is dBASE, the output is ASCII or binary, whichever is found first.&lt;br /&gt;
**the input format is ASCII, the output is binary or dBASE, whichever is found first.&lt;br /&gt;
*:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;The appropriate format descriptions must be in the format&lt;br /&gt;
description file(s) used by FreeForm ND for a translation. If, for&lt;br /&gt;
example, FreeForm ND determines the input format is binary and the&lt;br /&gt;
output format is ASCII, there must be a format description for each&lt;br /&gt;
type. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The checkvar program needs only an input format.&lt;br /&gt;
&lt;br /&gt;
==Locating Format Files==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs use the following search sequence to find a&lt;br /&gt;
format file (format or variable description file) for the data file&lt;br /&gt;
datafile.ext when the format file name is not explicitly specified on&lt;br /&gt;
the command line. In summary, FreeForm ND searches the directory&lt;br /&gt;
specified by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; (defined in a equivalence&lt;br /&gt;
table or in the environment), the current or working directory, and&lt;br /&gt;
the data file&#039;s home directory. The rules are applied in the order&lt;br /&gt;
given below until a format file is found or all rules have been&lt;br /&gt;
exhausted. If the relevant format file does not follow FreeForm ND&lt;br /&gt;
conventions for name or location, it should be explicitly specified on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;GeoVu is a FreeForm ND-based application for data access and&lt;br /&gt;
visualization. FreeForm ND applications other than GeoVu use GeoVu&lt;br /&gt;
keywords. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For information about equivalence tables, see the GeoVu Tools&lt;br /&gt;
Reference Guide, available from the NGDC.&lt;br /&gt;
&lt;br /&gt;
===Search Sequence===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named datafile.fmt.&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. &amp;lt;blockquote&amp;gt;Step 2 is included to accommodate variable description files that were created using previous versions of FreeForm ND. It is recommended that you convert existing variable description files to format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named ext.fmt. If the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; is not found, FreeForm ND continues the search for a format file as follows.&lt;br /&gt;
#Search the current (default) directory for a format description file named datafile.fmt.&lt;br /&gt;
#Search the current directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the current directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. If the data file&#039;s home directory is not the same as the current directory, FreeForm ND continues the search for a format file with steps 7-9. The data file&#039;s home directory is given by the directory path component of the data file name. If the data file name has no directory path component, the home directory search is not done.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
#Search the data file&#039;s home directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Case Sensitivity===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND adheres to the following rules for case sensitivity (in&lt;br /&gt;
applicable operating systems) when it searches for a format file for&lt;br /&gt;
the data file datafile.ext.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*FreeForm ND preserves the case of datafile, for example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.BIN&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.bfm&amp;lt;/font&amp;gt;).&lt;br /&gt;
*FreeForm ND searches for a format file with a lower case extension. That is, the format file must have its extension in lower case no matter what the case of datafile. For example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.dat&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.afm&amp;lt;/font&amp;gt;), and &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bfm&amp;lt;/font&amp;gt;) is the default format file for &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
*In searching for a format description file of type &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;, FreeForm ND preserves the case of ext. For example, for data files named &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.LL&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.LL&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.LL&amp;lt;/font&amp;gt;, the default format description file is &amp;lt;font color=&#039;green&#039;&amp;gt;LL.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Command Line Arguments==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs can take various command line arguments. The most&lt;br /&gt;
widely used or standard arguments are discussed in this section. They&lt;br /&gt;
are used for several different purposes: identifying input and output&lt;br /&gt;
files, identifying format files and titles, changing run-time&lt;br /&gt;
operation parameters, and defining data filters.&lt;br /&gt;
&lt;br /&gt;
The only required argument for any FreeForm ND program is the name of&lt;br /&gt;
the input file or file to be processed. All other arguments are&lt;br /&gt;
optional and can be in any order following the input file name. The&lt;br /&gt;
command line of a FreeForm ND program with the standard arguments has&lt;br /&gt;
the following form:&lt;br /&gt;
&lt;br /&gt;
application_name input_file [-f format_file]&lt;br /&gt;
&lt;br /&gt;
[-if input_format_file] [-of output_format_file] [-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: To see a summary of command line usage for a FreeForm ND&lt;br /&gt;
program, enter the program&#039;s name on the command line without any&lt;br /&gt;
arguments.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Specifying Input and Output Files===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;input_file&#039;&#039;&#039; : Name of the file to be processed. Following FreeForm ND naming&lt;br /&gt;
conventions, the standard extensions for data files are &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; for ASCII format, &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; for binary, and &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; for dBASE.&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;-o output_file&#039;&#039;&#039; : Option flag followed by the name of the output file. The standard extensions are the same as for input files.&lt;br /&gt;
&lt;br /&gt;
===Specifying Format Description Source===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND offers a number of command line options for specifying the&lt;br /&gt;
source of the format descriptions that a program must find in order to&lt;br /&gt;
process data. The proper option or combination of options to use&lt;br /&gt;
depends on how you have constructed your format files.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; -f format_file : Option flag followed by the name of the format description file&lt;br /&gt;
describing both input and output data.&lt;br /&gt;
&lt;br /&gt;
; -if input_format_file : Option flag followed by the name of the format description file describing the input data. Also use this option for an input variable description file written using earlier versions of FreeForm ND.&lt;br /&gt;
&lt;br /&gt;
; -of output_format_file : Option flag followed by the name of the format description file describing the output data. Also use this option for an output variable description file written using earlier versions of FreeForm ND.&lt;br /&gt;
&lt;br /&gt;
; -ft title : Option flag followed by the title (enclosed in quotes) of the format to be used for both input and output data, in which case there is no reformatting. The title follows format type on the first line of a format description in a format description file.&lt;br /&gt;
&lt;br /&gt;
; -ift title : Option flag followed by the title (enclosed in quotes) of the desired input format.&lt;br /&gt;
&lt;br /&gt;
; -oft title : Option flag followed by the title (enclosed in quotes) of the desired output format.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(&amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt;). It is recommended that you&lt;br /&gt;
convert and combine (as appropriate) existing variable description&lt;br /&gt;
files into format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The various options available for specifying the source of a format&lt;br /&gt;
description offer you a great deal of flexibility-in naming files,&lt;br /&gt;
setting up format description files, and on the command line. In using&lt;br /&gt;
these options, you need to consider the content of your format&lt;br /&gt;
description files and how FreeForm ND will interpret the arguments on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
===Changing Run-time Parameters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes three arguments that let you change run-time&lt;br /&gt;
parameters according to your needs. One argument lets you specify&lt;br /&gt;
local buffer size, another indicates the number of records to process,&lt;br /&gt;
and the third indicates which variables to process.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; -b local_buffer_size: Option flag followed by the size of the memory buffer used to&lt;br /&gt;
process the data and format files. Default buffer size is 32,768. You many want to decrease the buffer size if you are running with low memory. Keep in mind that too small a buffer may result in unexpected behavior.&lt;br /&gt;
&lt;br /&gt;
; -c count: Option flag followed by a number that specifies how many data&lt;br /&gt;
records at the head or tail of the file to process. If &amp;lt;math&amp;gt;count &amp;gt; 0&amp;lt;/math&amp;gt;, \var{count} records at the beginning of the file are processed. If &amp;lt;math&amp;gt;count &amp;lt; 0&amp;lt;/math&amp;gt;, \var{count} records at the tail or end of the file are processed.&lt;br /&gt;
&lt;br /&gt;
; -v var_file : Option flag followed by the name of a variable file. The file&lt;br /&gt;
contains names of the variables in the input data file to be processed by the FreeForm ND program. Variable names in var_file can be separated by one or more spaces or each name can be on a separate line.&lt;br /&gt;
&lt;br /&gt;
===Defining Filters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The query option lets you define data filters via a query file so you&lt;br /&gt;
can precisely specify which data to process. The FreeForm ND program&lt;br /&gt;
will process only those records meeting the query criteria.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -q query_file :&lt;br /&gt;
Option flag followed by the name of the file containing query&lt;br /&gt;
criteria. See ([http://www &amp;lt;cite&amp;gt; ff,query&amp;lt;/cite&amp;gt;]) for a complete description of&lt;br /&gt;
the query syntax.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2017</id>
		<title>Wiki Testing/convs</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2017"/>
		<updated>2008-02-06T15:13:53Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Specifying Format Description Source */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=FreeForm ND Conventions=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File name conventions have been defined for FreeForm ND. If you follow&lt;br /&gt;
these conventions, FreeForm ND can locate format files through a&lt;br /&gt;
default search sequence. Using the file name conventions also lets you&lt;br /&gt;
reduce the number of arguments on the command line. In addition to&lt;br /&gt;
standard file names, FreeForm ND programs recognize various standard&lt;br /&gt;
command line arguments.&lt;br /&gt;
&lt;br /&gt;
==File Name Conventions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Naming conventions have been established for files accessed by&lt;br /&gt;
FreeForm ND. Although you are not required to follow these&lt;br /&gt;
conventions, using them lets you enter abbreviated commands when you&lt;br /&gt;
are using FreeForm ND-based programs. FreeForm ND can then&lt;br /&gt;
automatically execute several operations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  Determination of input and output formats when they are not explicitly identified in the relevant format descriptions in format files&lt;br /&gt;
*  Location of format files when they are not specified on the command line&lt;br /&gt;
&lt;br /&gt;
==File Name Extensions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extensions for data files are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; :  For ASCII, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; : For dBASE, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dab&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; : binary or anything that is not &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. You should not use mixed case extensions for format&lt;br /&gt;
description files if you want to take advantage of FreeForm ND&#039;s&lt;br /&gt;
default search capabilities. If you explicitly specify the names of&lt;br /&gt;
format description files on the command line, you can use mixed case&lt;br /&gt;
extensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(formerly called format specification files) each of which contained&lt;br /&gt;
variable descriptions for one file. Expected extensions for these&lt;br /&gt;
files were &amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt; (ASCII), &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt; (binary), and &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt; (dBASE). Variable descriptions for one or more files can now be&lt;br /&gt;
incorporated into a single format description file. It is&lt;br /&gt;
recommended that you convert and combine (as appropriate) existing&lt;br /&gt;
variable description files into format description files.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Name Relationships==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND-based programs expect certain relationships between data&lt;br /&gt;
file and format description file names as outlined below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  The data file is named datafile.ext where datafile is the file name of your choosing and ext is the extension. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
*  The corresponding format description file should be named datafile.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;&lt;br /&gt;
*  If one format description file is used for multiple data files, all with the same extension, the format description file should be named ext.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; is the format description file for &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Again, although not required, it is to your advantage to use these&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
==Determining Input and Output Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can optionally include the read/write type (&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;input&amp;lt;/font&amp;gt;&amp;quot; or&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;output&amp;lt;/font&amp;gt;&amp;quot;) in format descriptors, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt;. You may not want to specify the read/write&lt;br /&gt;
type in some circumstances. For example, you may need to translate&lt;br /&gt;
from native ASCII to binary, then back to ASCII. ASCII is the input&lt;br /&gt;
format in the first translation and the output format in the second&lt;br /&gt;
translation, vice versa for binary. You would need to edit the format&lt;br /&gt;
description file before executing the second translation if you&lt;br /&gt;
included read/write type in the format descriptors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;If you use the -ft option, you do not need to edit the format&lt;br /&gt;
description file. See ([[Wiki_Testing/convs|Section 8.6.2]]) later&lt;br /&gt;
in this chapter.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not specify read/write type, FreeForm ND can nevertheless&lt;br /&gt;
determine which format in a format description file is input and which&lt;br /&gt;
is output as long as you have adhered to FreeForm ND filenaming&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*If the input format is not specified, and&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;, assume binary input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, assume dBASE input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;, assume ASCII input.&lt;br /&gt;
**the input data filename extension is anything else, assume binary input.&lt;br /&gt;
*:&lt;br /&gt;
*If the output format is not specified, and&lt;br /&gt;
**the input format is dBASE, the output is ASCII or binary, whichever is found first.&lt;br /&gt;
**the input format is ASCII, the output is binary or dBASE, whichever is found first.&lt;br /&gt;
*:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;The appropriate format descriptions must be in the format&lt;br /&gt;
description file(s) used by FreeForm ND for a translation. If, for&lt;br /&gt;
example, FreeForm ND determines the input format is binary and the&lt;br /&gt;
output format is ASCII, there must be a format description for each&lt;br /&gt;
type. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The checkvar program needs only an input format.&lt;br /&gt;
&lt;br /&gt;
==Locating Format Files==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs use the following search sequence to find a&lt;br /&gt;
format file (format or variable description file) for the data file&lt;br /&gt;
datafile.ext when the format file name is not explicitly specified on&lt;br /&gt;
the command line. In summary, FreeForm ND searches the directory&lt;br /&gt;
specified by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; (defined in a equivalence&lt;br /&gt;
table or in the environment), the current or working directory, and&lt;br /&gt;
the data file&#039;s home directory. The rules are applied in the order&lt;br /&gt;
given below until a format file is found or all rules have been&lt;br /&gt;
exhausted. If the relevant format file does not follow FreeForm ND&lt;br /&gt;
conventions for name or location, it should be explicitly specified on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;GeoVu is a FreeForm ND-based application for data access and&lt;br /&gt;
visualization. FreeForm ND applications other than GeoVu use GeoVu&lt;br /&gt;
keywords. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For information about equivalence tables, see the GeoVu Tools&lt;br /&gt;
Reference Guide, available from the NGDC.&lt;br /&gt;
&lt;br /&gt;
===Search Sequence===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named datafile.fmt.&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. &amp;lt;blockquote&amp;gt;Step 2 is included to accommodate variable description files that were created using previous versions of FreeForm ND. It is recommended that you convert existing variable description files to format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named ext.fmt. If the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; is not found, FreeForm ND continues the search for a format file as follows.&lt;br /&gt;
#Search the current (default) directory for a format description file named datafile.fmt.&lt;br /&gt;
#Search the current directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the current directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. If the data file&#039;s home directory is not the same as the current directory, FreeForm ND continues the search for a format file with steps 7-9. The data file&#039;s home directory is given by the directory path component of the data file name. If the data file name has no directory path component, the home directory search is not done.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
#Search the data file&#039;s home directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Case Sensitivity===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND adheres to the following rules for case sensitivity (in&lt;br /&gt;
applicable operating systems) when it searches for a format file for&lt;br /&gt;
the data file datafile.ext.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*FreeForm ND preserves the case of datafile, for example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.BIN&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.bfm&amp;lt;/font&amp;gt;).&lt;br /&gt;
*FreeForm ND searches for a format file with a lower case extension. That is, the format file must have its extension in lower case no matter what the case of datafile. For example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.dat&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.afm&amp;lt;/font&amp;gt;), and &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bfm&amp;lt;/font&amp;gt;) is the default format file for &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
*In searching for a format description file of type &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;, FreeForm ND preserves the case of ext. For example, for data files named &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.LL&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.LL&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.LL&amp;lt;/font&amp;gt;, the default format description file is &amp;lt;font color=&#039;green&#039;&amp;gt;LL.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Command Line Arguments==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs can take various command line arguments. The most&lt;br /&gt;
widely used or standard arguments are discussed in this section. They&lt;br /&gt;
are used for several different purposes: identifying input and output&lt;br /&gt;
files, identifying format files and titles, changing run-time&lt;br /&gt;
operation parameters, and defining data filters.&lt;br /&gt;
&lt;br /&gt;
The only required argument for any FreeForm ND program is the name of&lt;br /&gt;
the input file or file to be processed. All other arguments are&lt;br /&gt;
optional and can be in any order following the input file name. The&lt;br /&gt;
command line of a FreeForm ND program with the standard arguments has&lt;br /&gt;
the following form:&lt;br /&gt;
&lt;br /&gt;
application_name input_file [-f format_file]&lt;br /&gt;
&lt;br /&gt;
[-if input_format_file] [-of output_format_file] [-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: To see a summary of command line usage for a FreeForm ND&lt;br /&gt;
program, enter the program&#039;s name on the command line without any&lt;br /&gt;
arguments.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Specifying Input and Output Files===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;input_file&#039;&#039;&#039; : Name of the file to be processed. Following FreeForm ND naming&lt;br /&gt;
conventions, the standard extensions for data files are &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; for ASCII format, &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; for binary, and &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; for dBASE.&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;-o output_file&#039;&#039;&#039; : Option flag followed by the name of the output file. The standard extensions are the same as for input files.&lt;br /&gt;
&lt;br /&gt;
===Specifying Format Description Source===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND offers a number of command line options for specifying the&lt;br /&gt;
source of the format descriptions that a program must find in order to&lt;br /&gt;
process data. The proper option or combination of options to use&lt;br /&gt;
depends on how you have constructed your format files.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; -f format_file : Option flag followed by the name of the format description file&lt;br /&gt;
describing both input and output data.&lt;br /&gt;
&lt;br /&gt;
; -if input_format_file : Option flag followed by the name of the format description file describing the input data. Also use this option for an input variable description file written using earlier versions of FreeForm ND.&lt;br /&gt;
&lt;br /&gt;
; -of output_format_file : Option flag followed by the name of the format description file describing the output data. Also use this option for an output variable description file written using earlier versions of FreeForm ND.&lt;br /&gt;
&lt;br /&gt;
; -ft title : Option flag followed by the title (enclosed in quotes) of the format to be used for both input and output data, in which case there is no reformatting. The title follows format type on the first line of a format description in a format description file.&lt;br /&gt;
&lt;br /&gt;
; -ift title : Option flag followed by the title (enclosed in quotes) of the desired input format.&lt;br /&gt;
&lt;br /&gt;
; -oft title : Option flag followed by the title (enclosed in quotes) of the desired output format.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(&amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt;). It is recommended that you&lt;br /&gt;
convert and combine (as appropriate) existing variable description&lt;br /&gt;
files into format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The various options available for specifying the source of a format&lt;br /&gt;
description offer you a great deal of flexibility-in naming files,&lt;br /&gt;
setting up format description files, and on the command line. In using&lt;br /&gt;
these options, you need to consider the content of your format&lt;br /&gt;
description files and how FreeForm ND will interpret the arguments on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
===Changing Run-time Parameters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes three arguments that let you change run-time&lt;br /&gt;
parameters according to your needs. One argument lets you specify&lt;br /&gt;
local buffer size, another indicates the number of records to process,&lt;br /&gt;
and the third indicates which variables to process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -b local_buffer_size:&lt;br /&gt;
Option flag followed by the size of the memory buffer used to&lt;br /&gt;
process the data and format files.&lt;br /&gt;
Default buffer size is 32,768. You many want to decrease the buffer&lt;br /&gt;
size if you are running with low memory. Keep in mind that too small&lt;br /&gt;
a buffer may result in unexpected behavior.&lt;br /&gt;
&lt;br /&gt;
; -c count:&lt;br /&gt;
Option flag followed by a number that specifies how many data&lt;br /&gt;
records at the head or tail of the file to process.&lt;br /&gt;
If &amp;lt;math&amp;gt;count &amp;gt; 0&amp;lt;/math&amp;gt;, \var{count} records at the beginning of the file are&lt;br /&gt;
processed.&lt;br /&gt;
If &amp;lt;math&amp;gt;count &amp;lt; 0&amp;lt;/math&amp;gt;, \var{count} records at the tail or end of the file&lt;br /&gt;
are processed.&lt;br /&gt;
&lt;br /&gt;
; -v var_file :&lt;br /&gt;
Option flag followed by the name of a variable file. The file&lt;br /&gt;
contains names of the variables in the input data file to be&lt;br /&gt;
processed by the FreeForm ND program. Variable names in var_file can&lt;br /&gt;
be separated by one or more spaces or each name can be on a separate&lt;br /&gt;
line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Defining Filters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The query option lets you define data filters via a query file so you&lt;br /&gt;
can precisely specify which data to process. The FreeForm ND program&lt;br /&gt;
will process only those records meeting the query criteria.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -q query_file :&lt;br /&gt;
Option flag followed by the name of the file containing query&lt;br /&gt;
criteria. See ([http://www &amp;lt;cite&amp;gt; ff,query&amp;lt;/cite&amp;gt;]) for a complete description of&lt;br /&gt;
the query syntax.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2016</id>
		<title>Wiki Testing/convs</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2016"/>
		<updated>2008-02-06T15:13:19Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Specifying Format Description Source */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=FreeForm ND Conventions=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File name conventions have been defined for FreeForm ND. If you follow&lt;br /&gt;
these conventions, FreeForm ND can locate format files through a&lt;br /&gt;
default search sequence. Using the file name conventions also lets you&lt;br /&gt;
reduce the number of arguments on the command line. In addition to&lt;br /&gt;
standard file names, FreeForm ND programs recognize various standard&lt;br /&gt;
command line arguments.&lt;br /&gt;
&lt;br /&gt;
==File Name Conventions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Naming conventions have been established for files accessed by&lt;br /&gt;
FreeForm ND. Although you are not required to follow these&lt;br /&gt;
conventions, using them lets you enter abbreviated commands when you&lt;br /&gt;
are using FreeForm ND-based programs. FreeForm ND can then&lt;br /&gt;
automatically execute several operations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  Determination of input and output formats when they are not explicitly identified in the relevant format descriptions in format files&lt;br /&gt;
*  Location of format files when they are not specified on the command line&lt;br /&gt;
&lt;br /&gt;
==File Name Extensions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extensions for data files are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; :  For ASCII, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; : For dBASE, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dab&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; : binary or anything that is not &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. You should not use mixed case extensions for format&lt;br /&gt;
description files if you want to take advantage of FreeForm ND&#039;s&lt;br /&gt;
default search capabilities. If you explicitly specify the names of&lt;br /&gt;
format description files on the command line, you can use mixed case&lt;br /&gt;
extensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(formerly called format specification files) each of which contained&lt;br /&gt;
variable descriptions for one file. Expected extensions for these&lt;br /&gt;
files were &amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt; (ASCII), &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt; (binary), and &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt; (dBASE). Variable descriptions for one or more files can now be&lt;br /&gt;
incorporated into a single format description file. It is&lt;br /&gt;
recommended that you convert and combine (as appropriate) existing&lt;br /&gt;
variable description files into format description files.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Name Relationships==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND-based programs expect certain relationships between data&lt;br /&gt;
file and format description file names as outlined below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  The data file is named datafile.ext where datafile is the file name of your choosing and ext is the extension. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
*  The corresponding format description file should be named datafile.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;&lt;br /&gt;
*  If one format description file is used for multiple data files, all with the same extension, the format description file should be named ext.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; is the format description file for &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Again, although not required, it is to your advantage to use these&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
==Determining Input and Output Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can optionally include the read/write type (&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;input&amp;lt;/font&amp;gt;&amp;quot; or&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;output&amp;lt;/font&amp;gt;&amp;quot;) in format descriptors, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt;. You may not want to specify the read/write&lt;br /&gt;
type in some circumstances. For example, you may need to translate&lt;br /&gt;
from native ASCII to binary, then back to ASCII. ASCII is the input&lt;br /&gt;
format in the first translation and the output format in the second&lt;br /&gt;
translation, vice versa for binary. You would need to edit the format&lt;br /&gt;
description file before executing the second translation if you&lt;br /&gt;
included read/write type in the format descriptors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;If you use the -ft option, you do not need to edit the format&lt;br /&gt;
description file. See ([[Wiki_Testing/convs|Section 8.6.2]]) later&lt;br /&gt;
in this chapter.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not specify read/write type, FreeForm ND can nevertheless&lt;br /&gt;
determine which format in a format description file is input and which&lt;br /&gt;
is output as long as you have adhered to FreeForm ND filenaming&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*If the input format is not specified, and&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;, assume binary input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, assume dBASE input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;, assume ASCII input.&lt;br /&gt;
**the input data filename extension is anything else, assume binary input.&lt;br /&gt;
*:&lt;br /&gt;
*If the output format is not specified, and&lt;br /&gt;
**the input format is dBASE, the output is ASCII or binary, whichever is found first.&lt;br /&gt;
**the input format is ASCII, the output is binary or dBASE, whichever is found first.&lt;br /&gt;
*:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;The appropriate format descriptions must be in the format&lt;br /&gt;
description file(s) used by FreeForm ND for a translation. If, for&lt;br /&gt;
example, FreeForm ND determines the input format is binary and the&lt;br /&gt;
output format is ASCII, there must be a format description for each&lt;br /&gt;
type. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The checkvar program needs only an input format.&lt;br /&gt;
&lt;br /&gt;
==Locating Format Files==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs use the following search sequence to find a&lt;br /&gt;
format file (format or variable description file) for the data file&lt;br /&gt;
datafile.ext when the format file name is not explicitly specified on&lt;br /&gt;
the command line. In summary, FreeForm ND searches the directory&lt;br /&gt;
specified by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; (defined in a equivalence&lt;br /&gt;
table or in the environment), the current or working directory, and&lt;br /&gt;
the data file&#039;s home directory. The rules are applied in the order&lt;br /&gt;
given below until a format file is found or all rules have been&lt;br /&gt;
exhausted. If the relevant format file does not follow FreeForm ND&lt;br /&gt;
conventions for name or location, it should be explicitly specified on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;GeoVu is a FreeForm ND-based application for data access and&lt;br /&gt;
visualization. FreeForm ND applications other than GeoVu use GeoVu&lt;br /&gt;
keywords. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For information about equivalence tables, see the GeoVu Tools&lt;br /&gt;
Reference Guide, available from the NGDC.&lt;br /&gt;
&lt;br /&gt;
===Search Sequence===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named datafile.fmt.&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. &amp;lt;blockquote&amp;gt;Step 2 is included to accommodate variable description files that were created using previous versions of FreeForm ND. It is recommended that you convert existing variable description files to format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named ext.fmt. If the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; is not found, FreeForm ND continues the search for a format file as follows.&lt;br /&gt;
#Search the current (default) directory for a format description file named datafile.fmt.&lt;br /&gt;
#Search the current directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the current directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. If the data file&#039;s home directory is not the same as the current directory, FreeForm ND continues the search for a format file with steps 7-9. The data file&#039;s home directory is given by the directory path component of the data file name. If the data file name has no directory path component, the home directory search is not done.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
#Search the data file&#039;s home directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Case Sensitivity===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND adheres to the following rules for case sensitivity (in&lt;br /&gt;
applicable operating systems) when it searches for a format file for&lt;br /&gt;
the data file datafile.ext.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*FreeForm ND preserves the case of datafile, for example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.BIN&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.bfm&amp;lt;/font&amp;gt;).&lt;br /&gt;
*FreeForm ND searches for a format file with a lower case extension. That is, the format file must have its extension in lower case no matter what the case of datafile. For example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.dat&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.afm&amp;lt;/font&amp;gt;), and &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bfm&amp;lt;/font&amp;gt;) is the default format file for &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
*In searching for a format description file of type &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;, FreeForm ND preserves the case of ext. For example, for data files named &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.LL&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.LL&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.LL&amp;lt;/font&amp;gt;, the default format description file is &amp;lt;font color=&#039;green&#039;&amp;gt;LL.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Command Line Arguments==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs can take various command line arguments. The most&lt;br /&gt;
widely used or standard arguments are discussed in this section. They&lt;br /&gt;
are used for several different purposes: identifying input and output&lt;br /&gt;
files, identifying format files and titles, changing run-time&lt;br /&gt;
operation parameters, and defining data filters.&lt;br /&gt;
&lt;br /&gt;
The only required argument for any FreeForm ND program is the name of&lt;br /&gt;
the input file or file to be processed. All other arguments are&lt;br /&gt;
optional and can be in any order following the input file name. The&lt;br /&gt;
command line of a FreeForm ND program with the standard arguments has&lt;br /&gt;
the following form:&lt;br /&gt;
&lt;br /&gt;
application_name input_file [-f format_file]&lt;br /&gt;
&lt;br /&gt;
[-if input_format_file] [-of output_format_file] [-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: To see a summary of command line usage for a FreeForm ND&lt;br /&gt;
program, enter the program&#039;s name on the command line without any&lt;br /&gt;
arguments.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Specifying Input and Output Files===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;input_file&#039;&#039;&#039; : Name of the file to be processed. Following FreeForm ND naming&lt;br /&gt;
conventions, the standard extensions for data files are &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; for ASCII format, &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; for binary, and &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; for dBASE.&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;-o output_file&#039;&#039;&#039; : Option flag followed by the name of the output file. The standard extensions are the same as for input files.&lt;br /&gt;
&lt;br /&gt;
===Specifying Format Description Source===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND offers a number of command line options for specifying the&lt;br /&gt;
source of the format descriptions that a program must find in order to&lt;br /&gt;
process data. The proper option or combination of options to use&lt;br /&gt;
depends on how you have constructed your format files.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; -f format_file : Option flag followed by the name of the format description file&lt;br /&gt;
describing both input and output data.&lt;br /&gt;
&lt;br /&gt;
; -if input_format_file : Option flag followed by the name of the format description file describing the input data. Also use this option for an input variable description file written using earlier versions of FreeForm ND.&lt;br /&gt;
&lt;br /&gt;
; -of output_format_file : Option flag followed by the name of the format description file describing the output data. Also use this option for an output variable description file written using earlier versions of FreeForm ND.&lt;br /&gt;
&lt;br /&gt;
; -ft title : Option flag followed by the title (enclosed in quotes) of the format&lt;br /&gt;
to be used for both input and output data, in which case there is no reformatting. The title follows format type on the first line of a format description in a format description file.&lt;br /&gt;
&lt;br /&gt;
; -ift title : Option flag followed by the title (enclosed in quotes) of the&lt;br /&gt;
desired input format.&lt;br /&gt;
&lt;br /&gt;
; -oft title : Option flag followed by the title (enclosed in quotes) of the&lt;br /&gt;
desired output format.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(&amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt;). It is recommended that you&lt;br /&gt;
convert and combine (as appropriate) existing variable description&lt;br /&gt;
files into format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The various options available for specifying the source of a format&lt;br /&gt;
description offer you a great deal of flexibility-in naming files,&lt;br /&gt;
setting up format description files, and on the command line. In using&lt;br /&gt;
these options, you need to consider the content of your format&lt;br /&gt;
description files and how FreeForm ND will interpret the arguments on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
===Changing Run-time Parameters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes three arguments that let you change run-time&lt;br /&gt;
parameters according to your needs. One argument lets you specify&lt;br /&gt;
local buffer size, another indicates the number of records to process,&lt;br /&gt;
and the third indicates which variables to process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -b local_buffer_size:&lt;br /&gt;
Option flag followed by the size of the memory buffer used to&lt;br /&gt;
process the data and format files.&lt;br /&gt;
Default buffer size is 32,768. You many want to decrease the buffer&lt;br /&gt;
size if you are running with low memory. Keep in mind that too small&lt;br /&gt;
a buffer may result in unexpected behavior.&lt;br /&gt;
&lt;br /&gt;
; -c count:&lt;br /&gt;
Option flag followed by a number that specifies how many data&lt;br /&gt;
records at the head or tail of the file to process.&lt;br /&gt;
If &amp;lt;math&amp;gt;count &amp;gt; 0&amp;lt;/math&amp;gt;, \var{count} records at the beginning of the file are&lt;br /&gt;
processed.&lt;br /&gt;
If &amp;lt;math&amp;gt;count &amp;lt; 0&amp;lt;/math&amp;gt;, \var{count} records at the tail or end of the file&lt;br /&gt;
are processed.&lt;br /&gt;
&lt;br /&gt;
; -v var_file :&lt;br /&gt;
Option flag followed by the name of a variable file. The file&lt;br /&gt;
contains names of the variables in the input data file to be&lt;br /&gt;
processed by the FreeForm ND program. Variable names in var_file can&lt;br /&gt;
be separated by one or more spaces or each name can be on a separate&lt;br /&gt;
line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Defining Filters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The query option lets you define data filters via a query file so you&lt;br /&gt;
can precisely specify which data to process. The FreeForm ND program&lt;br /&gt;
will process only those records meeting the query criteria.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -q query_file :&lt;br /&gt;
Option flag followed by the name of the file containing query&lt;br /&gt;
criteria. See ([http://www &amp;lt;cite&amp;gt; ff,query&amp;lt;/cite&amp;gt;]) for a complete description of&lt;br /&gt;
the query syntax.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2015</id>
		<title>Wiki Testing/convs</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2015"/>
		<updated>2008-02-06T15:12:28Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Specifying Input and Output Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=FreeForm ND Conventions=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File name conventions have been defined for FreeForm ND. If you follow&lt;br /&gt;
these conventions, FreeForm ND can locate format files through a&lt;br /&gt;
default search sequence. Using the file name conventions also lets you&lt;br /&gt;
reduce the number of arguments on the command line. In addition to&lt;br /&gt;
standard file names, FreeForm ND programs recognize various standard&lt;br /&gt;
command line arguments.&lt;br /&gt;
&lt;br /&gt;
==File Name Conventions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Naming conventions have been established for files accessed by&lt;br /&gt;
FreeForm ND. Although you are not required to follow these&lt;br /&gt;
conventions, using them lets you enter abbreviated commands when you&lt;br /&gt;
are using FreeForm ND-based programs. FreeForm ND can then&lt;br /&gt;
automatically execute several operations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  Determination of input and output formats when they are not explicitly identified in the relevant format descriptions in format files&lt;br /&gt;
*  Location of format files when they are not specified on the command line&lt;br /&gt;
&lt;br /&gt;
==File Name Extensions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extensions for data files are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; :  For ASCII, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; : For dBASE, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dab&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; : binary or anything that is not &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. You should not use mixed case extensions for format&lt;br /&gt;
description files if you want to take advantage of FreeForm ND&#039;s&lt;br /&gt;
default search capabilities. If you explicitly specify the names of&lt;br /&gt;
format description files on the command line, you can use mixed case&lt;br /&gt;
extensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(formerly called format specification files) each of which contained&lt;br /&gt;
variable descriptions for one file. Expected extensions for these&lt;br /&gt;
files were &amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt; (ASCII), &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt; (binary), and &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt; (dBASE). Variable descriptions for one or more files can now be&lt;br /&gt;
incorporated into a single format description file. It is&lt;br /&gt;
recommended that you convert and combine (as appropriate) existing&lt;br /&gt;
variable description files into format description files.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Name Relationships==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND-based programs expect certain relationships between data&lt;br /&gt;
file and format description file names as outlined below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  The data file is named datafile.ext where datafile is the file name of your choosing and ext is the extension. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
*  The corresponding format description file should be named datafile.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;&lt;br /&gt;
*  If one format description file is used for multiple data files, all with the same extension, the format description file should be named ext.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; is the format description file for &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Again, although not required, it is to your advantage to use these&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
==Determining Input and Output Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can optionally include the read/write type (&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;input&amp;lt;/font&amp;gt;&amp;quot; or&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;output&amp;lt;/font&amp;gt;&amp;quot;) in format descriptors, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt;. You may not want to specify the read/write&lt;br /&gt;
type in some circumstances. For example, you may need to translate&lt;br /&gt;
from native ASCII to binary, then back to ASCII. ASCII is the input&lt;br /&gt;
format in the first translation and the output format in the second&lt;br /&gt;
translation, vice versa for binary. You would need to edit the format&lt;br /&gt;
description file before executing the second translation if you&lt;br /&gt;
included read/write type in the format descriptors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;If you use the -ft option, you do not need to edit the format&lt;br /&gt;
description file. See ([[Wiki_Testing/convs|Section 8.6.2]]) later&lt;br /&gt;
in this chapter.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not specify read/write type, FreeForm ND can nevertheless&lt;br /&gt;
determine which format in a format description file is input and which&lt;br /&gt;
is output as long as you have adhered to FreeForm ND filenaming&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*If the input format is not specified, and&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;, assume binary input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, assume dBASE input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;, assume ASCII input.&lt;br /&gt;
**the input data filename extension is anything else, assume binary input.&lt;br /&gt;
*:&lt;br /&gt;
*If the output format is not specified, and&lt;br /&gt;
**the input format is dBASE, the output is ASCII or binary, whichever is found first.&lt;br /&gt;
**the input format is ASCII, the output is binary or dBASE, whichever is found first.&lt;br /&gt;
*:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;The appropriate format descriptions must be in the format&lt;br /&gt;
description file(s) used by FreeForm ND for a translation. If, for&lt;br /&gt;
example, FreeForm ND determines the input format is binary and the&lt;br /&gt;
output format is ASCII, there must be a format description for each&lt;br /&gt;
type. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The checkvar program needs only an input format.&lt;br /&gt;
&lt;br /&gt;
==Locating Format Files==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs use the following search sequence to find a&lt;br /&gt;
format file (format or variable description file) for the data file&lt;br /&gt;
datafile.ext when the format file name is not explicitly specified on&lt;br /&gt;
the command line. In summary, FreeForm ND searches the directory&lt;br /&gt;
specified by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; (defined in a equivalence&lt;br /&gt;
table or in the environment), the current or working directory, and&lt;br /&gt;
the data file&#039;s home directory. The rules are applied in the order&lt;br /&gt;
given below until a format file is found or all rules have been&lt;br /&gt;
exhausted. If the relevant format file does not follow FreeForm ND&lt;br /&gt;
conventions for name or location, it should be explicitly specified on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;GeoVu is a FreeForm ND-based application for data access and&lt;br /&gt;
visualization. FreeForm ND applications other than GeoVu use GeoVu&lt;br /&gt;
keywords. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For information about equivalence tables, see the GeoVu Tools&lt;br /&gt;
Reference Guide, available from the NGDC.&lt;br /&gt;
&lt;br /&gt;
===Search Sequence===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named datafile.fmt.&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. &amp;lt;blockquote&amp;gt;Step 2 is included to accommodate variable description files that were created using previous versions of FreeForm ND. It is recommended that you convert existing variable description files to format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named ext.fmt. If the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; is not found, FreeForm ND continues the search for a format file as follows.&lt;br /&gt;
#Search the current (default) directory for a format description file named datafile.fmt.&lt;br /&gt;
#Search the current directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the current directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. If the data file&#039;s home directory is not the same as the current directory, FreeForm ND continues the search for a format file with steps 7-9. The data file&#039;s home directory is given by the directory path component of the data file name. If the data file name has no directory path component, the home directory search is not done.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
#Search the data file&#039;s home directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Case Sensitivity===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND adheres to the following rules for case sensitivity (in&lt;br /&gt;
applicable operating systems) when it searches for a format file for&lt;br /&gt;
the data file datafile.ext.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*FreeForm ND preserves the case of datafile, for example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.BIN&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.bfm&amp;lt;/font&amp;gt;).&lt;br /&gt;
*FreeForm ND searches for a format file with a lower case extension. That is, the format file must have its extension in lower case no matter what the case of datafile. For example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.dat&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.afm&amp;lt;/font&amp;gt;), and &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bfm&amp;lt;/font&amp;gt;) is the default format file for &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
*In searching for a format description file of type &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;, FreeForm ND preserves the case of ext. For example, for data files named &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.LL&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.LL&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.LL&amp;lt;/font&amp;gt;, the default format description file is &amp;lt;font color=&#039;green&#039;&amp;gt;LL.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Command Line Arguments==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs can take various command line arguments. The most&lt;br /&gt;
widely used or standard arguments are discussed in this section. They&lt;br /&gt;
are used for several different purposes: identifying input and output&lt;br /&gt;
files, identifying format files and titles, changing run-time&lt;br /&gt;
operation parameters, and defining data filters.&lt;br /&gt;
&lt;br /&gt;
The only required argument for any FreeForm ND program is the name of&lt;br /&gt;
the input file or file to be processed. All other arguments are&lt;br /&gt;
optional and can be in any order following the input file name. The&lt;br /&gt;
command line of a FreeForm ND program with the standard arguments has&lt;br /&gt;
the following form:&lt;br /&gt;
&lt;br /&gt;
application_name input_file [-f format_file]&lt;br /&gt;
&lt;br /&gt;
[-if input_format_file] [-of output_format_file] [-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: To see a summary of command line usage for a FreeForm ND&lt;br /&gt;
program, enter the program&#039;s name on the command line without any&lt;br /&gt;
arguments.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Specifying Input and Output Files===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;input_file&#039;&#039;&#039; : Name of the file to be processed. Following FreeForm ND naming&lt;br /&gt;
conventions, the standard extensions for data files are &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; for ASCII format, &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; for binary, and &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; for dBASE.&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;-o output_file&#039;&#039;&#039; : Option flag followed by the name of the output file. The standard extensions are the same as for input files.&lt;br /&gt;
&lt;br /&gt;
===Specifying Format Description Source===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND offers a number of command line options for specifying the&lt;br /&gt;
source of the format descriptions that a program must find in order to&lt;br /&gt;
process data. The proper option or combination of options to use&lt;br /&gt;
depends on how you have constructed your format files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -f format_file :&lt;br /&gt;
Option flag followed by the name of the format description file&lt;br /&gt;
describing both input and output data.&lt;br /&gt;
&lt;br /&gt;
; -if input_format_file :&lt;br /&gt;
Option flag followed by the name of the format description file&lt;br /&gt;
describing the input data. Also use this option for an input&lt;br /&gt;
variable description file written using earlier versions of FreeForm&lt;br /&gt;
ND.&lt;br /&gt;
&lt;br /&gt;
; -of output_format_file :&lt;br /&gt;
Option flag followed by the name of the format description file&lt;br /&gt;
describing the output data. Also use this option for an output&lt;br /&gt;
variable description file written using earlier versions of FreeForm&lt;br /&gt;
ND.&lt;br /&gt;
&lt;br /&gt;
; -ft title :&lt;br /&gt;
Option flag followed by the title (enclosed in quotes) of the format&lt;br /&gt;
to be used for both input and output data, in which case there is no&lt;br /&gt;
reformatting. The title follows format type on the first line of a&lt;br /&gt;
format description in a format description file.&lt;br /&gt;
&lt;br /&gt;
; -ift title :&lt;br /&gt;
Option flag followed by the title (enclosed in quotes) of the&lt;br /&gt;
desired input format.&lt;br /&gt;
&lt;br /&gt;
; -oft title :&lt;br /&gt;
Option flag followed by the title (enclosed in quotes) of the&lt;br /&gt;
desired output format.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(&amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt;). It is recommended that you&lt;br /&gt;
convert and combine (as appropriate) existing variable description&lt;br /&gt;
files into format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The various options available for specifying the source of a format&lt;br /&gt;
description offer you a great deal of flexibility-in naming files,&lt;br /&gt;
setting up format description files, and on the command line. In using&lt;br /&gt;
these options, you need to consider the content of your format&lt;br /&gt;
description files and how FreeForm ND will interpret the arguments on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Changing Run-time Parameters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes three arguments that let you change run-time&lt;br /&gt;
parameters according to your needs. One argument lets you specify&lt;br /&gt;
local buffer size, another indicates the number of records to process,&lt;br /&gt;
and the third indicates which variables to process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -b local_buffer_size:&lt;br /&gt;
Option flag followed by the size of the memory buffer used to&lt;br /&gt;
process the data and format files.&lt;br /&gt;
Default buffer size is 32,768. You many want to decrease the buffer&lt;br /&gt;
size if you are running with low memory. Keep in mind that too small&lt;br /&gt;
a buffer may result in unexpected behavior.&lt;br /&gt;
&lt;br /&gt;
; -c count:&lt;br /&gt;
Option flag followed by a number that specifies how many data&lt;br /&gt;
records at the head or tail of the file to process.&lt;br /&gt;
If &amp;lt;math&amp;gt;count &amp;gt; 0&amp;lt;/math&amp;gt;, \var{count} records at the beginning of the file are&lt;br /&gt;
processed.&lt;br /&gt;
If &amp;lt;math&amp;gt;count &amp;lt; 0&amp;lt;/math&amp;gt;, \var{count} records at the tail or end of the file&lt;br /&gt;
are processed.&lt;br /&gt;
&lt;br /&gt;
; -v var_file :&lt;br /&gt;
Option flag followed by the name of a variable file. The file&lt;br /&gt;
contains names of the variables in the input data file to be&lt;br /&gt;
processed by the FreeForm ND program. Variable names in var_file can&lt;br /&gt;
be separated by one or more spaces or each name can be on a separate&lt;br /&gt;
line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Defining Filters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The query option lets you define data filters via a query file so you&lt;br /&gt;
can precisely specify which data to process. The FreeForm ND program&lt;br /&gt;
will process only those records meeting the query criteria.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -q query_file :&lt;br /&gt;
Option flag followed by the name of the file containing query&lt;br /&gt;
criteria. See ([http://www &amp;lt;cite&amp;gt; ff,query&amp;lt;/cite&amp;gt;]) for a complete description of&lt;br /&gt;
the query syntax.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2014</id>
		<title>Wiki Testing/convs</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2014"/>
		<updated>2008-02-06T15:11:53Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Command Line Arguments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=FreeForm ND Conventions=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File name conventions have been defined for FreeForm ND. If you follow&lt;br /&gt;
these conventions, FreeForm ND can locate format files through a&lt;br /&gt;
default search sequence. Using the file name conventions also lets you&lt;br /&gt;
reduce the number of arguments on the command line. In addition to&lt;br /&gt;
standard file names, FreeForm ND programs recognize various standard&lt;br /&gt;
command line arguments.&lt;br /&gt;
&lt;br /&gt;
==File Name Conventions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Naming conventions have been established for files accessed by&lt;br /&gt;
FreeForm ND. Although you are not required to follow these&lt;br /&gt;
conventions, using them lets you enter abbreviated commands when you&lt;br /&gt;
are using FreeForm ND-based programs. FreeForm ND can then&lt;br /&gt;
automatically execute several operations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  Determination of input and output formats when they are not explicitly identified in the relevant format descriptions in format files&lt;br /&gt;
*  Location of format files when they are not specified on the command line&lt;br /&gt;
&lt;br /&gt;
==File Name Extensions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extensions for data files are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; :  For ASCII, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; : For dBASE, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dab&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; : binary or anything that is not &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. You should not use mixed case extensions for format&lt;br /&gt;
description files if you want to take advantage of FreeForm ND&#039;s&lt;br /&gt;
default search capabilities. If you explicitly specify the names of&lt;br /&gt;
format description files on the command line, you can use mixed case&lt;br /&gt;
extensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(formerly called format specification files) each of which contained&lt;br /&gt;
variable descriptions for one file. Expected extensions for these&lt;br /&gt;
files were &amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt; (ASCII), &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt; (binary), and &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt; (dBASE). Variable descriptions for one or more files can now be&lt;br /&gt;
incorporated into a single format description file. It is&lt;br /&gt;
recommended that you convert and combine (as appropriate) existing&lt;br /&gt;
variable description files into format description files.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Name Relationships==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND-based programs expect certain relationships between data&lt;br /&gt;
file and format description file names as outlined below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  The data file is named datafile.ext where datafile is the file name of your choosing and ext is the extension. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
*  The corresponding format description file should be named datafile.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;&lt;br /&gt;
*  If one format description file is used for multiple data files, all with the same extension, the format description file should be named ext.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; is the format description file for &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Again, although not required, it is to your advantage to use these&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
==Determining Input and Output Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can optionally include the read/write type (&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;input&amp;lt;/font&amp;gt;&amp;quot; or&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;output&amp;lt;/font&amp;gt;&amp;quot;) in format descriptors, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt;. You may not want to specify the read/write&lt;br /&gt;
type in some circumstances. For example, you may need to translate&lt;br /&gt;
from native ASCII to binary, then back to ASCII. ASCII is the input&lt;br /&gt;
format in the first translation and the output format in the second&lt;br /&gt;
translation, vice versa for binary. You would need to edit the format&lt;br /&gt;
description file before executing the second translation if you&lt;br /&gt;
included read/write type in the format descriptors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;If you use the -ft option, you do not need to edit the format&lt;br /&gt;
description file. See ([[Wiki_Testing/convs|Section 8.6.2]]) later&lt;br /&gt;
in this chapter.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not specify read/write type, FreeForm ND can nevertheless&lt;br /&gt;
determine which format in a format description file is input and which&lt;br /&gt;
is output as long as you have adhered to FreeForm ND filenaming&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*If the input format is not specified, and&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;, assume binary input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, assume dBASE input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;, assume ASCII input.&lt;br /&gt;
**the input data filename extension is anything else, assume binary input.&lt;br /&gt;
*:&lt;br /&gt;
*If the output format is not specified, and&lt;br /&gt;
**the input format is dBASE, the output is ASCII or binary, whichever is found first.&lt;br /&gt;
**the input format is ASCII, the output is binary or dBASE, whichever is found first.&lt;br /&gt;
*:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;The appropriate format descriptions must be in the format&lt;br /&gt;
description file(s) used by FreeForm ND for a translation. If, for&lt;br /&gt;
example, FreeForm ND determines the input format is binary and the&lt;br /&gt;
output format is ASCII, there must be a format description for each&lt;br /&gt;
type. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The checkvar program needs only an input format.&lt;br /&gt;
&lt;br /&gt;
==Locating Format Files==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs use the following search sequence to find a&lt;br /&gt;
format file (format or variable description file) for the data file&lt;br /&gt;
datafile.ext when the format file name is not explicitly specified on&lt;br /&gt;
the command line. In summary, FreeForm ND searches the directory&lt;br /&gt;
specified by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; (defined in a equivalence&lt;br /&gt;
table or in the environment), the current or working directory, and&lt;br /&gt;
the data file&#039;s home directory. The rules are applied in the order&lt;br /&gt;
given below until a format file is found or all rules have been&lt;br /&gt;
exhausted. If the relevant format file does not follow FreeForm ND&lt;br /&gt;
conventions for name or location, it should be explicitly specified on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;GeoVu is a FreeForm ND-based application for data access and&lt;br /&gt;
visualization. FreeForm ND applications other than GeoVu use GeoVu&lt;br /&gt;
keywords. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For information about equivalence tables, see the GeoVu Tools&lt;br /&gt;
Reference Guide, available from the NGDC.&lt;br /&gt;
&lt;br /&gt;
===Search Sequence===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named datafile.fmt.&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. &amp;lt;blockquote&amp;gt;Step 2 is included to accommodate variable description files that were created using previous versions of FreeForm ND. It is recommended that you convert existing variable description files to format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named ext.fmt. If the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; is not found, FreeForm ND continues the search for a format file as follows.&lt;br /&gt;
#Search the current (default) directory for a format description file named datafile.fmt.&lt;br /&gt;
#Search the current directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the current directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. If the data file&#039;s home directory is not the same as the current directory, FreeForm ND continues the search for a format file with steps 7-9. The data file&#039;s home directory is given by the directory path component of the data file name. If the data file name has no directory path component, the home directory search is not done.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
#Search the data file&#039;s home directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Case Sensitivity===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND adheres to the following rules for case sensitivity (in&lt;br /&gt;
applicable operating systems) when it searches for a format file for&lt;br /&gt;
the data file datafile.ext.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*FreeForm ND preserves the case of datafile, for example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.BIN&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.bfm&amp;lt;/font&amp;gt;).&lt;br /&gt;
*FreeForm ND searches for a format file with a lower case extension. That is, the format file must have its extension in lower case no matter what the case of datafile. For example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.dat&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.afm&amp;lt;/font&amp;gt;), and &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bfm&amp;lt;/font&amp;gt;) is the default format file for &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
*In searching for a format description file of type &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;, FreeForm ND preserves the case of ext. For example, for data files named &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.LL&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.LL&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.LL&amp;lt;/font&amp;gt;, the default format description file is &amp;lt;font color=&#039;green&#039;&amp;gt;LL.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Command Line Arguments==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs can take various command line arguments. The most&lt;br /&gt;
widely used or standard arguments are discussed in this section. They&lt;br /&gt;
are used for several different purposes: identifying input and output&lt;br /&gt;
files, identifying format files and titles, changing run-time&lt;br /&gt;
operation parameters, and defining data filters.&lt;br /&gt;
&lt;br /&gt;
The only required argument for any FreeForm ND program is the name of&lt;br /&gt;
the input file or file to be processed. All other arguments are&lt;br /&gt;
optional and can be in any order following the input file name. The&lt;br /&gt;
command line of a FreeForm ND program with the standard arguments has&lt;br /&gt;
the following form:&lt;br /&gt;
&lt;br /&gt;
application_name input_file [-f format_file]&lt;br /&gt;
&lt;br /&gt;
[-if input_format_file] [-of output_format_file] [-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: To see a summary of command line usage for a FreeForm ND&lt;br /&gt;
program, enter the program&#039;s name on the command line without any&lt;br /&gt;
arguments.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Specifying Input and Output Files===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;input_file&#039;&#039;&#039; :&lt;br /&gt;
Name of the file to be processed. Following FreeForm ND naming&lt;br /&gt;
conventions, the standard extensions for data files are &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; for&lt;br /&gt;
ASCII format, &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; for binary, and &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; for dBASE.&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;-o output_file&#039;&#039;&#039; :&lt;br /&gt;
Option flag followed by the name of the output file. The standard&lt;br /&gt;
extensions are the same as for input files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Specifying Format Description Source===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND offers a number of command line options for specifying the&lt;br /&gt;
source of the format descriptions that a program must find in order to&lt;br /&gt;
process data. The proper option or combination of options to use&lt;br /&gt;
depends on how you have constructed your format files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -f format_file :&lt;br /&gt;
Option flag followed by the name of the format description file&lt;br /&gt;
describing both input and output data.&lt;br /&gt;
&lt;br /&gt;
; -if input_format_file :&lt;br /&gt;
Option flag followed by the name of the format description file&lt;br /&gt;
describing the input data. Also use this option for an input&lt;br /&gt;
variable description file written using earlier versions of FreeForm&lt;br /&gt;
ND.&lt;br /&gt;
&lt;br /&gt;
; -of output_format_file :&lt;br /&gt;
Option flag followed by the name of the format description file&lt;br /&gt;
describing the output data. Also use this option for an output&lt;br /&gt;
variable description file written using earlier versions of FreeForm&lt;br /&gt;
ND.&lt;br /&gt;
&lt;br /&gt;
; -ft title :&lt;br /&gt;
Option flag followed by the title (enclosed in quotes) of the format&lt;br /&gt;
to be used for both input and output data, in which case there is no&lt;br /&gt;
reformatting. The title follows format type on the first line of a&lt;br /&gt;
format description in a format description file.&lt;br /&gt;
&lt;br /&gt;
; -ift title :&lt;br /&gt;
Option flag followed by the title (enclosed in quotes) of the&lt;br /&gt;
desired input format.&lt;br /&gt;
&lt;br /&gt;
; -oft title :&lt;br /&gt;
Option flag followed by the title (enclosed in quotes) of the&lt;br /&gt;
desired output format.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(&amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt;). It is recommended that you&lt;br /&gt;
convert and combine (as appropriate) existing variable description&lt;br /&gt;
files into format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The various options available for specifying the source of a format&lt;br /&gt;
description offer you a great deal of flexibility-in naming files,&lt;br /&gt;
setting up format description files, and on the command line. In using&lt;br /&gt;
these options, you need to consider the content of your format&lt;br /&gt;
description files and how FreeForm ND will interpret the arguments on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Changing Run-time Parameters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes three arguments that let you change run-time&lt;br /&gt;
parameters according to your needs. One argument lets you specify&lt;br /&gt;
local buffer size, another indicates the number of records to process,&lt;br /&gt;
and the third indicates which variables to process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -b local_buffer_size:&lt;br /&gt;
Option flag followed by the size of the memory buffer used to&lt;br /&gt;
process the data and format files.&lt;br /&gt;
Default buffer size is 32,768. You many want to decrease the buffer&lt;br /&gt;
size if you are running with low memory. Keep in mind that too small&lt;br /&gt;
a buffer may result in unexpected behavior.&lt;br /&gt;
&lt;br /&gt;
; -c count:&lt;br /&gt;
Option flag followed by a number that specifies how many data&lt;br /&gt;
records at the head or tail of the file to process.&lt;br /&gt;
If &amp;lt;math&amp;gt;count &amp;gt; 0&amp;lt;/math&amp;gt;, \var{count} records at the beginning of the file are&lt;br /&gt;
processed.&lt;br /&gt;
If &amp;lt;math&amp;gt;count &amp;lt; 0&amp;lt;/math&amp;gt;, \var{count} records at the tail or end of the file&lt;br /&gt;
are processed.&lt;br /&gt;
&lt;br /&gt;
; -v var_file :&lt;br /&gt;
Option flag followed by the name of a variable file. The file&lt;br /&gt;
contains names of the variables in the input data file to be&lt;br /&gt;
processed by the FreeForm ND program. Variable names in var_file can&lt;br /&gt;
be separated by one or more spaces or each name can be on a separate&lt;br /&gt;
line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Defining Filters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The query option lets you define data filters via a query file so you&lt;br /&gt;
can precisely specify which data to process. The FreeForm ND program&lt;br /&gt;
will process only those records meeting the query criteria.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -q query_file :&lt;br /&gt;
Option flag followed by the name of the file containing query&lt;br /&gt;
criteria. See ([http://www &amp;lt;cite&amp;gt; ff,query&amp;lt;/cite&amp;gt;]) for a complete description of&lt;br /&gt;
the query syntax.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2013</id>
		<title>Wiki Testing/convs</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=Wiki_Testing/convs&amp;diff=2013"/>
		<updated>2008-02-06T15:11:30Z</updated>

		<summary type="html">&lt;p&gt;Yuan: /* Case Sensitivity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=FreeForm ND Conventions=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File name conventions have been defined for FreeForm ND. If you follow&lt;br /&gt;
these conventions, FreeForm ND can locate format files through a&lt;br /&gt;
default search sequence. Using the file name conventions also lets you&lt;br /&gt;
reduce the number of arguments on the command line. In addition to&lt;br /&gt;
standard file names, FreeForm ND programs recognize various standard&lt;br /&gt;
command line arguments.&lt;br /&gt;
&lt;br /&gt;
==File Name Conventions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Naming conventions have been established for files accessed by&lt;br /&gt;
FreeForm ND. Although you are not required to follow these&lt;br /&gt;
conventions, using them lets you enter abbreviated commands when you&lt;br /&gt;
are using FreeForm ND-based programs. FreeForm ND can then&lt;br /&gt;
automatically execute several operations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  Determination of input and output formats when they are not explicitly identified in the relevant format descriptions in format files&lt;br /&gt;
*  Location of format files when they are not specified on the command line&lt;br /&gt;
&lt;br /&gt;
==File Name Extensions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extensions for data files are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; :  For ASCII, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; : For dBASE, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dab&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; : binary or anything that is not &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; or &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, e.g., &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.bin&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The expected extension for format description files is &amp;lt;font color=&#039;green&#039;&amp;gt;.fmt&amp;lt;/font&amp;gt;, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;. You should not use mixed case extensions for format&lt;br /&gt;
description files if you want to take advantage of FreeForm ND&#039;s&lt;br /&gt;
default search capabilities. If you explicitly specify the names of&lt;br /&gt;
format description files on the command line, you can use mixed case&lt;br /&gt;
extensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(formerly called format specification files) each of which contained&lt;br /&gt;
variable descriptions for one file. Expected extensions for these&lt;br /&gt;
files were &amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt; (ASCII), &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt; (binary), and &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt; (dBASE). Variable descriptions for one or more files can now be&lt;br /&gt;
incorporated into a single format description file. It is&lt;br /&gt;
recommended that you convert and combine (as appropriate) existing&lt;br /&gt;
variable description files into format description files.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Name Relationships==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND-based programs expect certain relationships between data&lt;br /&gt;
file and format description file names as outlined below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  The data file is named datafile.ext where datafile is the file name of your choosing and ext is the extension. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.dat&amp;lt;/font&amp;gt;&lt;br /&gt;
*  The corresponding format description file should be named datafile.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;latlon.fmt&amp;lt;/font&amp;gt;&lt;br /&gt;
*  If one format description file is used for multiple data files, all with the same extension, the format description file should be named ext.fmt. Example: &amp;lt;font color=&#039;green&#039;&amp;gt;ll.fmt&amp;lt;/font&amp;gt; is the format description file for &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.ll&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.ll&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;lldat3.ll&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Again, although not required, it is to your advantage to use these&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
==Determining Input and Output Formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can optionally include the read/write type (&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;input&amp;lt;/font&amp;gt;&amp;quot; or&lt;br /&gt;
&amp;quot;&amp;lt;font color=&#039;green&#039;&amp;gt;output&amp;lt;/font&amp;gt;&amp;quot;) in format descriptors, e.g.,&lt;br /&gt;
&amp;lt;font color=&#039;green&#039;&amp;gt;ASCII_input_data&amp;lt;/font&amp;gt;. You may not want to specify the read/write&lt;br /&gt;
type in some circumstances. For example, you may need to translate&lt;br /&gt;
from native ASCII to binary, then back to ASCII. ASCII is the input&lt;br /&gt;
format in the first translation and the output format in the second&lt;br /&gt;
translation, vice versa for binary. You would need to edit the format&lt;br /&gt;
description file before executing the second translation if you&lt;br /&gt;
included read/write type in the format descriptors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;If you use the -ft option, you do not need to edit the format&lt;br /&gt;
description file. See ([[Wiki_Testing/convs|Section 8.6.2]]) later&lt;br /&gt;
in this chapter.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not specify read/write type, FreeForm ND can nevertheless&lt;br /&gt;
determine which format in a format description file is input and which&lt;br /&gt;
is output as long as you have adhered to FreeForm ND filenaming&lt;br /&gt;
conventions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*If the input format is not specified, and&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt;, assume binary input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt;, assume dBASE input.&lt;br /&gt;
**the input data filename extension is &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt;, assume ASCII input.&lt;br /&gt;
**the input data filename extension is anything else, assume binary input.&lt;br /&gt;
*:&lt;br /&gt;
*If the output format is not specified, and&lt;br /&gt;
**the input format is dBASE, the output is ASCII or binary, whichever is found first.&lt;br /&gt;
**the input format is ASCII, the output is binary or dBASE, whichever is found first.&lt;br /&gt;
*:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;The appropriate format descriptions must be in the format&lt;br /&gt;
description file(s) used by FreeForm ND for a translation. If, for&lt;br /&gt;
example, FreeForm ND determines the input format is binary and the&lt;br /&gt;
output format is ASCII, there must be a format description for each&lt;br /&gt;
type. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The checkvar program needs only an input format.&lt;br /&gt;
&lt;br /&gt;
==Locating Format Files==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs use the following search sequence to find a&lt;br /&gt;
format file (format or variable description file) for the data file&lt;br /&gt;
datafile.ext when the format file name is not explicitly specified on&lt;br /&gt;
the command line. In summary, FreeForm ND searches the directory&lt;br /&gt;
specified by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; (defined in a equivalence&lt;br /&gt;
table or in the environment), the current or working directory, and&lt;br /&gt;
the data file&#039;s home directory. The rules are applied in the order&lt;br /&gt;
given below until a format file is found or all rules have been&lt;br /&gt;
exhausted. If the relevant format file does not follow FreeForm ND&lt;br /&gt;
conventions for name or location, it should be explicitly specified on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;GeoVu is a FreeForm ND-based application for data access and&lt;br /&gt;
visualization. FreeForm ND applications other than GeoVu use GeoVu&lt;br /&gt;
keywords. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For information about equivalence tables, see the GeoVu Tools&lt;br /&gt;
Reference Guide, available from the NGDC.&lt;br /&gt;
&lt;br /&gt;
===Search Sequence===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named datafile.fmt.&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. &amp;lt;blockquote&amp;gt;Step 2 is included to accommodate variable description files that were created using previous versions of FreeForm ND. It is recommended that you convert existing variable description files to format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
#Search the directory given by the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; for a format description file named ext.fmt. If the GeoVu keyword &amp;lt;font color=&#039;green&#039;&amp;gt;format_dir&amp;lt;/font&amp;gt; is not found, FreeForm ND continues the search for a format file as follows.&lt;br /&gt;
#Search the current (default) directory for a format description file named datafile.fmt.&lt;br /&gt;
#Search the current directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the current directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;. If the data file&#039;s home directory is not the same as the current directory, FreeForm ND continues the search for a format file with steps 7-9. The data file&#039;s home directory is given by the directory path component of the data file name. If the data file name has no directory path component, the home directory search is not done.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
#Search the data file&#039;s home directory for variable description files named &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.bfm&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;datafile.dfm&amp;lt;/font&amp;gt;. Use the criteria in step 2 for determining input and output format files.&lt;br /&gt;
#Search the data file&#039;s home directory for a format description file named &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Case Sensitivity===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND adheres to the following rules for case sensitivity (in&lt;br /&gt;
applicable operating systems) when it searches for a format file for&lt;br /&gt;
the data file datafile.ext.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*FreeForm ND preserves the case of datafile, for example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.BIN&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LATLON.bfm&amp;lt;/font&amp;gt;).&lt;br /&gt;
*FreeForm ND searches for a format file with a lower case extension. That is, the format file must have its extension in lower case no matter what the case of datafile. For example, the default format file for the data file &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.dat&amp;lt;/font&amp;gt; is &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;LatLon.afm&amp;lt;/font&amp;gt;), and &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.fmt&amp;lt;/font&amp;gt; (or &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bfm&amp;lt;/font&amp;gt;) is the default format file for &amp;lt;font color=&#039;green&#039;&amp;gt;TIMEDATE.bin&amp;lt;/font&amp;gt;.&lt;br /&gt;
*In searching for a format description file of type &amp;lt;font color=&#039;green&#039;&amp;gt;ext.fmt&amp;lt;/font&amp;gt;, FreeForm ND preserves the case of ext. For example, for data files named &amp;lt;font color=&#039;green&#039;&amp;gt;lldat1.LL&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;lldat2.LL&amp;lt;/font&amp;gt;, and &amp;lt;font color=&#039;green&#039;&amp;gt;latlon3.LL&amp;lt;/font&amp;gt;, the default format description file is &amp;lt;font color=&#039;green&#039;&amp;gt;LL.fmt&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Command Line Arguments==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND programs can take various command line arguments. The most&lt;br /&gt;
widely used or standard arguments are discussed in this section. They&lt;br /&gt;
are used for several different purposes: identifying input and output&lt;br /&gt;
files, identifying format files and titles, changing run-time&lt;br /&gt;
operation parameters, and defining data filters.&lt;br /&gt;
&lt;br /&gt;
The only required argument for any FreeForm ND program is the name of&lt;br /&gt;
the input file or file to be processed. All other arguments are&lt;br /&gt;
optional and can be in any order following the input file name. The&lt;br /&gt;
command line of a FreeForm ND program with the standard arguments has&lt;br /&gt;
the following form:&lt;br /&gt;
&lt;br /&gt;
application_name input_file [-f format_file]&lt;br /&gt;
&lt;br /&gt;
[-if input_format_file] [-of output_format_file] [-ft &amp;quot;title&amp;quot;] [-ift &amp;quot;title&amp;quot;] [-oft &amp;quot;title&amp;quot;] [-b local_buffer_size] [-c count] [-v var_file] [-q query_file] [-o output_file]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;To see a summary of command line usage for a FreeForm ND&lt;br /&gt;
program, enter the program&#039;s name on the command line without any&lt;br /&gt;
arguments.  &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Specifying Input and Output Files===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;input_file&#039;&#039;&#039; :&lt;br /&gt;
Name of the file to be processed. Following FreeForm ND naming&lt;br /&gt;
conventions, the standard extensions for data files are &amp;lt;font color=&#039;green&#039;&amp;gt;.dat&amp;lt;/font&amp;gt; for&lt;br /&gt;
ASCII format, &amp;lt;font color=&#039;green&#039;&amp;gt;.bin&amp;lt;/font&amp;gt; for binary, and &amp;lt;font color=&#039;green&#039;&amp;gt;.dab&amp;lt;/font&amp;gt; for dBASE.&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;&#039;-o output_file&#039;&#039;&#039; :&lt;br /&gt;
Option flag followed by the name of the output file. The standard&lt;br /&gt;
extensions are the same as for input files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Specifying Format Description Source===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND offers a number of command line options for specifying the&lt;br /&gt;
source of the format descriptions that a program must find in order to&lt;br /&gt;
process data. The proper option or combination of options to use&lt;br /&gt;
depends on how you have constructed your format files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -f format_file :&lt;br /&gt;
Option flag followed by the name of the format description file&lt;br /&gt;
describing both input and output data.&lt;br /&gt;
&lt;br /&gt;
; -if input_format_file :&lt;br /&gt;
Option flag followed by the name of the format description file&lt;br /&gt;
describing the input data. Also use this option for an input&lt;br /&gt;
variable description file written using earlier versions of FreeForm&lt;br /&gt;
ND.&lt;br /&gt;
&lt;br /&gt;
; -of output_format_file :&lt;br /&gt;
Option flag followed by the name of the format description file&lt;br /&gt;
describing the output data. Also use this option for an output&lt;br /&gt;
variable description file written using earlier versions of FreeForm&lt;br /&gt;
ND.&lt;br /&gt;
&lt;br /&gt;
; -ft title :&lt;br /&gt;
Option flag followed by the title (enclosed in quotes) of the format&lt;br /&gt;
to be used for both input and output data, in which case there is no&lt;br /&gt;
reformatting. The title follows format type on the first line of a&lt;br /&gt;
format description in a format description file.&lt;br /&gt;
&lt;br /&gt;
; -ift title :&lt;br /&gt;
Option flag followed by the title (enclosed in quotes) of the&lt;br /&gt;
desired input format.&lt;br /&gt;
&lt;br /&gt;
; -oft title :&lt;br /&gt;
Option flag followed by the title (enclosed in quotes) of the&lt;br /&gt;
desired output format.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;NOTE: Previous versions of FreeForm ND used variable description files&lt;br /&gt;
(&amp;lt;font color=&#039;green&#039;&amp;gt;.afm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.bfm&amp;lt;/font&amp;gt;, &amp;lt;font color=&#039;green&#039;&amp;gt;.dfm&amp;lt;/font&amp;gt;). It is recommended that you&lt;br /&gt;
convert and combine (as appropriate) existing variable description&lt;br /&gt;
files into format description files. &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The various options available for specifying the source of a format&lt;br /&gt;
description offer you a great deal of flexibility-in naming files,&lt;br /&gt;
setting up format description files, and on the command line. In using&lt;br /&gt;
these options, you need to consider the content of your format&lt;br /&gt;
description files and how FreeForm ND will interpret the arguments on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Changing Run-time Parameters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeForm ND includes three arguments that let you change run-time&lt;br /&gt;
parameters according to your needs. One argument lets you specify&lt;br /&gt;
local buffer size, another indicates the number of records to process,&lt;br /&gt;
and the third indicates which variables to process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -b local_buffer_size:&lt;br /&gt;
Option flag followed by the size of the memory buffer used to&lt;br /&gt;
process the data and format files.&lt;br /&gt;
Default buffer size is 32,768. You many want to decrease the buffer&lt;br /&gt;
size if you are running with low memory. Keep in mind that too small&lt;br /&gt;
a buffer may result in unexpected behavior.&lt;br /&gt;
&lt;br /&gt;
; -c count:&lt;br /&gt;
Option flag followed by a number that specifies how many data&lt;br /&gt;
records at the head or tail of the file to process.&lt;br /&gt;
If &amp;lt;math&amp;gt;count &amp;gt; 0&amp;lt;/math&amp;gt;, \var{count} records at the beginning of the file are&lt;br /&gt;
processed.&lt;br /&gt;
If &amp;lt;math&amp;gt;count &amp;lt; 0&amp;lt;/math&amp;gt;, \var{count} records at the tail or end of the file&lt;br /&gt;
are processed.&lt;br /&gt;
&lt;br /&gt;
; -v var_file :&lt;br /&gt;
Option flag followed by the name of a variable file. The file&lt;br /&gt;
contains names of the variables in the input data file to be&lt;br /&gt;
processed by the FreeForm ND program. Variable names in var_file can&lt;br /&gt;
be separated by one or more spaces or each name can be on a separate&lt;br /&gt;
line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Defining Filters===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The query option lets you define data filters via a query file so you&lt;br /&gt;
can precisely specify which data to process. The FreeForm ND program&lt;br /&gt;
will process only those records meeting the query criteria.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; -q query_file :&lt;br /&gt;
Option flag followed by the name of the file containing query&lt;br /&gt;
criteria. See ([http://www &amp;lt;cite&amp;gt; ff,query&amp;lt;/cite&amp;gt;]) for a complete description of&lt;br /&gt;
the query syntax.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yuan</name></author>
	</entry>
</feed>