Giter VIP home page Giter VIP logo

Comments (11)

krischer avatar krischer commented on August 26, 2024

Haha :-) Oh well...yea i did not test that. I'll have a look.

What actually happens when you store the above mentioned data in an ASDF file? Is it stored as single bytes? As mentioned in the obspy issue: you should really fix the file - whatever ends up in the ASDF file is likely garbage.

from pyasdf.

wjlei1990 avatar wjlei1990 commented on August 26, 2024

In asdf file, it stores as byte:

In [4]: ds.waveforms.XA_SA71.raw_observed[0].data
Out[4]: 
array(['\x0c', '\r', '\x05', ..., '\x07', '\n', '\n'], 
      dtype='|S1')

My current plan for this is: just throw those file away during processing...So if pyasdf now can catch the error and run through, I feel OK.

from pyasdf.

krischer avatar krischer commented on August 26, 2024

You can probably fix them with this tool: https://seiscode.iris.washington.edu/projects/msmod

Just change the encoding to whatever it really is - likely STEIM1 or STEIM2.

from pyasdf.

krischer avatar krischer commented on August 26, 2024

I'll make pyasdf raise an exception if one tries to add non-numeric arrays - that does not really make sense for waveforms in ASDF - the auxiliary data should be used for that.

from pyasdf.

wjlei1990 avatar wjlei1990 commented on August 26, 2024

I agree.

So two things?

  1. Check the data type for the array during conversion.
  2. fix the UnicodeDecodeError in error handling.

from pyasdf.

wjlei1990 avatar wjlei1990 commented on August 26, 2024

I strip the code out to form a simple test, but couldn't really reproduce the error.

I have attached my code and data here.
test_read.py.txt
XA.SA72.mseed.txt

Not sure if I am doing the right thing...

from pyasdf.

krischer avatar krischer commented on August 26, 2024

The encoding issue should be fixed - can you check? You will likely no longer be able to test once the check for the data type is implemented.

from pyasdf.

wjlei1990 avatar wjlei1990 commented on August 26, 2024

I am going to test it now.

from pyasdf.

wjlei1990 avatar wjlei1990 commented on August 26, 2024

You may forget to delete this line.
https://github.com/SeismicData/pyasdf/blob/master/pyasdf/asdf_data_set.py#L1772

Otherwise, it is fixed :)

Thanks!

from pyasdf.

krischer avatar krischer commented on August 26, 2024

Nice catch.

from pyasdf.

krischer avatar krischer commented on August 26, 2024

Alright - should be all fixed. You are no longer allowed to use a datatype that is not valid ASDF. Is will raise a TypeError if you attempt to do it.

from pyasdf.

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.