Hi all,
I am a newbie to vapor and am trying to create a vdf file from a netcdf file. For starters, let's say I want to just use two variables from the list below, 's' and 'temp'. Am pasting the output from ncdump below:
--------------------------
ncdump -h output.cdf
netcdf output {
dimensions:
x = 290 ;
y = 578 ;
sigma = 50 ;
ntr = 1 ;
ntrcon = 1 ;
variables:
double xc(x) ;
double yc(y) ;
double zc(sigma, y, x) ;
double h(y, x) ;
double s(sigma, y, x) ;
double temp(sigma, y, x) ;
double rho(sigma, y, x) ;
double p(sigma, y, x) ;
double u(sigma, y, x) ;
double v(sigma, y, x) ;
double w(sigma, y, x) ;
double vor(sigma, y, x) ;
double pv(sigma, y, x) ;
double KzMom(sigma, y, x) ;
double KzTr(sigma, y, x) ;
double psom_tke(sigma, y, x) ;
double psom_eps(sigma, y, x) ;
}
--------------
Both 's' and 'temp' are 3d variables with their slowest dimension (sigma) describing a vertically stretched coordinate. I tried the following:
ncdfvdfcreate -vars temp:s -zcoordvar sigma -zcoords zgrid.txt -gridtype stretched output.cdf mydata.vdf
where zgrid.txt is a file with 50 rows (=sigma), where the rows are the z-coordinates of the cells. The values in zgrid.txt increase monotonically. The above command, however, does not work as I get this error message:
Invalid coordinate array specification
Can somebody point out what am I doing wrong?
Thanks,
Sanjiv
I believe the problem is that 'sigma' is a dimension, not a coordinate variable. Also, if this is using sigma levels, then each vertical level is probably non-uniform, and varies on the x-y plane. I believe that a "layered" gridtype is appropriate here, and that we need to use the variable that describes the model's vertical elevation for the -zcoordvar. If you know what that variable is, then try the following and replace ??? with that variable:
ncdfvdfcreate -vars temp:s -zcoordvar ??? -gridtype layered output.cdf mydata.vdf
Let me know how that goes!
Thanks for your prompt response! I tried what you suggested. The z coordinate variable is 'zc' which appears near the top of the list of the variables (in ncdump output). The following command now goes through without errors:
ncdfvdfcreate -vars temp:s -zcoordvar zc -gridtype layered output.cdf mydata.vdf
Created VDF file:
Num time steps : 1
3D Variable names : s temp
2DXY Variable names :
2DXZ Variable names :
2DYZ Variable names :
Excluded 3D Variable names :
Excluded 2D Variable names :
Coordinate extents : 0 0 -0.400104 0.50173 1 0
I then type:
ncdf2vdf -vars temp:s output.cdf mydata.vdf
which gives me the output:
Processing VDC time step 0
Processing variable temp, data range (10.3407, 30.3855)
Processing variable s, data range (29.1565, 35.0479)
The data ranges for the two variables (ocean temperature and ocean salinity) look realistic. But when I try to load this vdf file into the gui, I get an error:
No data found in VDC
Not sure why. Am I creating the .vdf file incorrectly?
Does the elevation contained in the z-coordinate variable need to be positive in addition to being non-decreasing? I just realized that since I am working with an oceanic model, my z-coordinate at some (x,y) might look like this:
-390
-350
-300
.
.
-10
-7
-5
-3.5
.
.
So, at each (x,y) the z-coordinate is monotonically increasing (from ocean floor to the surface) but the values are negative, as usually the ocean surface is treated as z=0 in ocean models. Would the negative values be a problem for vapor?
Hmm I think this might be a bug or a problem in our documentation. It doesn't look like zc was added to the list of 3D variables for conversion. Try adding it so you have -vars temp:s:zc. If that doesn't work, is there a way that you could email me the file so I could take a closer look? pearse@ucar.edu or vapor@ucar.edu would be ok.
Certainly. Thanks for helping us refine our docs!