---
name: "nc2xy"
section: "1gmt"
platform: "linux"
package: "gmt"
version: "4.5.12-1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/nc2xy"
---

# nc2xy(1gmt)

Converting netCDF column file(s) to ASCII xy data

## NAME

nc2xy - Converting netCDF column file(s) to ASCII xy data

## SYNOPSIS

**nc2xy** *files* \[ **-F***var1/var2/...* \] \[ **-S**\[**r**\] \] \[ **-V** \] \[ **-f***colinfo* \] \[ **-bo** \]

## DESCRIPTION

**nc2xy** reads one or more netCDF files with column data and writes out those columns in ASCII format to standard output, so that they can be used by **psxy**, **psxyz**, or **xyz2grd**. Modify the precision of the ASCII output format by editing the **D\_FORMAT** parameter in your .gmtdefaults4 file or use **--D\_FORMAT**=*value* on the command line.

- *files*

  Names of netCDF files to be converted.

## OPTIONS

- **-F**

  Specify up to 10 names of the variables (separated by slashes) to be printed out. All variables to be 1-dimensional and be of equal length. When omited, the first two variables in the netCDF file will be printed.

- **-S**

  Suppress output for records with one or more NaN values \[Default outputs all nodes\]. Append **r** to reverse the suppression, i.e., only output the records with at least one NaN value.

- **-V**

  Selects verbose mode, which will send progress reports to stderr \[Default runs "silently"\].

- **-bo**

  Selects binary output. Append **s** for single precision \[Default is **d** (double)\]. Uppercase **S** or **D** will force byte-swapping. Optionally, append *ncol*, the number of desired columns in your binary output file.

- **-f**

  Special formatting of input and/or output columns (time or geographical data). Specify **i** or **o** to make this apply only to input or output \[Default applies to both\]. Give one or more columns (or column ranges) separated by commas. Append **T** (absolute calendar time), **t** (relative time in chosen **TIME\_UNIT** since **TIME\_EPOCH**), **x** (longitude), **y** (latitude), or **f** (floating point) to each column or column range item.  Shorthand **-f**\[**i**\|**o**\]**g** means **-f**\[**i**\|**o**\]0**x**,1**y** (geographic coordinates). See also **TIME COORDINATES** below.

## TIME COORDINATES

Time coordinates in netCDF files will be recognized as such. The variable's **unit** attribute is parsed to determine the unit and epoch of the time coordinate in the grid. Values are then converted to the internal time system specified by **TIME\_UNIT** and **TIME\_EPOCH** in the .gmtdefaults file or on the command line. The default output is relative time in that time system, or absolute time when using the option **-f0T**, **-f1T**, etc.

## EXAMPLES

To print out latitude, longitude and height in a netCDF file as ASCII records, while suppressing all NaN values:\

**nc2xy** **-F** lat/lon/height **-S** trackfile.nc \> trackfile.xy

## SEE ALSO

[*gmtdefaults*(1)](/gmtdefaults/1.md), [*GMT*(1)](/GMT/1.md), [*psxy*(1)](/psxy/1.md), [*psxyz*(1)](/psxyz/1.md), [*xyz2grd*(1)](/xyz2grd/1.md)
