Example of how to manually assign coordinates to run_group
Closed this issue · 3 comments
kkappler commented
from mth5.mth5 import MTH5
from mt_metadata.timeseries.location import Location
m = MTH5(file_version="0.1.0")
m.open_mth5("test.h5", mode="w")
station_group = m.add_station("test1")
location = Location()
location.latitude = 17.996
station_group.metadata.location = location
run_group = station_group.add_run('001')
run_group.station_group.metadata.location = location
Setting latitude in the location object has the expected result:
In[12]: location
Out[12]:
{
"location": {
"declination.model": "WMM",
"declination.value": 0.0,
"elevation": 0.0,
"latitude": 17.996,
"longitude": 0.0
}
}
And the information does propagate to the station_group
In[16]: station_group.metadata.location
Out[16]:
{
"location": {
"declination.model": "WMM",
"declination.value": 0.0,
"elevation": 0.0,
"latitude": 17.996,
"longitude": 0.0
}
}
But it does not propagate to the run_group
In[20]: run_group.station_group.metadata.location
Out[20]:
{
"location": {
"declination.model": "WMM",
"declination.value": 0.0,
"elevation": 0.0,
"latitude": 0.0,
"longitude": 0.0
}
}
@kujaku11 Is this expected behaviour? Or should the run_group inherit the location info from it's station group?
kkappler commented
Once this is sorted out, the comments and reference to this issue can be deleted from
aurora/aurora/test_utils/synthetic/make_mth5_from_asc.py
kkappler commented
I wound up factoring this mini test out, it is now in its own file in aurora
aurora/sandbox/debug_mt_metadata_issue_85.py
Currently it is on the aurora fix_issue_80
branch