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

party.read() seems to not work #587

Open
HGeoAle opened this issue Sep 17, 2024 · 1 comment
Open

party.read() seems to not work #587

HGeoAle opened this issue Sep 17, 2024 · 1 comment

Comments

@HGeoAle
Copy link

HGeoAle commented Sep 17, 2024

eqcorrscan 0.5.0
obspy version 1.4.1
numpy version 1.26.4

Describe the bug
I am trying to save my progress and I couldn't use the write() and read() feature on any party so far. I use party.write('filename') to get the file, I have checked that the file is created and it is some MB in size so I suspect the problem is not there. But when I tried to used party = Party().read('filename') it takes some minutes to run but at the end i get an empty party with 0 families,

To Reproduce
This problem happens every time I try to read a party.
so, far I only get 'Party of 0 Families' after printing the party. No error message

Expected behavior
I expect to recover the party with all its attributes.

Desktop (please complete the following information):

  • Operating System: Rocky Linux release 8.10 (Green Obsidian)
  • Python version: Python 3.11.8
  • EQcorrscan version: eqcorrscan 0.5.0

Additional context
The way around I am ussing is to dump the parties into pickles. I am aware this is also an option with write() and read() but seems to not work like that

write:

import pickle
pkl_output = open("party.pkl", 'wb')
pickle.dump(party, pkl_output)
pkl_output.close()

read:
import pickle with open('party_declust.pkl', 'rb') as f: party = pickle.load(f)

@calum-chamberlain
Copy link
Member

Hmm, that is annoying. Would you be able to share the file that you have written so I can try and work out where this is going wrong?

Pickling is usually the faster option, provided you are reading and writing on the same machine, and I would generally suggest that you use your pickling code unless you need portability. Nevertheless, you should be able to read your writen parties!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants