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

XML -> DATALESS sample rate format glitch? (2.1.0) #63

Open
filefolder opened this issue Oct 18, 2021 · 7 comments
Open

XML -> DATALESS sample rate format glitch? (2.1.0) #63

filefolder opened this issue Oct 18, 2021 · 7 comments

Comments

@filefolder
Copy link

Hi,

Seems to be a bug/mixup between the E00 and E-00 type formatting in samplerate when converting from stationXML to dataless.

I've tested various datacenters and the problem is consistent, even at IRIS e.g. IU.ANMO

$ java -jar stationxml-seed-converter-2.1.0.jar --input anmo.xml --output anmo.dataless java.lang.NumberFormatException: Couldn't format number, value: 20.0 format: 0.0000E-00 pattern: 0.0000E00 actual: 2.0000e01 [10 9 ] at edu.iris.dmc.io.SeedStringBuilder.append(SeedStringBuilder.java:267) at edu.iris.dmc.seed.control.station.B052.toSeedString(B052.java:303) at edu.iris.dmc.seed.AbstractBlockette.getSize(AbstractBlockette.java:72) at edu.iris.dmc.seed.Volume.add(Volume.java:266) at edu.iris.dmc.station.converter.XmlToSeedDocumentConverter.convert(XmlToSeedDocumentConverter.java:112) at edu.iris.dmc.station.converter.XmlToSeedDocumentConverter.convert(XmlToSeedDocumentConverter.java:48) at edu.iris.dmc.station.converter.XmlToSeedFileConverter.convert(XmlToSeedFileConverter.java:426) at edu.iris.dmc.station.converter.XmlToSeedFileConverter.convert(XmlToSeedFileConverter.java:70) at edu.iris.dmc.station.Application.convert(Application.java:189) at edu.iris.dmc.station.Application.run(Application.java:127) at edu.iris.dmc.station.Application.main(Application.java:70) edu.iris.dmc.station.mapper.MetadataConverterException: java.lang.NumberFormatException: Couldn't format number, value: 20.0 format: 0.0000E-00 pattern: 0.0000E00 actual: 2.0000e01 [10 9 ] at edu.iris.dmc.station.converter.XmlToSeedDocumentConverter.convert(XmlToSeedDocumentConverter.java:329) at edu.iris.dmc.station.converter.XmlToSeedDocumentConverter.convert(XmlToSeedDocumentConverter.java:48) at edu.iris.dmc.station.converter.XmlToSeedFileConverter.convert(XmlToSeedFileConverter.java:426) at edu.iris.dmc.station.converter.XmlToSeedFileConverter.convert(XmlToSeedFileConverter.java:70) at edu.iris.dmc.station.Application.convert(Application.java:189) at edu.iris.dmc.station.Application.run(Application.java:127) at edu.iris.dmc.station.Application.main(Application.java:70) Caused by: java.lang.NumberFormatException: Couldn't format number, value: 20.0 format: 0.0000E-00 pattern: 0.0000E00 actual: 2.0000e01 [10 9 ] at edu.iris.dmc.io.SeedStringBuilder.append(SeedStringBuilder.java:267) at edu.iris.dmc.seed.control.station.B052.toSeedString(B052.java:303) at edu.iris.dmc.seed.AbstractBlockette.getSize(AbstractBlockette.java:72) at edu.iris.dmc.seed.Volume.add(Volume.java:266) at edu.iris.dmc.station.converter.XmlToSeedDocumentConverter.convert(XmlToSeedDocumentConverter.java:112) ... 6 more [2021-10-18 20:01:40] [SEVERE] edu.iris.dmc.station.Application run: edu.iris.dmc.station.Application.exitWithError(Application.java:204) edu.iris.dmc.station.Application.convert(Application.java:194) edu.iris.dmc.station.Application.run(Application.java:127) edu.iris.dmc.station.Application.main(Application.java:70)

@timronan
Copy link
Collaborator

@filefolder I cannot reproduce your result with the provided test case. Can you please provide a different test case so your issue can be reproduced and inspected?

@filefolder
Copy link
Author

It's literally every test case I can find at IRIS, AUSPASS, GFZ, etc. I'll attach an example anyway, from GFZ.

ge.toli.bhz.channel.xml.txt

I've also personally tested on OSX with java 17+35-LTS-2724, linux with java 11.0.11+9-Ubuntu-0ubuntu2.20.04, and the user who initially reported this to me was on windows I think.

Note that it works if the inventory is "station" level but fails for either channel or response, which makes sense as there isn't any SR information.

@filefolder
Copy link
Author

How's this going? I take it there still no error on your end? If so could you post a copy of the compiled binary you are using?

Unfortunately it seems like some of the source java (e.g. dmc.io, dmc.seed, dmc.station.model, etc) is missing from github here (?) so I can't really see what's happening or attempt a new compile myself.

@chad-earthscope
Copy link

Here is a test:

curl -sJLO 'https://github.com/iris-edu/stationxml-seed-converter/releases/download/stationxml-seed-converter-2.1.0/stationxml-seed-converter-2.1.0.jar'
curl -so anmo.xml 'https://service.iris.edu/fdsnws/station/1/query?net=IU&sta=ANMO&loc=00&cha=BHZ&level=response&format=xml&includecomments=true&nodata=404'
java -jar stationxml-seed-converter-2.1.0.jar --input anmo.xml --output anmo.dataless

This should complete quietly with a resulting anmo.dataless.

On macOS (12.01), running java version "1.8.0_60": No problems.
On Ubuntu (20.04), running openjdk version "16.0.1" 2021-04-20: No problems.
On CentOS (7.9), running openjdk version "1.8.0_292": No problems.

In each case the environment variable LANG is set to en_US.UTF-8. If I change LANG to be set for say Australia:

$ export LANG=en_AU.UTF-8
$ echo $LANG
en_AU.UTF-8

then

$ java -jar stationxml-seed-converter-2.1.0.jar --input anmo.xml --output anmo.dataless
java.lang.NumberFormatException: Couldn't format number, value: 20.0 format: 0.0000E-00 pattern: 0.0000E00 actual: 2.0000e01 [10  9 ]
	at edu.iris.dmc.io.SeedStringBuilder.append(SeedStringBuilder.java:267)
	at edu.iris.dmc.seed.control.station.B052.toSeedString(B052.java:303)
...

Bang, fireworks. Guessing your locale is different, set using the LANG or LC_* environment variables or some other way. Quick fix is to use the en_US.UTF-8 language setting.

This should probably also be fixed in the converter as the format cannot use any other number formatting, and the formatting cannot be specified by the user.

@chad-earthscope
Copy link

This is also covered in the main README:

System Language Requirements

@filefolder
Copy link
Author

Thanks! Never would have guessed. Possibly also worth specifying that it must be US English in the readme.

I'll leave this post up but feel free to close if you think it's covered in #64 now

@rcasey-earthscope
Copy link
Contributor

rcasey-earthscope commented Nov 4, 2021 via email

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

4 participants