Re : [GMT-HELP] Netcdf file help

"fabien.retif" <[email protected]> Wed, 21 May 2014 21:50:32 +0200
Newsgroups gmane.comp.gis.gmt.user
Message-ID <[email protected]>
Hi,

If you want to extract variables on a grid (lon, lat) to an ASCII file, you can use grd2xyz.
You can choose your variable by the character ? and your differents dimensions by [ ].
For example : 
grd2xyz mynetcdf.nc?myvar[time_index,lev_index]

grd2xyz mynetcdf.nc?myvar[0,0] will produce an ASCII file of your variable "myvar" at the time 0 and level 0 like this
120 10 1
121 10 2
120 5   3
121 5   4

Otherwise you can use directly your nc in GMT commands which uses grd files with always the same way : mynetcdf.nc?myvar[index,index,...]

What do you mean by surface diagram, does the grdimage command could do your job ?

If yes, you can process like this : 
grd2cpt mynetcdf.nc?myvar[0,0] &gt; pal.cpt
grdimage mynetcdf.nc?myvar[0,0] -JX10c -Cpal.cpt &gt; image.ps
ps2raster image.ps
...

Fabien

---- Le mer., 21 mai 2014 19:01:22 +0200 Sumant Jha&lt;[email protected]&gt; a écrit ---- 


Hi, 
 
I am trying to extract 4-D variables (time, lev, lat, lon) from netcdf “.nc” file using GMT to plot it as a surface diagram. I am not sure how to proceed. Can anyone guide me to a set of commands which I can use in GMT to extract that variable from the netcdf file? Or if someone has a script that can extract the variable and export it as text file, that would be great. 
 
Thank you. 
 
Mailing list for GMT discussions of all kinds. If you are not sure you have found a bug, discuss it here first. 
To formally report bugs or request features, please register and add New Issue on gmt.soest.hawaii.edu 
To unsubscribe, send the message "signoff gmt-help" to [email protected] 
Note: gmt-help will become obsolete on Sept 1, 2014 - please use forum on gmt.soest.hawaii.edu instead. 



_.-~-._.-~-._.-~-._.-~-._.-~-._ 
PhD. Fabien Rétif
Géosciences Montpellier
UMR 5243 - CC 60
Universite Montpellier II
Bat 22 - Bureau 468
Place Eugène Bataillon
34095 Montpellier Cedex 5
France
Tel : +33 (0)4.67.14.35.85
_.-~-._.-~-._.-~-._.-~-._.-~-._ 





Mailing list for GMT discussions of all kinds.  If you are not sure you have found a bug, discuss it here first.
To formally report bugs or request features, please register and add New Issue on gmt.soest.hawaii.edu
To unsubscribe, send the message "signoff gmt-help" to [email protected]
Note: gmt-help will become obsolete on Sept 1, 2014 - please use forum on gmt.soest.hawaii.edu instead.