Feature #104

Allow reading of 2-dimensional table data in netCDF format

Added by Remko about 5 years ago. Updated over 3 years ago.

Status:ClosedStart date:2012-06-28
Priority:NormalDue date:
Assignee:Remko% Done:


Target version:Candidate for next minor release


This is a long-standing request for enhancement.

We can now use, for example:
gmtconvert file.nc?time/lat/lon
psxyz file.nc?x/y/z
As long as time, lat, lon or x, y, z are 1-dimensional.

It would be particularly useful for gmtconvert to be able to write out 1-column out of a 2-d data set, or even the entire 2-d data set.


#1 Updated by Remko about 5 years ago

  • Status changed from New to Feedback

This is now implemented.
The following explanation is added to GMT_Docs section 4.21:

Programs that generally deal with columns of one-dimensional data, like psxy or gmtconvert can use multi-dimensional netCDF files in a very similar way. If a variable in a netCDF file is one-dimensional, there is nothing more needed than name the variables on the command line. For example:

psxy "file.nc?lon/lat" ...
gmtconvert "file.nc?time/lat/lon"

If one or more of the selected variables are two-dimensional, and have the same leading dimension as the other selected variables they will be plotted in their entirety. For example, if a netCDF files contains 6 time steps recording temperature at 4 points, and the variable temp is a 6 by 4 array, then the command
gmtconvert "file.nc?time/temp" -f0T can result in:
2012-06-25T00:00:00 20.1 20.2 20.1 20.3
2012-06-25T12:00:00 24.2 23.2 24.5 23.5
2012-06-26T00:00:00 16.1 16.2 16.1 16.3
2012-06-26T12:00:00 22.1 23.0 23.9 23.5
2012-06-27T00:00:00 17.5 16.9 17.2 16.8
2012-06-27T12:00:00 27.2 27.2 27.5 27.5

If, for example, only the second temperature column is needed, use gmtconvert "file.nc?time/temp[1]"
(indices start counting at 0).

#2 Updated by Florian almost 4 years ago

  • Target version changed from 5.1.0 to Candidate for next minor release

#3 Updated by Remko over 3 years ago

  • Status changed from Feedback to Closed

Already working in 5.1.x for some time.

Also available in: Atom PDF