Hi,all
I need to plot nc formatted grid files which contain some different variables. How to select the one I needed to plot using grdimage?
I tried the ncfilename?var
, but it did not work.
Lei
Hi,all
I need to plot nc formatted grid files which contain some different variables. How to select the one I needed to plot using grdimage?
I tried the ncfilename?var
, but it did not work.
Lei
The ncfilename?var
method should work. Could you post the output of gmt grdinfo ncfilename
and gdalinfo ncfilename
so we can look at the NetCDF metadata?
Thanks.
I got the reason now. The var
should not set like:
fig.grdimage(grid=grid?var,projection="Cyl_stere/150/-20/15c", region="g")
Instead, it should be:
grid = 'ncfilename?var'
fig.grdimage(grid=grid,projection="Cyl_stere/150/-20/15c", region="g")
Yep, and just for future reference, the relevant GMT documentation page is at https://docs.generic-mapping-tools.org/6.2/cookbook/features.html#modifiers-for-coards-compliant-netcdf-files. The ncfilename?var
syntax is for 2-D NetCDF files, but apparently you can do more complicated selections on 3-D and 4-D NetCDF files too using e.g. ncfilename?var[1]
or ncfilename?var[1,2]
. Might come in handy someday!