Netcdf outputs the wrong values in the data given [closed]

I am working on a task which includes converting data to nc file.
We are using NetCdf, we have 3 dim (x,y,time), a variable and also the data we are passing.

For the data structure we have a vector of Matrices, so the vector is the time and matrices are x and y.

Before I call this line:

nc_put_var_float(l_ncId, l_varIdHeight, m_data_height[0].data());
checkNcErr(l_err);

The data looks like this:

  5, 5, 5, 5, 5,
  5, 5, 5, 5, 5,
  5, 5, 5, 5, 5,
  5, 5, 5, 5, 5,
  5, 5, 5, 5, 5,

and when I compile and ncdump the file it looks like this:

  5.614982e+21, 7.006492e-45, 3.778055e-38, -2.64573e+17, 7.006492e-45,
  0, -4.589888e-37, 3.093086e-41, 7.006492e-45, 0,
  7.006492e-45, 0, -4.589988e-37, 3.093086e-41, 7.006492e-45,
  0, 7.006492e-45, 0, -4.590039e-37, 3.093086e-41,
  7.006492e-45, 0, 7.006492e-45, 0, -4.590182e-37,

So does any one know what the solution for that is?

Note: the sizes of the matrix are coming outside of the Class

params:

size_t                   i_x,  
size_t                   i_y

Leave a Comment