<p>A CDL file is basically a text output from a netcdf file.  If you want to know the contents of a netcdf file but don't have the time (or ability) to use programs built to read/write netcdf, you can use the simple text output of "ncdump" and then read/write it with a basic text editor.  You can also use "ncgen" to regenerate a netcdf file based on the new CDL file.  I've used this process to make simple changes to netcdf files, and it works very quickly compared to generating a netcdf file using programming methods.</p>

<p>See <a href="http://www.atmos.washington.edu/ive/ive_help/writing_netCDF_files.html" rel="noreferrer">http://www.atmos.washington.edu/ive/ive_help/writing_netCDF_files.html</a> , quoted below:</p>

<blockquote>
  <p>A CDL (network Common data form Description Language) file is an ASCII descripton of the binary data in a netCDF file that is designed to be easily read by humans. CDL files can be generated from netCDF files via the `ncdump', command. For example,</p>
  
  <p>ncdump -c sample.nc
  generates the file `sample.cdl' that contains the file name, the dimensions, the specification of the variables, any attributes and the data for any "coordinate variables." A CDL file of this type is shown below. Note that the double slash indicates a comment in the CDL file.</p>
  
  <p>netcdf implicit_grid{</p>
  
  <p>dimensions:
  lon = 101;
  lat = 101;
  level = 5;
  time = UNLIMITED ; //(7 currently)
  variables:</p>
  
  <p>float A(time,level,lat,lon);
  A:units = "meters/second";
  float level(level);</p>
  
  <p>level:units = "millibars";
  float time(time);</p>
  
  <p>time:units = "hours";
  //global attributes:</p>
  
  <p>:x_min = -180.f;
  :x_max = 180.f;
  :x_units = "degrees_east";
  :x_label = "longitude";
  :y_min = -90.f;
  :y_max = 90.f;
  :y_units = "degrees_north";
  :y_label = "latitude";</p>
  
  <p>:z_label = "level";
  :t_label = "time";</p>
  
  <p>data:
  level = 1000, 850, 700, 500, 300 ;
  time = 0, 2, 4, 6, 8, 10, 12 ;</p>
  
  <p>The command <code>ncgen' is the inverse of</code>ncdump'; it converts an ASCII CDL file to a binary netCDF file. For example</p>
  
  <p>ncgen -o sample.nc sample.cdl
  converts the CDL file <code>sample.cdl' to the netCDF file</code>sample.nc'. The easiest way to create a netCDF file is to (1) write all the header data (the name, dimensions, variable and attribute specifications, and the values of any coordinate variables) to a CDL file, (2) convert the CDL file to a netCDF file using ncgen, and (3) continue writing the main data arrays to this netCDF file.</p>
</blockquote>

CC BY-SA 3.0
2015-04-03T16:02:41.183Z
2015-04-03T19:02:20.723Z
2015-04-03T19:02:20.723Z
f.thorpe
<p>I'm confused by what exactly a CDL file is and what its purpose is. <a href="http://www.unidata.ucar.edu/software/netcdf/netcdf/CDL-Syntax.html" rel="nofollow noreferrer">Unidata</a> specifies the syntax of such a CDL file in its <a href="http://www.unidata.ucar.edu/software/netcdf/netcdf/CDL-Syntax.html" rel="nofollow noreferrer">netCDF documentation</a>. </p>

<p>Questions:<br>
Are CDL files designed to be opened by a simple text editor like Notepad or gedit? Or should I use some other tool to open it?  </p>

<p>What is its purpose and how is it used?</p>

<data-formats><software><netcdf>
CDL File Questions
user4624937
# CDL File Questions

(Asked by: username_0 on 2015-04-03)

I'm confused by what exactly a CDL file is and what its purpose is. [Unidata](http://www.unidata.ucar.edu/software/netcdf/netcdf/CDL-Syntax.html) specifies the syntax of such a CDL file in its [netCDF documentation](http://www.unidata.ucar.edu/software/netcdf/netcdf/CDL-Syntax.html).

Questions:  
Are CDL files designed to be opened by a simple text editor like Notepad or gedit? Or should I use some other tool to open it?

What is its purpose and how is it used?

**Tags:** data-formats, software, netcdf


---

## 1 answers

### Answer by username_1 on 2015-04-03. Score: 10 | Accepted answer

A CDL file is basically a text output from a netcdf file. If you want to know the contents of a netcdf file but don't have the time (or ability) to use programs built to read/write netcdf, you can use the simple text output of "ncdump" and then read/write it with a basic text editor. You can also use "ncgen" to regenerate a netcdf file based on the new CDL file. I've used this process to make simple changes to netcdf files, and it works very quickly compared to generating a netcdf file using programming methods.

See <http://www.atmos.washington.edu/ive/ive_help/writing_netCDF_files.html> , quoted below:

> A CDL (network Common data form Description Language) file is an ASCII descripton of the binary data in a netCDF file that is designed to be easily read by humans. CDL files can be generated from netCDF files via the `ncdump', command. For example,
>
> ncdump -c sample.nc
> generates the file `sample.cdl' that contains the file name, the dimensions, the specification of the variables, any attributes and the data for any "coordinate variables." A CDL file of this type is shown below. Note that the double slash indicates a comment in the CDL file.
>
> netcdf implicit\_grid{
>
> dimensions:
> lon = 101;
> lat = 101;
> level = 5;
> time = UNLIMITED ; //(7 currently)
> variables:
>
> float A(time,level,lat,lon);
> A:units = "meters/second";
> float level(level);
>
> level:units = "millibars";
> float time(time);
>
> time:units = "hours";
> //global attributes:
>
> :x\_min = -180.f;
> :x\_max = 180.f;
> :x\_units = "degrees\_east";
> :x\_label = "longitude";
> :y\_min = -90.f;
> :y\_max = 90.f;
> :y\_units = "degrees\_north";
> :y\_label = "latitude";
>
> :z\_label = "level";
> :t\_label = "time";
>
> data:
> level = 1000, 850, 700, 500, 300 ;
> time = 0, 2, 4, 6, 8, 10, 12 ;
>
> The command `ncgen' is the inverse of`ncdump'; it converts an ASCII CDL file to a binary netCDF file. For example
>
> ncgen -o sample.nc sample.cdl
> converts the CDL file `sample.cdl' to the netCDF file`sample.nc'. The easiest way to create a netCDF file is to (1) write all the header data (the name, dimensions, variable and attribute specifications, and the values of any coordinate variables) to a CDL file, (2) convert the CDL file to a netCDF file using ncgen, and (3) continue writing the main data arrays to this netCDF file.


---

