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

Exporting shapefiles of PT & IV #22

Open pankajkmishra opened 3 months ago

pankajkmishra commented 3 months ago

Trying to create PT & IV shapefiles from EDI directory

import os
from mtpy.utils.shapefiles import create_phase_tensor_shpfiles, create_tipper_shpfiles

edi_dir = "EDI"
save_dir_edi = "SHAPE"
if not os.path.exists(save_dir_edi):
    os.makedirs(save_dir_edi)
create_phase_tensor_shpfiles(edi_dir, save_dir_edi, proj="WGS84", ellipse_size=1000)
create_tipper_shpfiles(edi_dir, save_dir_edi)

Gives the following error


ImportError Traceback (most recent call last) Cell In[12], line 2 1 import os ----> 2 from mtpy.utils.shapefiles import create_phase_tensor_shpfiles, create_tipper_shpfiles 4 # Define the path to your directory containing EDI files 5 edi_dir = "EDI"

File c:\Users\pmishra\Anaconda3\envs\mtpy\lib\site-packages\mtpy\utils\shapefiles.py:11 2 """ 3 Create shape files for phase tensor ellipses. 4 https://pcjericks.github.io/py-gdalogr-cookbook/vector_layers.html#create-a-new-shapefile-and-add-data (...) 8 @author: jrpeacock 9 """ 10 import mtpy.modeling.modem ---> 11 from mtpy.utils.gis_tools import project_point_ll2utm, get_utm_zone 13 try: 14 from osgeo import ogr, gdal, osr

ImportError: cannot import name 'get_utm_zone' from 'mtpy.utils.gis_tools' (c:\Users\pmishra\Anaconda3\envs\mtpy\lib\site-packages\mtpy\utils\gis_tools.py)

kujaku11 commented 2 months ago

@pankajkmishra Thanks for the issue, support for making shapefiles has yet been translated over to v2. Hopefully in the next few weeks. Suggest using the original version for now.