pylawr.functions.output#
- pylawr.functions.output.save_netcdf(xr_ds, save_path, encoding=None)[source]#
Save a
xarray.Datasetto NetCDF with given save path securely. This function saves the NetCDF to a temporary path. This file is then moved to given save path. This ensures that the file cannot be written and opened at the same time.Warning
Time encoding like encoding={‘time’: {‘units’: ‘days since 1970-01-01’}} results in inconsistencies (only microseconds are affected).
- Parameters
xr_ds (
xarray.Datasetorxarray.DataArray) – This dataset is saved as NetCDF file to givensave_pathand can be opened with any NetCDF library.save_path (str) – The dataset is saved to this path. The temporary path is also based on specified file name in this path.