# NC2TABLE

### From BAWiki

## Basic Information

### Name of Program

NC2TABLE

### Version-Date

May 2024

### Description-Date

September 2022

## Catchwords

data conversion

postprocessor

synoptic data sets

CF NetCDF format

CSV format (*comma separated values*)

tabular data

support of DMQS metadata and variables

automatic adjustment of number of data READ to chunk size of input data

Acknowledgment:This project took advantage of netCDF software developed by UCAR/Unidata (www.unidata.ucar.edu/software/netcdf/).

## Short Description of Functionality

Program NC2TABLE allows selective data extraction from CF NetCDF files to CSV files. Extracted data ares stored in tabular form and may be subsequently used in spread sheet programs like MS EXCEL.

### General Introduction

Geophysical variables **f_i** stored in (netCDF) data files are typically dependent on different numbers of coordinates. According to the CF metadata standard, time and date as well as geographical location are the required minimum.

General form of a variable (function):

f = f_i(t,x[,z][,l][,c])

In the above definition, **t** means time, **x** stands for the (horizontal) location, **z** is either height or depth, **l** symbolizes a *label* (e. g. a sediment fraction) and **c** is typically representing (other) classes, e. g. for a probability distribution.

Expressions function and variable are synonymously used in the following.

### Structure of Tables

Tables consist out of rows and columns. Tables are best suited for the following data presentations:

**Table Type 1**(functional profile): The dependence of**f_i**on two different coordinates is displayed. The values of (optionally) present other coordinates are frozen in. Example: water level in dependence on (discrete) space**x_m**and (discrete) time**t_n**.- Typical combinations for axes are:
- Time series (Ts):
**f(t,x)**Ts for several locations,**f(t,z)**Ts for several vertical layers,**f(t,l)**Ts for multiple sediment fractions and**f(t,c)**Ts for various classes (probability distribution) or frequencies (spectrum). - Dependence on horizontal position:
**f(x,z)**variation over height or depth,**f(x,l)**variation over sediment fractions and**f(x,c)**variation over classes (probability distribution) or frequencies (spectrum). - Dependence on vertical position:
**f(z,l)**variation over sediment fractions and**f(z,c)**variation over classes (probability distribution) or frequencies (spectrum). - Other:
**f(l,c)**probability distribution for various sediment fractions.

- Time series (Ts):

- Typical combinations for axes are:
**Table Type 2**(comparison of functions): The dependence of several functions**f_i**, with**i=1,n_i**, in dependence on a single coordinate can be displayed. All other coordinate values remain frozen in. Example: time series of water level, current velocity and salinity for a specific location.

Program NC2TABLE supports both above mentioned types of tables. For date and time data items the time zone used can be selected via file nc2table.dat.

### Input-Files

**general input data**(file type nc2table.dat);**geophysical data**(file type cf-netcdf.nc).

### Output-Files

**ASCII tables**(file type nc2table.csv) in CSV file format;**Metadata**(filetype nc2table.txt) in readable form (text file);- (optional) informative
**printer file**of program execution (file type nc2table.sdr) - (optional)
**trace**of program execution (file type nc2table.trc)

### Methodology

Binary data are extracted an printed in tabular form according to the user requirements.

Just in case **HDF error** is detected during read of a data record, the program tries to reconstruct the wanted data set from adjacent (in time) records for the same variable. This type of repair works for time dependent variables only.

## Program(s) to run before this Program

DATACONVERT, GRIDCONVERT, NCAGGREGATE, NCANALYSE, NCCHUNKIE, NCCUTOUT, NCDELTA, NCDVAR, NCMERGE, UNTRIM2007, UNTRIM2

## Program(s) to run after this Program

spread sheet program, text editor

## Additional Information

### Language

Fortran95

### Additional software

---

### Original Version

G. Lang

### Maintenance

### Documentation/Literature

template files available in **$PROGHOME/examples/nc2table**

back to Program Descriptions