Hi Francois,
As you probably know, the coordinate variables for your variable
will be written to the netCDF file, with whatever dimension names
they have in the input file. Check "ncdump -h filename.nc" or
"ncdump -c filename.nc" to see what's already there.
To define variables containing the coordinate information, it would
go like this:
let longitude = x[gx=p]
let latitude = y[gy=p]
let time_coord_t = t[gt=p]
let time_index_t = L[gt=p]
I made variables with the time coordinates and time indices. I'm not
sure which you're talking about. You might want to give them units,
in which case the commands would look like
let/units="`p,return=xunits`" longitude = x[gx=p]
and so forth. To write a time variable along a K axis rather than
an L axis,
let time_coord = zsequence(time_coord_t)
again with units if you want. To put the variable P onto an grid
defined in terms of index values i,j,k, just define those axes and
regrid P to that grid.
let nx = `p,return=isize`
let ny = `p,return=jsize`
let nt = `p,return=lsize`
define axis/x=1:`nx`:1 xindex
define axis/y=1:`ny`:1 yindex
define axis/z=1:`nt`:1 zindex
define grid/x=xindex/y=yindex/z=zindex index_grid
let pp = p[g=index_grid@ASN]
The ASN transformation will be fine because you're not changing the
shape of the variable. Now you can save all of this to the file.
Ansley
On 2/14/2012 9:28 AM, DELCLAUX Francois wrote:
Hi ferret users,
In a netcdf file, I have a P (x,y,t) variable,
I would like to write in an other netcdf file the 4 variables
longitude, latitude, time, and P separately such as :
- longitude(i)
- latitude(j)
- time(k)
- P(i,j,k)
So I would like :
1) to create longitude and latitude variables
2) to create time variable function of k
3) to transfer time index in k index for P variable.
What's the best way for doing that ?
Thanks in advance,
Sincerely
Francois DELCLAUX
------------------------------------------------------------
UMR HydroSciences Montpellier
Universite Montpellier II - Place Eugene Bataillon
Case courrier MSE
34095 Montpellier Cedex 5 FRANCE
http://www.hydrosciences.fr/
mailto: delclaux@xxxxxxxxxxxxxxxxxxx
Tel : (33) (0)4 67 14 90 11 Fax : (33) (0)4 67 14 47 74
------------------------------------------------------------
|