3

Is there a quick and simple way to convert HDF5 files to netcdf(4) from the command line in bash? Alternatively a simple script that handle such a conversion automatically in R, NCL or python ?

ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
  • 2
    Not all HDF5 files can be converted to netcdf4; for example, HDF5 variables don't need dimensions, but [netcdf4-python/](https://unidata.github.io/netcdf4-python/) says "before any netcdf4 variables can be created the dimensions they use must be created first." However I don't know of a program that converts what it can, nor even of a list of differences. – denis May 20 '18 at 09:55

3 Answers3

6

with netcdf-c library you can:

$ nccopy in.h5 out.nc
ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
3

You can easily convert hdf5 format data to nedtcdf-4 data by this command which is given below:

ncks inputfile_name.h5 outputfile_name.nc

Note: this inputfile.h5 data I have got from mosdac website.

Kevin Cazelles
  • 1,255
  • 9
  • 20
Asraful
  • 31
  • 1
0

NCL's ncl_convert2nc function is my go-to for this type of problem: https://www.ncl.ucar.edu/Document/Tools/ncl_convert2nc.shtml

N1B4
  • 3,377
  • 1
  • 21
  • 24