mpas_tools.io.write_netcdf

mpas_tools.io.write_netcdf(ds, fileName, fillValues={'S1': '\x00', 'f4': 9.969209968386869e+36, 'f8': 9.969209968386869e+36, 'i1': - 127, 'i2': - 32767, 'i4': - 2147483647, 'i8': - 9223372036854775806, 'u1': 255, 'u2': 65535, 'u4': 4294967295, 'u8': 18446744073709551614}, format='NETCDF3_64BIT', char_dim_name='StrLen')[source]

Write an xarray.Dataset to a file with NetCDF4 fill values and the given name of the string dimension. Also adds the time and command-line to the history attribute.

Parameters
  • ds (xarray.Dataset) – The dataset to save

  • fileName (str) – The path for the NetCDF file to write

  • fillValues (dict, optional) – A dictionary of fill values for different NetCDF types

  • format ({'NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT',) – ‘NETCDF3_CLASSIC’}, optional The NetCDF file format to use

  • char_dim_name (str, optional) – The name of the dimension used for character strings, or None to let xarray figure this out.