-
Notifications
You must be signed in to change notification settings - Fork 13
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
Problem reading multiple files using NSIDReader #69
Comments
Found a temparory solution for this: Make copy of each element in the list. This seems to ensure the two data remain different. |
Thanks for letting us know. The expected usage of readers is one reader per file. In your case you've instantiated a single object and (I believe) the same object is being used to read a new file resulting in it being overwritten. It would be better to write it as follows: reader1 = NSIDReader("data1.h5") reader2 = NSIDReader("data2.h5") This also is the better way because it allows you to close files. |
@ramav87 I just checked your solution, but the situation does not change. Strangely, the memory address of the two objects seems to be different, but the data is overwritten. Only copy() seems to work. |
I think it might be an issue with your specific interptretor. I tested this on Google Colab and it is functional: https://colab.research.google.com/drive/1n3iOGdUOff1t1Jbmq84GaIV-JK03lweP?usp=sharing Please take a look and let me know. |
@ramav87 Okay, I checked in Google Colab, and your code seems to be working. Upon deeper inspection, I found that this is the case even in my local machine. The problem is with its metadata, which is being overwritten. So, the metadata of dset1 is overwritten by that of dset2, whereas the actual data is not changed. |
Hello, I am able to successfully read one hdf5 file using NSIDReader and store it in a variable.
However, when I read another file and store it in another variable, somehow the 1st variable data is also replaced by the new file. Could you please help me with this?
example:
dset1 = NSIDReader("data1.h5").read()
--> dset1 consists of data from data1.h5
dset2 = NSIDReader("data2.h5").read()
--> now both dset1 and dset consists of data from data2.h5.
How do I prevent dset1 from being overwritten?
I have tried the NSIDReader from both SciFiReaders and pyNSID modules, with the same result.
The text was updated successfully, but these errors were encountered: