ncwrite

mipylib.dataset.midata.ncwrite(fn, data, varname, dims=None, attrs=None)

Write a netCDF data file from an array.

Param:

fn: (string) netCDF data file path.

Parameters:
  • data – (array_like) A numeric array variable of any dimensionality.

  • varname – (string) Variable name.

  • dims – (list of dimensions) Dimension list.

  • attrs – (list of attributes) Attributes list.

Examples

fn = 'D:/Temp/grads/model.ctl'
f = addfile(fn)
ps = f['PS'][:,:,:]
ncwrite('D:/Temp/grads/ncwrite_test.nc', ps, 'PS')