2
$\begingroup$

In the NetCDF format, I can define a common dimension with a specified name. Then when I create variables, I can have the dimensions of those variables reference the same dimension name. Is there away todo this when exporting from Mathematica? I have some data I'm trying to export

Export["test.nc",
 {"Datasets" -> {
    "x" -> fullData[[;; , 1]],
    "y" -> fullData[[;; , 2]],
    "z" -> fullData[[;; , 3]],
    "x_norm" -> fullData[[;; , 4]],
    "y_norm" -> fullData[[;; , 5]],
    "z_norm" -> fullData[[;; , 6]]
    },
  "DataFormat" -> {
    "Real64",
    "Real64",
    "Real64",
    "Real64",
    "Real64",
    "Real64"
    }}, "Rules"]

But I need it to show up in the NetCDF file as

dimension:
  size = 963;
variables:
  double x(size=963);
  double y(size=963);
  double z(size=963);
  double x_norm(size=963);
  double y_norm(size=963);
  double z_norm(size=963);

Instead of

dimension:
  xDim = 963;
  yDim = 963;
  zDim = 963;
  x_normDim = 963;
  y_normDim = 963;
  z_normDim = 963;
variables:
  double x(xDim=963);
  double y(yDim=963);
  double z(zDim=963);
  double x_norm(x_normDim=963);
  double y_norm(y_normDim=963);
  double z_norm(z_normDim=963);
$\endgroup$
0
$\begingroup$

In case the problem remains unsolved after versions and FYI, here's a temporary solution:

  1. Export your data array to some Python-readable format file. HDF5 may do well. (163685)
  2. Import the data array from file to Python.
  3. Use netCDF4 library to export the desired NetCDF.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.