Re: Netcdf file help

Sumant Jha <[email protected]> Thu, 22 May 2014 10:09:54 -0600
Newsgroups gmane.comp.gis.gmt.user
Message-ID <[email protected]>
Thanks Fabien. This is what I suspected when I thought to work on the netcdf file with GMT, but was not sure. I thought, I might be missing some simple command, and as you pointed out, I was - the grd2xyz with variable option. Unfortunately, that is not a good option as well (yet - I will try fiddling with grd2xyz and may be unix awk command and see if I am able to create what I am looking for)

The final aim of this exercise is to generate an input file for RAMS(Regional Atmospheric Modeling system), and there are 100’s of such netcdf files. I tried using Panoply but working on each variable of each file - takes huge amount of time, and is not a viable option. 
I will keep looking. :)


On May 22, 2014, at 10:01 AM, fabien.retif <[email protected]> wrote:

> No, I don't think that GMT provides a way to extract a 5D layer to an ASCII.
> 
> I am curious about your final aim because it's difficult to store 5D with a simple ASCII file (that's why netcdf exists) and the size of your file will be very large !
> 
> With GMT, you can select a slice (1D or 2D) of your datafile and work on it (grdsample, grdimage, grdvector) or extract this slice to an ASCII file.
> 
> Fabien
> 
> ---- Le jeu., 22 mai 2014 17:48:19 +0200 Sumant Jha<[email protected]> a écrit ---- 
> 
> So, it is possible to extract a 5D layer (temp, lev, lat, lon, value) in GMT?
> 
> 
> On May 22, 2014, at 9:38 AM, fabien.retif <[email protected]> wrote:
> 
>> Yes it's ok. grd2xyz extracts a 2D layer (lon, lat ,value). If the GMT command starts by grd*, you have to give a 2D grid layer (grd) .
>> So you can select a layer 2D from a netcdf file with N-dim by netcdf.nc?myVar[0,0,...,0]
>> If you want to extract a specific point (1D), you can use grdtrack. You have to put the coordinate of your point in a ascii file (one coordinate (lon lat) by line) and to give your grd file with -Gmynetcdf.nc?myVar[0,0]
>> I hope it's clear.
>> .
>> Fabien
>> 
>> ---- Le jeu., 22 mai 2014 16:55:56 +0200 Sumant Jha<[email protected]> a écrit ---- 
>> 
>> That helped.
>> I used the following command:
>> grd2xyz geoschem_nestedNA_10_20041011.nc?IJ_AVG_S__BCPI[time,lev,lat,lon] > IJ_AVG_S__BCPI_10_20041011_1.xyz
>> 
>> and got the following output: 
>> 220  70 0.00774827273563
>> 220.666666667 70 0.00774506758898
>> 221.333333333 70 0.00774536235258
>> 222  70 0.00741489697248
>> 
>> This output file has just three columns, whereas in my grd2xyz command to gmt, i asked for time, lev, lat, lon, as well. Did I do something wrong?
>> 
>> 
>> On May 22, 2014, at 8:41 AM, fabien.retif <[email protected]> wrote:
>> 
>>> grd2xyz geoschem_nestedNA_10_20041011.nc?IJ_AVG_S__BCPI[time,lev] > IJ_AVG_S__BCPI_10_20041011.xyz
>>> 
>>> netcdf.nc?varName[time_index,lev_index,.....,Ndim_index]
>> 
>> 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.
> 
> 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.


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.