1.5.1.1.11.1.2. polar2grid.writers.binary module

The Binary writer writes band data to a flat binary file.

By default it enhances the data based on the enhancement configuration file and then saves the data to a flat binary file. The output data type will match the input data for integer types (ex. uint8 -> uint8), but floating point types will always be forced to 32-bit floats for consistency between readers and changes in the low-level Satpy library. A different output type can be specified using the --dtype flag. To turn off scaling of the data (a.k.a. enhancements) the --no-enhance command line flag can be specified to write the “raw” band data.

class polar2grid.writers.binary.FlatBinaryWriter(name=None, filename=None, base_dir=None, enhance=None, **kwargs)[source]

Bases: ImageWriter

Write data to disk as flat binary files.

static _get_default_dtype(data_arr: DataArray) dtype[source]
_prep_data(data: DataArray, dtype: dtype, fill_value) Array[source]
save_dataset(dataset, filename=None, fill_value=None, overlay=None, decorate=None, compute=True, **kwargs)[source]

Save the dataset to a given filename.

This method creates an enhanced image using get_enhanced_image(). The image is then passed to save_image(). See both of these functions for more details on the arguments passed to this method.

save_image(img, filename=None, compute=True, dtype=None, fill_value=None, **kwargs)[source]

Save Image object to a given filename.

Parameters:
  • img (trollimage.xrimage.XRImage) – Image object to save to disk.

  • filename (str) – Optionally specify the filename to save this dataset to. It may include string formatting patterns that will be filled in by dataset attributes.

  • compute (bool) – If True (default), compute and save the dataset. If False return either a Dask Delayed object or tuple of (source, target). See the return values below for more information.

  • **kwargs – Other keyword arguments to pass to this writer.

Returns:

Value returned depends on compute. If compute is True then the return value is the result of computing a Dask Delayed object or running dask.array.store(). If compute is False then the returned value is either a Dask Delayed object that can be computed using delayed.compute() or a tuple of (source, target) that should be passed to dask.array.store(). If target is provided the the caller is responsible for calling target.close() if the target has this method.

polar2grid.writers.binary.add_writer_argument_groups(parser, group=None)[source]