[Thread Prev][Thread Next][Index]
[Fwd: Re: NetCDF Toolbox]
Dear Ferreters,
Well, after trying to solve this netCDF file writing dilemma with
the authors of the netCDF package for matlab I thought I'd inquire
with you all.
As I explain below (see forwarded message), I'd like to write a
netCDf file from matlab so that it is readable AND friendly to ferret.
The problem lies in the multiple grids that I want to use for the single
variable, XC, to be stored in the netCDF file. As I point out, I'd like
XC to be defined over a grid of constant dimension but with the range
of the x-axis to be a function of y. A 'show data' in ferret would
give me:
yes? show data
currently SET data sets:
1> /home/server/scratch/oxilia/netcdf/posum_test.cdf (default)
name title I J K L
XC 1:275 1:2 1:1 1:199
My question is: How do I define a VARIABLE grid x(j)? For all j the
dimension of i = [1:275], but the range of the axis in:
yes? shade xc[j=1]
will vary with j. For j=1, the x-axis will have limits [-10,10] say.
For j=2, the limits will be [-7,7].
Anybody know how to make matlab and ferret like eachother? Any
comments would be appreciated.
David.
David Oxilia wrote:
>
> Chuck,
>
> Thanks for your reply. I must say that the netCDF format is a bit of
> a mystery to me. Your suggestions were useful but my problem remains.
> I'll try to explain it better. First I should mention that I am not
> clear what the difference is between 'axes variables' and 'axes
> dependent variables'. To my mind, the former specify a 'grid',
> for example, (x,t). The latter are variables which make use of this
> grid. For the above example we'd have say f(x,t).
>
> The file I want to write consists of ONE single 3D variable, XC(x,y,t)
> which varies 'parametrically' with y. I'll write this as XC(x,t)|y,
> y = 1,...,N. Now, the DIMENSION of my grid (x,t) is constant for all
> y. However, the VALUES assigned to the axis variable x also vary with
> y. Thus, XC(x(y),t)|y is probably a better notation.
>
> In essence I need to write a different x-axis grid for each y.
> The XC are then written for each y on a different grid even though
> the dimension of the grid doesn't change; only the numerical values
> of x and y.
>
> I want to be able to read this file into other graphics software
> and make contour plots of XC(x,t). I'd like the plots to have
> labels specifying the y (actually latitude) for each XC(x,t) slice.
> The problem is that the range of values along the x-axis should
> dependent on y. For example, at 5N the x-axis will have a dimension
> of say 100 grid points and its range will be [-10,10]. At 10N
> the x-axis will still have 100 grid points but the range is now
> [-7,7].
>
> Writing the file as follows:
>
> % ------------------------------------------------------------
> % Dimensions
> nc('one') = 1;
> nc('latitude') = iymax;
> nc('t') = 2*m-1;
> nc('x') = n;
>
> % Axes & Variables
> nc{'latitude'} = 'latitude'; % an axis
> nc{'t'} = 't'; % an axis
> nc{'x'} = {'one','one','latitude','x'}; % a 4D axis !!
> nc{'XC'} = {'t','one','latitude','x'}; % a >4D variable?!
>
> % Attributes
> nc{'latitude'}.units = 'degrees';
> nc{'t'}.units = 'days';
> nc{'x'}.units = 'km';
> nc{'XC'}.units = ' ';
> nc{'XC'}.long_name = 'Time-Longitude Lagged Cross-Correlations';
>
> % Write data
> nc{'latitude'}(:) = yax; % a vector
> nc{'t'}(:) = tlax; % a vector
> nc{'x'}(:) = XLAX; % a 4D array
> nc{'XC'}(:) = CA; % a 4D array
> % ------------------------------------------------------------
>
> allows me to write the CDF file but the grid used to write XC
> is not 4D since nc{'x'} is a 4D axis! XC believes it has a 7D
> grid rather than a 4D grid.
>
> Well, I hope this isn't wasting too much of your time. If I
> undertood how grid axes differ from grid variables in CDF maybe
> I could figure out how to do this.
>
> Thanks again for any suggestions.
>
> David.
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
David Oxilia Tel: (541) 737~2368
COAS:Oregon State University Fax: (541) 737~2064
Ocean Admin. Bldg. 104 WWW: http://joule.oce.orst.edu/po
Corvallis, OR 97331-5503 Email: oxilia@hejira.oce.orst.edu
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
--- Begin Message ---
- To: Chuck Denham <cdenham@xxxxxxxx>
- Subject: Re: NetCDF Toolbox
- From: David Oxilia <oxilia@xxxxxxxxxxxx>
- Date: Wed, 28 Jan 1998 14:24:33 -0800
- Organization: COAS
- References: <199801281955.LAA05762@dnsman.OCE.ORST.EDU>
Chuck,
Thanks for your reply. I must say that the netCDF format is a bit of
a mystery to me. Your suggestions were useful but my problem remains.
I'll try to explain it better. First I should mention that I am not
clear what the difference is between 'axes variables' and 'axes
dependent variables'. To my mind, the former specify a 'grid',
for example, (x,t). The latter are variables which make use of this
grid. For the above example we'd have say f(x,t).
The file I want to write consists of ONE single 3D variable, XC(x,y,t)
which varies 'parametrically' with y. I'll write this as XC(x,t)|y,
y = 1,...,N. Now, the DIMENSION of my grid (x,t) is constant for all
y. However, the VALUES assigned to the axis variable x also vary with
y. Thus, XC(x(y),t)|y is probably a better notation.
In essence I need to write a different x-axis grid for each y.
The XC are then written for each y on a different grid even though
the dimension of the grid doesn't change; only the numerical values
of x and y.
I want to be able to read this file into other graphics software
and make contour plots of XC(x,t). I'd like the plots to have
labels specifying the y (actually latitude) for each XC(x,t) slice.
The problem is that the range of values along the x-axis should
dependent on y. For example, at 5N the x-axis will have a dimension
of say 100 grid points and its range will be [-10,10]. At 10N
the x-axis will still have 100 grid points but the range is now
[-7,7].
Writing the file as follows:
% ------------------------------------------------------------
% Dimensions
nc('one') = 1;
nc('latitude') = iymax;
nc('t') = 2*m-1;
nc('x') = n;
% Axes & Variables
nc{'latitude'} = 'latitude'; % an axis
nc{'t'} = 't'; % an axis
nc{'x'} = {'one','one','latitude','x'}; % a 4D axis !!
nc{'XC'} = {'t','one','latitude','x'}; % a >4D variable?!
% Attributes
nc{'latitude'}.units = 'degrees';
nc{'t'}.units = 'days';
nc{'x'}.units = 'km';
nc{'XC'}.units = ' ';
nc{'XC'}.long_name = 'Time-Longitude Lagged Cross-Correlations';
% Write data
nc{'latitude'}(:) = yax; % a vector
nc{'t'}(:) = tlax; % a vector
nc{'x'}(:) = XLAX; % a 4D array
nc{'XC'}(:) = CA; % a 4D array
% ------------------------------------------------------------
allows me to write the CDF file but the grid used to write XC
is not 4D since nc{'x'} is a 4D axis! XC believes it has a 7D
grid rather than a 4D grid.
Well, I hope this isn't wasting too much of your time. If I
undertood how grid axes differ from grid variables in CDF maybe
I could figure out how to do this.
Thanks again for any suggestions.
David.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
David Oxilia Tel: (541) 737-2368
COAS-Oregon State University Fax: (541) 737-2064
Ocean Admin. Bldg. 104
Corvallis, OR 97331-5503 Email: oxilia@hejira.oce.orst.edu
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
--- End Message ---
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement