hypernets_processor.data_io.hypernets_writer module
HypernetsWriter class
- class hypernets_processor.data_io.hypernets_writer.HypernetsWriter(context=None)
Bases:
object
Class to write Hypernets output files
- archive_ds(ds, path)
Add dataset to archive database
- Parameters:
ds (xarray.Dataset) – dataset
path (str) – file path
- static fill_ds(ds)
Fill nan’s in ds will fillValue
- Parameters:
ds (xarray.Dataset) – dataset
- Returns:
filled data
- Return type:
xarray.Dataset
- return_directory(directory=None)
Return product directory, with respect to context and specified value
- Parameters:
directory (str) – (optional, required if self.context is None) directory to write to.
overwrites directory determined from self.context
- Returns:
directory
- Return type:
str
- return_fmt(fmt=None)
Return product fmt, with respect to context and specified value
- Parameters:
fmt (str) – (optional, required if self.context is None) format to write to, may be ‘netCDF4’ or ‘csv’.
overwrites directory determined from self.context
- Returns:
product format
- Return type:
str
- return_image_directory(directory=None)
Return image directory, with respect to context and specified value
- Parameters:
directory (str) – (optional, required if self.context is None) directory to write to.
overwrites directory determined from self.context
- Returns:
directory
- Return type:
str
- return_path(ds, directory=None, fmt=None)
make product path
- Parameters:
ds (xarray.Dataset) – dataset
directory (str) – (optional, required if self.context is None) directory to write to.
overwrites directory determined from self.context
- Parameters:
fmt (str) – (optional, required if self.context is None) format to write to, may be ‘netCDF4’ or ‘csv’.
overwrites directory determined from self.context
- return_plot_directory(directory=None)
Return plots directory, with respect to context and specified value
- Parameters:
directory (str) – (optional, required if self.context is None) directory to write to.
overwrites directory determined from self.context
- Returns:
directory
- Return type:
str
- return_rel_directory()
Return relative product directory, with respect to archive folder
- Returns:
directory
- Return type:
str
- write(ds, directory=None, overwrite=False, fmt=None, compression_level=None, remove_vars_strings=None, encodefloat32=True)
Write xarray dataset to file
- Parameters:
ds (xarray.Dataset) – dataset
directory (str) – (optional, required if self.context is None) directory to write to.
overwrites directory determined from self.context
- Parameters:
overwrite (bool) – set to true to overwrite existing file
fmt (str) – (optional, required if self.context is None) format to write to, may be ‘netCDF4’ or ‘csv’.
overwrites directory determined from self.context
- Parameters:
compression_level (int) – the file compression level if ‘netCDF4’ fmt, 0 - 9 (default is 5)