TransWikia.com

Export NetCDF Dimension Name

Mathematica Asked by user1139069 on August 22, 2021

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);

One Answer

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.

Answered by SneezeFor16Min on August 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP