iris-edu / stationxml-seed-converter

Station XML/Seed converter
GNU General Public License v3.0
16 stars 12 forks source link

Channel Epoch not converting from xml to seed correctly - various issues #9

Closed ghost closed 6 years ago

ghost commented 6 years ago

Reproduction

Download ANMO 10 LH1 xml from IRIS fdsnws https://service.iris.edu/fdsnws/station/1/query?net=IU&sta=ANMO&loc=10&cha=LH1&starttime=1998-08-01T00:00:00&endtime=2001-08-01T00:00:00&level=channel&format=xml&includecomments=true&nodata=404

Review end dates for epochs - I picked just one epoch as an example all are behaving this way.

<Channel code="LH1" endDate="1999-02-08T00:00:00" locationCode="10" restrictedStatus="open" startDate="1999-01-13T00:00:00">
    <DataAvailability>
        <Extent start="1998-10-26T20:44:37" end="2018-08-08T00:00:00"/>
    </DataAvailability>
    <Latitude>34.9459</Latitude>
    <Longitude>-106.457199</Longitude>
    <Elevation>1760.7</Elevation>
    <Depth>89.3</Depth>
    <Azimuth>135</Azimuth>
    <Dip>0</Dip>
    <Type>CONTINUOUS</Type>
    <Type>GEOPHYSICAL</Type>
    <SampleRate>1E00</SampleRate>
    <ClockDrift>0E00</ClockDrift>
    <Sensor>
        <Description>Guralp CMG3-T Seismometer (borehole)</Description>
    </Sensor>
    <Response>
        <InstrumentSensitivity>
            <Value>3.3481E10</Value>
            <Frequency>2E-2</Frequency>
            <InputUnits>
                <Name>M/S</Name>
                <Description>Velocity in Meters Per Second</Description>
            </InputUnits>
            <OutputUnits>
                <Name>COUNTS</Name>
                <Description>Digital Counts</Description>
            </OutputUnits>
        </InstrumentSensitivity>
    </Response>
</Channel>

Convert to seed using java -jar target/stationxml-converter-1.0.11-SNAPSHOT-jar-with-dependencies.jar --seed -o lh1.seed fdsnws-station_2018-08-08T20_28_50Z.xml

View seed file files using rdseed - I have emboldened incorrect values

B052F04 Channel: LH1 B052F03 Location: 10 B052F05 Subchannel: 0 B052F06 Instrument lookup: 2 Guralp CMG3-T Seismometer (borehole) B052F07 Comment: (null) B052F08 Signal units lookup: 1 M/S - Velocity in Meters Per Second B052F09 Calibration units lookup: 2 UNKNOWN - (null) B052F10 Latitude: 34.945900 B052F11 Longitude: -106.457199 B052F12 Elevation: 1760.700000 B052F13 Local depth: 89.300000 B052F14 Azimuth: 0.000000 B052F15 Dip: 1.000000 B052F16 Format lookup: 1 !!! ERROR - Format Code Not Found !!! [The output seed is missing blockette 30] B052F17 Log2 of Data record length: 0 B052F18 Sample rate: 0 B052F19 Clock tolerance: 0 B052F21 Channel flags: ZZZZZZZZZZZZZZZZZ B052F22 Start date: 1999,013,00:00:00.0000 B052F23 End date: 2018,220,20:30:15.0000 [This date corresponds to the datetime that stationxml-converter performed the conversion.] B052F24 Update flag:

yazan-iris commented 6 years ago

Empty azimuth caused the parser to miss identify fields leading to time parsing error. I have added the logic needed to deal with it.