quantnn/utils.py
def serialize_dataset(dataset):
    """
    Writes xarray dataset to a bytestream.

    Args:
         dataset: A xarray dataset to seraialize.

    Returns:
         Bytes object containing the dataset as netcdf file.
    """
    _, filename = mkstemp()
    try:
        dataset.to_netcdf(filename)
        with open(filename, "rb") as file:
            buffer = file.read()
    finally:
        Path(filename).unlink()
    return buffer

    Writes xarray dataset to a bytestream.

    Args:
         dataset: A xarray dataset to seraialize.

    Returns:
         Bytes object containing the dataset as netcdf file.
    
Writes xarray dataset to a bytestream.
Writes xarray dataset to a bytestream .
def serialize_dataset(dataset):
    _, filename = mkstemp()
    try:
        dataset.to_netcdf(filename)
        with open(filename, "rb") as file:
            buffer = file.read()
    finally:
        Path(filename).unlink()
    return buffer
def serialize_dataset ( dataset ) : _ , filename = mkstemp ( ) try : dataset . to_netcdf ( filename ) with open ( filename , "rb" ) as file : buffer = file . read ( ) finally : Path ( filename ) . unlink ( ) return buffer
Writes xarray dataset to a bytestream.
Writes xarray dataset to a bytestream .
"""
    Writes xarray dataset to a bytestream.

    Args:
         dataset: A xarray dataset to seraialize.

    Returns:
         Bytes object containing the dataset as netcdf file.
    """
Bytes object containing the dataset as netcdf file.
Bytes object containing the dataset as netcdf file .
dataset
A xarray dataset to seraialize.
A xarray dataset to seraialize .