GithubHelp home page GithubHelp logo

Comments (7)

mavaylon1 avatar mavaylon1 commented on August 16, 2024

I'll take a look after Dev Days

from hdmf-zarr.

mavaylon1 avatar mavaylon1 commented on August 16, 2024

My initial concern was that the mode is changed somewhere along the line. However looking at the trace, I do not see anything where the mode changes. I checked with breakpoints and the mode stays as r+. I cloned a dev version of zarr to see if it is a zarr issue vs an issue on our end.

from hdmf-zarr.

mavaylon1 avatar mavaylon1 commented on August 16, 2024

I do believe the issue is consolidate metadata. I am running a check.

from hdmf-zarr.

mavaylon1 avatar mavaylon1 commented on August 16, 2024

@CodyCBakerPhD try doing this without consolidating metadata in write. It works.

with NWBZarrIO(path="./test_zarr_append.nwb.zarr", mode="w") as io:
    nwbfile_out = mock_NWBFile()
    io.write(nwbfile_out, consolidate_metadata=False)

Now looking at the zarr code, when we consolidate metadata, we use ConsolidatedMetadataStore. This interface does not seem to allow for setting items at all. In the doc string, it says it is "read only".

from hdmf-zarr.

mavaylon1 avatar mavaylon1 commented on August 16, 2024

I will document this to be explicit within our codebase and not require people to dig through zarr

from hdmf-zarr.

mavaylon1 avatar mavaylon1 commented on August 16, 2024

@oruebel You added

if self.__mode not in ['r' ,'r+']:
                # r- is only an internal mode in ZarrIO to force the use of regular open. For Zarr we need to
                # use the regular mode r when r- is specified
                mode_to_use = self.__mode if self.__mode != 'r-' else 'r'
                self.__file = zarr.open(store=self.path,
                                        mode=mode_to_use,
                                        synchronizer=self.__synchronizer,
                                        storage_options=self.__storage_options)
            else:
                self.__file = self.__open_file_consolidated(store=self.path,
                                                            mode=self.__mode,
                                                            synchronizer=self.__synchronizer,
                                                            storage_options=self.__storage_options)

I think we should have a condition that uses open when the mode is "r+" and not __open_file_consolidated. (This does work). There would also be a warning.

from hdmf-zarr.

oruebel avatar oruebel commented on August 16, 2024

I think we should have a condition that uses open when the mode is "r+"

Agreed, I think we should just change the check to if self.__mode == 'r' to only open with consolidated metadata when the file is in read-only mode and use the regular zarr.open otherwise.

from hdmf-zarr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.