Repository: obspy/obspy

Issue:
read_inventory parses station elevations of exactly 0 as "123456.0 m"
**Background Info**

- ObsPy version 1.2.2, installed in a conda environment from the conda-forge channel
- Python 3.8.5
- Windows 10

**Steps to Reproduce**

- Create a SEED file with the station elevation set to exactly 0 (I have an example file but I can't figure out how to attach it, Github doesn't like the extension)
- Run the following code:
```
from obspy import read_inventory
inv = read_inventory("XX.TEST.seed", format="SEED")
station = inv[0][0]
print(station)
```
Results:
```
Station TEST (Test)
        Station Code: TEST
        Channel Count: None/None (Selected/Total)
        2020-12-01T00:00:00.000000Z -
        Access: None
        Latitude: 45.34, Longitude: -75.90, Elevation: 123456.0 m
        Available Channels:
                TEST..HHZ, TEST..HHN, TEST..HHE
```
Notice the elevation is set to 123456.0 m, whereas in the original file (you'll have to trust me on this) it was 0.0

I believe this is caused by this line in `_parse_to_inventory_object` in [obspy.io.xseed.core](https://docs.obspy.org/_modules/obspy/io/xseed/core.html#_parse_to_inventory_object): `elevation=elevation or 123456.0` since exactly 0 maps to false.

For now we are working around this issue by adjusting our elevations to something just off zero (e.g. 0.1).

read_inventory parses station elevations of exactly 0 as "123456.0 m"
**Background Info**

- ObsPy version 1.2.2, installed in a conda environment from the conda-forge channel
- Python 3.8.5
- Windows 10

**Steps to Reproduce**

- Create a SEED file with the station elevation set to exactly 0 (I have an example file but I can't figure out how to attach it, Github doesn't like the extension)
- Run the following code:
```
from obspy import read_inventory
inv = read_inventory("XX.TEST.seed", format="SEED")
station = inv[0][0]
print(station)
```
Results:
```
Station TEST (Test)
        Station Code: TEST
        Channel Count: None/None (Selected/Total)
        2020-12-01T00:00:00.000000Z -
        Access: None
        Latitude: 45.34, Longitude: -75.90, Elevation: 123456.0 m
        Available Channels:
                TEST..HHZ, TEST..HHN, TEST..HHE
```
Notice the elevation is set to 123456.0 m, whereas in the original file (you'll have to trust me on this) it was 0.0

I believe this is caused by this line in `_parse_to_inventory_object` in [obspy.io.xseed.core](https://docs.obspy.org/_modules/obspy/io/xseed/core.html#_parse_to_inventory_object): `elevation=elevation or 123456.0` since exactly 0 maps to false.

For now we are working around this issue by adjusting our elevations to something just off zero (e.g. 0.1).



Discussion:
Arg, yet another 0 being identified as False :((
Arg, yet another 0 being identified as False :((

Resolving patch:
diff --git a/obspy/io/xseed/core.py b/obspy/io/xseed/core.py
--- a/obspy/io/xseed/core.py
+++ b/obspy/io/xseed/core.py
@@ -234,6 +234,10 @@ def last_or_none(x):
         elevation = last_or_none("elevation")
         site_name = last_or_none("site_name")
 
+        # handle None in mandatory elevation field with obvious bogus value
+        if elevation is None:
+            elevation = 123456.0
+
         # Take the first start-date and the last end-date.
         start_effective_date = station_info["start_effective_date"][0] \
             if "start_effective_date" in station_info else None
@@ -258,9 +262,10 @@ def last_or_none(x):
         s = obspy.core.inventory.Station(
             code=station_call_letters,
             # Set to bogus values if not set.
+            # elevation bogus is handled above
             latitude=latitude or 0.0,
             longitude=longitude or 0.0,
-            elevation=elevation or 123456.0,
+            elevation=elevation,
             channels=None,
 
             site=obspy.core.inventory.Site(name=site_name),


Test patch: