-1

guys I have a list of hdf5 files in my directory and I want to convert hdf5 files to nc files. Is there a way to do this in Python?

I tried using bash but encountered a lot of problems in the wsl. So I want to do this in Python. I suppose there's a way to do this with netCDF library. Can you please help?

Adib
  • 1
  • 1
  • You know netcdf4 is a subtype of hdf5? Just checking. Anyway I’d recommend xarray. It can read hdf5 directly with `xr.open_dataset` and will write netcdf4 files by default with `ds.to_netcdf`. – Michael Delgado Feb 01 '23 at 22:38
  • @MichaelDelgado Thank you so much. It worked and I didn't know that unfortunately. – Adib Feb 03 '23 at 15:23

1 Answers1

0

Thanks @Micheal Delgado

xr.open_dataset

ds.to_netcdf

Adib
  • 1
  • 1