act.io.WriteDataset.write_netcdf

WriteDataset.write_netcdf(cleanup_global_atts=True, cleanup_qc_atts=True, join_char='__', make_copy=True, cf_compliant=False, delete_global_attrs=['qc_standards_version', 'qc_method', 'qc_comment'], FillValue=-9999, cf_convention='CF-1.8', **kwargs)[source]

This is a wrapper around Dataset.to_netcdf to clean up the Dataset before writing to disk. Some things are added to global attributes during ACT reading process, and QC variables attributes are modified during QC cleanup process. This will modify before writing to disk to better match Climate & Forecast standards.

Parameters:
  • cleanup_global_atts (boolean) – Option to cleanup global attributes by removing any global attribute that starts with an underscore.

  • cleanup_qc_atts (boolean) – Option to convert attributes that would be written as string array to be a single character string. CF 1.7 does not allow string attribures. Will use a single space a delimeter between values and join_char to replace white space between words.

  • join_char (str) – The character sting to use for replacing white spaces between words when converting a list of strings to single character string attributes.

  • make_copy (boolean) – Make a copy before modifying Dataset to write. For large Datasets this may add processing time and memory. If modifying the Dataset is OK try setting to False.

  • cf_compliant (boolean) – Option to output file with additional attributes to make file Climate & Forecast complient. May require runing .clean.cleanup() method on the object to fix other issues first. This does the best it can but it may not be truely complient. You should read the CF documents and try to make complient before writing to file.

  • delete_global_attrs (list) – Optional global attributes to be deleted. Defaults to some standard QC attributes that are not needed. Can add more or set to None to not remove the attributes.

  • FillValue (int, float) – The value to use as a _FillValue in output file. This is used to fix issues with how Xarray handles missing_value upon reading. It’s confusing so not a perfect fix. Set to None to leave Xarray to do what it wants. Set to a value to be the value used as _FillValue in the file and data array. This should then remove missing_value attribute from the file as well.

  • cf_convention (str) – The Climate and Forecast convention string to add to Conventions attribute.

  • **kwargs (keywords) – Keywords to pass through to Dataset.to_netcdf()

Examples

ds_object.write.write_netcdf(path='output.nc')