copy netcdf file using python

前端 未结 5 1252
一整个雨季
一整个雨季 2020-12-19 10:45

I would like to make a copy of netcdf file using Python.

There are very nice examples of how to read or write netcdf-file, but perhaps there is also a good way how

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-19 11:14

    Since I discovered xarray, this has been my go-to tool for everything python+netCDF related

    You can easily copy a netcdf file, for example:

    import xarray as xr
    
    input = xr.open_dataset('ncfile.nc')
    input.to_netcdf('copy_of_ncfile.nc')
    

提交回复
热议问题