Modify

Ticket #169 (new task)

Opened 17 months ago

Last modified 16 months ago

GSE2: apply CALIB during read()

Reported by: megies Owned by:
Priority: major Component: ObsPy library
Keywords: Cc:

Description

Currently CALIB is not applied when reading GSE2 files.
I talked with Jo and he thinks it should be applied during read() by default (with the possibility to switch this off via a keyword argument).

Attachments

test_conversion.c Download (2.5 KB) - added by krischer 16 months ago.
Conversion test script

Change History

comment:1 Changed 17 months ago by megies

suggestion:

  • use a keyword argument apply_CALIB to do this during read() (i.e. in the internally called readGSE2())
  • default maybe should be True but rather extreme change so:
    • default False
    • show DeprecationWarning
    • change default to True in next tagged Version


opinions?

comment:2 Changed 17 months ago by beyreuth

I think it is a good idea to have a keyword argument. I see the following pitfalls:

  • GSE2 stores the data as int32, multiplying by calib calper will transfer them to float, writing them to other int32 formats can result in changed data, which I think is good to circumvent. It has also a computation cost overhead.
  • to stay consistent, we would need to do this for all formats, especially when we would set the option default to true
  • it will get even more confusing to use the attach_paz fct in libgse2, you need to control of the calib calper was applied before
  • what happens if someone did not apply the pi factor for calib (e.g. old baynets) => the data get corrupted

Therefore, I understand the reasons why to apply it on read, however, I suggest the default to false permanently.

comment:3 Changed 17 months ago by beyreuth

Another problem by doing the calib calper correction is that ObsPy starts to do magic:

  • for GSE2 the calib is corrected
  • for MiniSEED not, as it does not store the calib factor

That is the user need to know the format details to know if there are actually volt or count. I really think that the default should be False and stay False in the future.

comment:4 Changed 16 months ago by barsch

-1 for "default=True"

IMHO to much magic - we shouldn't change the original data format!

--- a bit off: keywords should always be lower case and seperated with underscore - so please call the option apply_calibration or something similar

comment:5 Changed 16 months ago by krischer

I also vote for setting the default value to false. I think that so far in all similar cases we chose to not modify the original data and leave that job to the user in case it is necessary.

Also a simple

read GSE2 -> trim -> write GSE2

would be nearly impossible without modifying the data slightly if the calibration factor is applied.

comment:6 Changed 16 months ago by krischer

I wrote a small script to figure out whether or not applying a single precission floating point calibration factor might irreversibly change any integer values, e.g. if

some_integer = (some_integer * some_float) / some_float

I let it run for about 40E9 combinations and not a single one failed if the result is rounded before it is transformed back to integer data. Without rounding about 0.5 % of the data values changed by 1.

Changed 16 months ago by krischer

Conversion test script

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from (none). Next status will be 'new'
The owner will be changed from (none) to anonymous. Next status will be 'assigned'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.