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

Unable to open converted file on Windows with datatree v0.0.4 #732

Closed
imranmaj opened this issue Jun 18, 2022 · 6 comments
Closed

Unable to open converted file on Windows with datatree v0.0.4 #732

imranmaj opened this issue Jun 18, 2022 · 6 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@imranmaj
Copy link
Contributor

imranmaj commented Jun 18, 2022

On Windows, open_converted fails with a KeyError on Sonar\\Beam_group1. I believe this is because of the way this function in datatree is currently written: /~https://github.com/xarray-contrib/datatree/blob/b7cdaa0d702b559a2ece763c4f4dfa707401d5a8/datatree/io.py#L14-L19

The native path separator on Windows is "\", not "/", and the function uses pathlib, which uses the native path separator. This causes nested group paths to use "" on Windows, which is not a valid netCDF4 group path, causing the netCDF4 engine to error out.

@imranmaj imranmaj added the bug Something isn't working label Jun 18, 2022
@imranmaj
Copy link
Contributor Author

This issue is solved by upgrading xarray-datatree to 0.0.6 but that breaks a lot of other things

@imranmaj imranmaj changed the title Unable to open converted file on Windows Unable to open converted file on Windows with datatree v0.0.4 Jun 19, 2022
@emiliom emiliom added this to the 0.6.1 milestone Jun 19, 2022
@emiliom
Copy link
Collaborator

emiliom commented Jun 19, 2022

From #731 (comment):

I was able to run the tests by manually editing the datatree library source code on my machine

@imranmaj when you get a chance could you share those edits here, if they're small?

I think this issue is an important one. I've flagged it as Milestone 0.6.1.

@leewujung
Copy link
Member

@emiliom : agreed! This is an urgent issue since Windows users would run into trouble if they upgrade to v0.6.0.

@leewujung leewujung moved this to Todo in Echopype Jun 19, 2022
@imranmaj
Copy link
Contributor Author

@imranmaj when you get a chance could you share those edits here, if they're small?

With datatree v0.0.4,

In datatree\io.py:

Change line 17 from

    parrent = pathlib.Path(parrent)

to

    parrent = pathlib.PurePosixPath(parrent)

In datatree\io.py:

Change line 25 from

    parrent = pathlib.Path(parrent)

to

    parrent = pathlib.PurePosixPath(parrent)

@emiliom
Copy link
Collaborator

emiliom commented Jun 19, 2022

Thanks! Wow, that's simple.

@leewujung
Copy link
Member

Work needed, from @imranmaj :

Besides the ChildResolverError -> KeyError it looks like most if not all of the work will be in the repr

@leewujung leewujung moved this from Todo to In Progress in Echopype Jun 30, 2022
Repository owner moved this from In Progress to Done in Echopype Jul 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

4 participants