windkit.raster_map.raster_map_to_file

windkit.raster_map.raster_map_to_file(da, filename, lctable=None, lctable_var='id', save_lctable=False, **kwargs)[source]

Write raster to a Surfer ASCII Grid (GRD), geotiff or netcdf file.

We recommend that unless you have a need for another format, that you write to netcdf, as this preserves all the metadata of the file. Next would be geotiff, and finally use GRD if you need compatability with tools that only support that format.

Parameters:
  • da (xarray.DataArray) – Raster to write.

  • filename (str or pathlib.Path) – Path to file.

  • lctable (LandCoverTable) – LandCoverTable used to write out landcover fields, required for landcover maps. Defaults to None.

  • lctable_var (str) – If writing an lctable, you can specify the variable that you want to write to file. Defaults to “id”.

  • save_lctable (bool) – Save lctable table to a json file of the same name as the output file to retain all landcover metadata?. Defaults to False.

  • kwargs (dict) – Extra arguments.