Skip to content

Latitude, Longitude and Elevation classes missing in yaml support #4

Description

@WayneCrawford

Hi,

The following line:

cat in.station.xml |\
yasmine-cli --level_station=*.* --field=latitude --value=yml:example_latitude.yaml --dont_validate -o out.station.xml

with the following yaml file:

Latitude:  {
    lower_uncertainty: 0.00018, upper_uncertainty: 0.00018, value: -12.962362}

returns the error:

Traceback (most recent call last):
  File "/opt/anaconda3/envs/obsinfo/bin/yasmine-cli", line 8, in <module>
    sys.exit(main())
  File "/opt/anaconda3/envs/obsinfo/lib/python3.10/site-packages/yasmine_cli/yasmine_cli.py", line 66, in main
    args, scnl_filter = processCmdLine(fname)
  File "/opt/anaconda3/envs/obsinfo/lib/python3.10/site-packages/yasmine_cli/libs/libs_util.py", line 261, in processCmdLine
    value = read_yml_file(ymlfile)
  File "/opt/anaconda3/envs/obsinfo/lib/python3.10/site-packages/yasmine_cli/libs/libs_obs.py", line 220, in read_yml_file
    return eval(func)(obj_key, obj_dict)
  File "/opt/anaconda3/envs/obsinfo/lib/python3.10/site-packages/yasmine_cli/libs/libs_obs.py", line 344, in obspy_simple_type
    return _make_obj(obj_key, obj_dict)
  File "/opt/anaconda3/envs/obsinfo/lib/python3.10/site-packages/yasmine_cli/libs/libs_obs.py", line 364, in _make_obj
    obj = eval(obj_key)(**obj_dict)
  File "<string>", line 1, in <module>
NameError: name 'Latitude' is not defined

(the error message is a bit cryptic also, for neophytes)

The same goes for Longitude and Elevation (and maybe some others, too)

This can fixed by adding Latitude, Longitude , Distance as Elevation to from obspy.core.inventory.util import at the top of libs_obs.py

A secondary problem is that, once these are added, they do not accept "measurement_method" as a field, which I suspect is due to yasmine-cli using an old version of obspy. Below is a latitude yaml file that should work with the latest versions of obspy:

Latitude:  {
    measurement_method: 'Short baseline transponder, near-seafloor release', 
    lower_uncertainty: 0.00018, upper_uncertainty: 0.00018, value: -12.962362}

Regards
Wayne Crawford

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions