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

Example of how to manually assign coordinates to run_group #85

Closed
kkappler opened this issue May 9, 2022 · 3 comments
Closed

Example of how to manually assign coordinates to run_group #85

kkappler opened this issue May 9, 2022 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@kkappler
Copy link
Collaborator

kkappler commented May 9, 2022

    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
Copy link
Collaborator Author

kkappler commented May 9, 2022

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 kkappler added the question Further information is requested label May 9, 2022
@kkappler
Copy link
Collaborator Author

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

@kujaku11
Copy link
Owner

kujaku11 commented Jul 7, 2022

@kkappler After you change the metadata, you'll have to run the method write_metadata to be sure that it is written the HDF5, then when you call run_group.station_metadata it will pull the newly written metadata from the station metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants