adjtomo / pysep

Seismogram Extraction and Processing: Seismic data retrieval and record sections
https://pysep.readthedocs.io
MIT License
29 stars 15 forks source link

Incorrect sorting of distances in CAP weight file with weights_dist option #144

Closed thurinj closed 6 months ago

thurinj commented 6 months ago

Hi @bch0w ,

Here's a quick unintended behavior I found using the weights_dist option to write the CAP file from pysep:

image

It seems that it is using string-based sorting and it messes up with the ordering when moving from 10~ to 100~ and 100~ to 1000~ (distance is the second column, in km).

bch0w commented 6 months ago

Thanks for catching that @thurinj, I imagine it's coming from here

https://github.com/adjtomo/pysep/blob/master/pysep/utils/cap_sac.py#L100-L102

Might just need a float conversion before sorting. I'll try to get to that asap

bch0w commented 6 months ago

Hopefully I didn't jump the gun by doing the full version release but I think I fixed this in #145, let me know if that looks good on your end!

thurinj commented 6 months ago

Looks all good to me, thanks for the lightning-fast fix ⚡!