Search code examples
geospatialnetcdfgmtgis

How can I extract data from a netCDF variable using Generic Mapping Tools (GMT)


I have a netCDF file (e.g. 'file.nc') with 26 variables. These each have 500 time slices, on a grid (y=333, x=386).

Using Generic Mapping Tools (GMT), I'd firstly like to create a new netCDF file consisting of 1 variable (e.g. 'temp'), while retaining the variable's time, x and y dimensions.

I'd then like to extract the variable's values through time for a specific point on the grid.

What tools should I use, and how can I extract this data?

Thanks


Solution

  • Use NCO and the answers are firstly

    ncks -v var_nm in.nc out.nc
    

    and secondly

    ncks -d lat,25.0 -d lon,64.3 out.nc out2.nc