Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No satisfying error handling when uploading a dataset with an empty layer #940

Open
cdfhalle opened this issue Aug 23, 2023 · 0 comments
Open
Labels

Comments

@cdfhalle
Copy link

Context

  • Affected library: webknossos
    The error occurs when creating a Dataset that contains an empty layer using the WK python library and subsequently calling dataset.upload().
    Code to reproduce the error
import webknossos as wk
import numpy as np

def main():
    dataset = wk.Dataset("testoutput/emptyLayerDataset", voxel_size=(30, 30, 32.48))
    layer = dataset.add_layer(
        layer_name="color", category="color", dtype_per_channel="uint8", num_channels=3
    )
    mag1 = layer.add_mag("1")
    mag1.write(
        absolute_offset=(10, 20, 30),
        # assuming the layer has 3 channels:
        data=(np.random.rand(3, 512, 512, 32) * 255).astype(np.uint8),
    )
    layer = dataset.add_layer(
        layer_name="segmentation",
        category="segmentation",
        largest_segment_id="255",
        dtype_per_channel="uint8",
        num_channels=1,
    )
    remote_dataset = dataset.upload()
    url = remote_dataset.url
    print(f"Successfully uploaded {url}")

if __name__ == "__main__":
    main() 

Expected Behavior

A descriptive Error message like "The dataset contains an empty layer." should be thrown.

Current Behavior

The following error message appears:
FileNotFoundError: Cannot create read-only dataset, could not find data at https://data-humerus.webknossos.org/data/zarr/scalable_minds/emptyLayerDataset.

@cdfhalle cdfhalle added the bug label Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant