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

Feature to create miniseed record with encoded data samples #13

Closed
BIBIN-EUGINE opened this issue Aug 30, 2023 · 7 comments
Closed

Feature to create miniseed record with encoded data samples #13

BIBIN-EUGINE opened this issue Aug 30, 2023 · 7 comments

Comments

@BIBIN-EUGINE
Copy link
Contributor

New feature request:

Currently, the mseed crate only support to create miniseed records with raw data samples (i.e, not encoded). It would be good to create a function which can take encoded data samples as input and create a miniseed record.

@damb
Copy link
Owner

damb commented Aug 31, 2023

If I understand you correctly, you'd like to have facilities which allow packing miniSEED records from encoded data samples. Is this correct?

EDIT: How would handle the number of samples attribute of the record? Of course, we could pass the number of samples as an additional parameter to the pack function, however, this would be sensible only when packing into a miniSEED v3 record.

@BIBIN-EUGINE
Copy link
Contributor Author

Hi @damb , I didn't understand why it's only possible/sensible in the case of miniSEED v3 record.

Assume we have the encoded data and num. of smaples,

  • call msr3_pack_header2 to get the miniseed header for v2
  • then put together encoded data and miniseed header to create miniseed record.

Moreover, I am thinking it would be make more sense if we have this functionality in libmseed and mseed crate can provide a wrapper around that function. What do you think?

@damb
Copy link
Owner

damb commented Sep 1, 2023

Sorry for not being clear enough. Packing encoded data and providing the number of samples is only sensible into a miniSEED v3 record because v3 records are of variable length. On the other hand, miniSEED v2 records are of fixed size. Suppose the encoded data doesn't fit into a miniSEED v2 record. How would you perform splitting the encoded data samples?

@BIBIN-EUGINE
Copy link
Contributor Author

Good point, my suggestion is that this feature creates only a single record (size of rec len = header + encode data < MAX_REC_LEN) and if the encoded data doesn't fit in a single record supported by v2 then send a error message back to caller and let the caller handles that case.

@damb
Copy link
Owner

damb commented Sep 2, 2023

Does your suggestion work for all mseed::MSDataEncodings if padding missing samples with zeroes? I'm not familiar with all the encodings libmseed provides.

As you already suggested, I'd rather prefer an implementation of libmseed. Let's ping @chad-earthscope and ask him what he thinks about this idea.

@damb
Copy link
Owner

damb commented Dec 2, 2023

Closed due to inactivity. Please, feel free to reopen if required.

@damb damb closed this as completed Dec 2, 2023
@chad-earthscope
Copy link
Contributor

The use case appears quite esoteric. Can a real-world use case be described?

Not only would the library (libmseed or this crate) need to blindly trust the encoded payload and number of samples, the end result would likely end up with unfilled v2 records with a lot of padding. It is for these reasons that libmseed includes a msr3_repack_mseed3(), but no v2 equivalent.

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

3 participants