MTgeophysics / mtpy

Python toolbox for standard Magnetotelluric (MT) data analysis
GNU General Public License v3.0
145 stars 66 forks source link

Bug in conversion of Lat Lon to UTM #117

Closed k-a-mendoza closed 4 years ago

k-a-mendoza commented 4 years ago

Expected Behavior

MT object in mtpy.core.mt should convert the lat lon metadata in the header to UTM automatically upon loading. I have tested this with a basic .edi file with only header info.

basic observation is that a .edi file with lat lon:

 LAT=41:36:28.80
 LONG=-123:24:10.80

results in setting the following UTM attributes:

zone:b'10T' Easting:inf Northing:inf

Test.edi:

>HEAD
 DATAID="TEST"
 FILEBY="z2edi"
 LAT=41:36:28.80
 LONG=-123:24:10.80
 ELEV=1049

code to load:

from mtpy.core.mt import MT
mtpy_obj = MT('Test.edi') 

output code:

def print_metadata_summary():
    print(f'station:\n\t{mt.station}\n'+
          f'geographic coordinates in WGS84:\n\t lat:{mt.lat} \tlon:{mt.lon}\n'+
          f'UTM coordinates:\n\t zone:{mt.utm_zone} \tEasting:{mt.east} \tNorthing:{mt.north}\n'+
          f'rotation angle:\n\t{mt.rotation_angle}\n'+
          f'location on disk:\n\t{mt.fn}')

print_metadata_summary(mtpy_obj)

output

station:
    TEST
geographic coordinates in WGS84:
     lat:41.531     lon:-120.021
UTM coordinates:
     zone:b'10T'    Easting:inf     Northing:inf

Installed Python Packages:

alabaster==0.7.12
argh==0.26.2
astroid==2.3.3
atomicwrites @ file:///home/conda/feedstock_root/build_artifacts/atomicwrites_1588182545583/work
attrs==19.3.0
autopep8==1.4.4
Babel==2.8.0
backcall==0.1.0
bleach @ file:///home/conda/feedstock_root/build_artifacts/bleach_1588608214987/work
bokeh==2.0.1
brotlipy==0.7.0
Cartopy @ file:///home/conda/feedstock_root/build_artifacts/cartopy_1588596947365/work
certifi==2020.4.5.2
cffi==1.14.0
cftime @ file:///home/conda/feedstock_root/build_artifacts/cftime_1589387663609/work
chardet==3.0.4
click==7.1.2
click-plugins==1.1.1
cligj==0.5.0
cloudpickle @ file:///home/conda/feedstock_root/build_artifacts/cloudpickle_1588164361239/work
cmarkgfm==0.4.2
configparser==5.0.0
cryptography==2.9.2
cycler==0.10.0
decorator==4.4.2
defusedxml==0.6.0
diff-match-patch==20181111
docutils==0.16
entrypoints==0.3
Fiona==1.8.13
flake8==3.7.9
future==0.18.2
GDAL==3.0.4
geopandas==0.7.0
idna==2.9
imagesize==1.2.0
importlib-metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1591451751445/work
intervaltree==3.0.2
ipykernel @ file:///home/conda/feedstock_root/build_artifacts/ipykernel_1590020200501/work/dist/ipykernel-5.3.0-py3-none-any.whl
ipython @ file:///home/conda/feedstock_root/build_artifacts/ipython_1590796899444/work
ipython-genutils==0.2.0
ipywidgets==7.5.1
isort==4.3.21
jedi==0.15.2
jeepney==0.4.3
Jinja2==2.11.2
jsonschema==2.6.0
jupyter-client==6.1.3
jupyter-console==6.1.0
jupyter-core==4.6.3
keyring @ file:///home/conda/feedstock_root/build_artifacts/keyring_1588433935863/work
kiwisolver==1.2.0
lazy-object-proxy @ file:///home/conda/feedstock_root/build_artifacts/lazy-object-proxy_1591367726627/work
lxml @ file:///home/conda/feedstock_root/build_artifacts/lxml_1589927514031/work
MarkupSafe==1.1.1
matplotlib==3.2.1
mccabe==0.6.1
mistune==0.8.4
more-itertools @ file:///home/conda/feedstock_root/build_artifacts/more-itertools_1591167413021/work
mtpy==1.1.3
munch==2.5.0
nb-conda==2.2.1
nb-conda-kernels==2.2.3
nbconvert==5.6.1
nbformat==5.0.6
netCDF4 @ file:///home/conda/feedstock_root/build_artifacts/netcdf4_1588329193282/work
notebook @ file:///home/conda/feedstock_root/build_artifacts/notebook_1588887226267/work
numpy @ file:///home/conda/feedstock_root/build_artifacts/numpy_1591485215893/work
numpydoc @ file:///home/conda/feedstock_root/build_artifacts/numpydoc_1590519183599/work
obspy==1.2.1
olefile==0.46
OWSLib @ file:///home/conda/feedstock_root/build_artifacts/owslib_1591376955812/work
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1589925210001/work
pandas @ file:///home/conda/feedstock_root/build_artifacts/pandas_1590752753572/work
pandocfilters==1.4.2
parso==0.5.2
pathtools==0.1.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==7.1.2
pkginfo==1.5.0.1
pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1588616566123/work
prometheus-client @ file:///home/conda/feedstock_root/build_artifacts/prometheus_client_1590412252446/work
prompt-toolkit==3.0.5
psutil==5.7.0
ptyprocess==0.6.0
py==1.8.1
pycodestyle==2.5.0
pycparser==2.20
pydocstyle==5.0.2
pyepsg==0.4.0
pyflakes==2.1.1
Pygments==2.6.1
pylint==2.4.4
pyOpenSSL==19.1.0
pyparsing==2.4.7
pyproj @ file:///home/conda/feedstock_root/build_artifacts/pyproj_1588596070165/work
pyshp==2.1.0
PySocks==1.7.1
pytest==5.4.3
python-dateutil==2.8.1
python-jsonrpc-server @ file:///home/conda/feedstock_root/build_artifacts/python-jsonrpc-server_1588783985962/work
python-language-server==0.31.10
pytz==2020.1
pyxdg==0.26
PyYAML==5.3.1
pyzmq==19.0.1
QDarkStyle==2.8.1
QtAwesome @ file:///home/conda/feedstock_root/build_artifacts/qtawesome_1588715536397/work
qtconsole @ file:///home/conda/feedstock_root/build_artifacts/qtconsole_1589392299544/work
QtPy==1.9.0
readme-renderer==24.0
requests==2.23.0
requests-toolbelt==0.9.1
rope @ file:///home/conda/feedstock_root/build_artifacts/rope_1588950285934/work
Rtree==0.9.4
scipy==1.4.1
SecretStorage==3.1.2
Send2Trash==1.5.0
Shapely==1.7.0
six @ file:///home/conda/feedstock_root/build_artifacts/six_1590081179328/work
snowballstemmer==2.0.0
sortedcontainers @ file:///home/conda/feedstock_root/build_artifacts/sortedcontainers_1591541743024/work
Sphinx @ file:///home/conda/feedstock_root/build_artifacts/sphinx_1591625494144/work
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
spyder @ file:///home/conda/feedstock_root/build_artifacts/spyder_1588993801519/work
spyder-kernels @ file:///home/conda/feedstock_root/build_artifacts/spyder-kernels_1588785827687/work
SQLAlchemy @ file:///home/conda/feedstock_root/build_artifacts/sqlalchemy_1589421717839/work
terminado==0.8.3
testpath==0.4.4
tornado==6.0.4
tqdm @ file:///home/conda/feedstock_root/build_artifacts/tqdm_1591181521996/work
traitlets==4.3.3
twine==3.1.1
typing-extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1588470653596/work
ujson==1.35
urllib3==1.25.9
utm==0.5.0
watchdog==0.10.2
wcwidth @ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1591600393557/work
webencodings==0.5.1
widgetsnbextension==3.5.1
wrapt==1.12.1
wurlitzer==2.0.0
yapf==0.29.0
k-a-mendoza commented 4 years ago

Updating to the dev branch and repeating the exercise has eliminated the error. So I'll go ahead and close the issue.