MTgeophysics / mtpy-v2

Tools to work with magnetotelluric transfer functions, based on MTH5 and mt-metadata. This is an update to mtpy.
https://mtpy-v2.readthedocs.io/en/latest/index.html
MIT License
22 stars 7 forks source link

add_tf does not read elevation from EDIs #19

Closed pankajkmishra closed 3 months ago

pankajkmishra commented 4 months ago

I am trying to add edis from my project (in Finland) to MTCollection

from pathlib import Path
from mtpy import MTCollection
tf_path=Path(r"../path_to_my_edis")
tf_path.exists()
with MTCollection() as mc:
    mc.open_collection(tf_path.joinpath("MyProject_tf.h5"))
    mc.add_tf(mc.make_file_list(tf_path)) 

Error

24:02:20T18:09:26 | ERROR | line:203 |mt_metadata.transfer_functions.io.tools | get_nm_elev | Input values (latitude=63.74171066666667, longitude=26.25233077777778) could not be found on US National Map.

Is there a way to read elevation from EDIs or perhaps define them in an external file?

kujaku11 commented 4 months ago

@pankajkmishra I'm assuming you installed from pip or conda? This was fixed in a recent patch and hasn't been released yet. I will do that tomorrow. Or you can reinstall from git.

In the meantime you could do something like (I think, this might be in the newer version too):

from pathlib import Path
from mtpy import MTCollection, MT
tf_path=Path(r"../path_to_my_edis")
tf_path.exists()
with MTCollection() as mc:
    mc.open_collection(tf_path.joinpath("MyProject_tf.h5"))
    for fn in tf_path.glob("*.edi"):
        mt_object  = MT()
        mt_object.read(get_elevation=False)
        mc.add_tf(mt_object)
kujaku11 commented 4 months ago

@pankajkmishra Just update the release, try reinstalling from pypi and see if you get the same error.

pankajkmishra commented 3 months ago

Updating mtpy worked! Thanks