DataSet.to_nc(out, zip=True, overwrite=False, **kwargs)

to_nc: Save a dataset to a named file.

This will only work with single file datasets.

  • out (str) – Output file name.

  • zip (boolean) – True/False depending on whether you want to zip the file. Default is True.

  • overwrite (boolean) – If out file exists, do you want to overwrite it? Default is False.

  • **kwargs (kwargs) – Optional arguments to be sent to subset.


If you want to export a dataset to a netCDF file, do the following:

>>> ds.to_nc("")

By default this file will be zipped. If you do not want it zipped, do this:

>>> ds.to_nc("", zip = False)

By default this cannot overwrite files. If the output file exists, do the following:

>>> ds.to_nc("", overwrite = True)

If you only want to export a subset of the data, you can use optional arguments that will be sent to subset. For example, if you only wanted the year 2000, you would do this:

>>> ds.to_nc("", year = 2000)