MTgeophysics / mtpy

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

bug in mt.plot_mt_response #28

Closed alkirkby closed 6 years ago

alkirkby commented 6 years ago

Error with plot_mt_response

Expected Behavior

plot apparent resistivity and phase vs period

Current Behavior

get error: Traceback (most recent call last): File "", line 1, in File "C:\Users\u64125\AppData\Local\Continuum\Miniconda2\envs\mtpy27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile execfile(filename, namespace) File "C:\Users\u64125\AppData\Local\Continuum\Miniconda2\envs\mtpy27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc) File "U:/Software/mtpy/plot_mt_response.py", line 12, in mto.plot_mt_response() File "C:\Git\mtpy\mtpy\core\mt.py", line 1878, in plot_mt_response **kwargs) File "C:\Git\mtpy\mtpy\imaging\plot_mt_response.py", line 439, in init self._logger.warn("Argument {}={} is not supported thus not been set.".format(key, kwargs[key])) UnboundLocalError: local variable 'key' referenced before assignment

Steps to Reproduce (for bugs)

from mtpy.core.mt import MT

mto = MT(r'C:\Git\mtpy\data\LMT\test_LEMI.edi')
mto.plot_mt_response()

Context

Your Environment

Installed Python Packages: use pip freeze or conda list [-n ENVIRONMENT_NAME] to list all the installed libraries.

alabaster==0.7.10 asn1crypto==0.22.0 astroid==1.5.3 Babel==2.4.0 backports-abc==0.5 backports.functools-lru-cache==1.4 backports.shutil-get-terminal-size==1.0.0 backports.ssl-match-hostname==3.5.0.1 basemap==1.1.0 bleach==2.0.0 certifi==2017.7.27.1 cffi==1.10.0 chardet==3.0.4 click==6.7 click-plugins==1.0.3 cligj==0.4.0 colorama==0.3.9 configparser==3.5.0 cryptography==2.0.3 cycler==0.10.0 decorator==4.1.2 descartes==1.1.0 docutils==0.14 entrypoints==0.2.3 enum34==1.1.6 Fiona==1.7.9 funcsigs==1.0.2 functools32==3.2.3.post2 future==0.16.0 GDAL==2.1.3 geopandas==0.3.0 html5lib==0.999999999 idna==2.5 imagesize==0.7.1 ipaddress==1.0.18 ipykernel==4.6.1 ipython==5.4.1 ipython-genutils==0.2.0 ipywidgets==7.0.5 isort==4.2.15 jedi==0.10.2 Jinja2==2.9.6 jsonschema==2.5.1 jupyter-client==5.1.0 jupyter-console==5.2.0 jupyter-core==4.3.0 lazy-object-proxy==1.3.1 lxml==3.8.0 MarkupSafe==1.0 matplotlib==2.0.0 mccabe==0.6.1 mistune==0.7.4 mock==2.0.0 -e git+git@github.com:MTgeophysics/mtpy.git@82ab4e9123fa6c0f875b0d2eb3f2fb0849c27560#egg=mtpy munch==2.2.0 nbconvert==5.2.1 nbformat==4.3.0 netCDF4==1.3.1 notebook==5.2.2 numpy==1.12.1 numpydoc==0.7.0 obspy==1.1.0 olefile==0.44 pandas==0.20.3 pandocfilters==1.4.1 pathlib2==2.3.0 pbr==3.1.1 pep8==1.7.0 pickleshare==0.7.4 Pillow==4.3.0 prompt-toolkit==1.0.15 psutil==5.2.2 psycopg2==2.7.3 pycodestyle==2.3.1 pycparser==2.18 pyflakes==1.6.0 Pygments==2.2.0 pylint==1.7.1 pyOpenSSL==17.2.0 pyparsing==2.2.0 pyproj==1.9.5.1 PySAL==1.13.0 pyshp==1.2.12 PySocks==1.6.7 python-dateutil==2.6.1 pytz==2017.2 PyYAML==3.12 pyzmq==16.0.2 QtAwesome==0.4.4 qtconsole==4.3.1 QtPy==1.3.1 requests==2.18.4 -e git+git@github.com:GeoscienceAustralia/resistor_network.git@c4ec068698a8df5309a91fc2707397b66680f4d6#egg=rnpy rope==0.10.7 Rtree==0.8.3 scandir==1.5 scipy==0.19.1 Shapely==1.6.3 simplegeneric==0.8.1 singledispatch==3.4.0.3 six==1.10.0 snowballstemmer==1.2.1 Sphinx==1.6.3 sphinxcontrib-websupport==1.0.1 spyder==2.3.9 SQLAlchemy==1.1.13 testpath==0.3.1 tornado==4.5.2 traitlets==4.3.2 typing==3.6.2 urllib3==1.22 wcwidth==0.1.7 webencodings==0.5 widgetsnbextension==3.0.8 win-inet-pton==1.0.1 win-unicode-console==0.5 wincertstore==0.2 wrapt==1.10.11

zhang01GA commented 6 years ago

It looks like a minor bug. I have asked Sudhir to look into it.

sudhirJain commented 6 years ago

The above bug has been fixed;

image

alkirkby commented 6 years ago

I get a plot now looking like the image below, with the following error:

runfile('U:/Software/mtpy/plot_mt_response.py', wdir='U:/Software/mtpy') Traceback (most recent call last): File "", line 1, in File "C:\Users\u64125\AppData\Local\Continuum\Miniconda2\envs\mtpy27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile execfile(filename, namespace) File "C:\Users\u64125\AppData\Local\Continuum\Miniconda2\envs\mtpy27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc) File "U:/Software/mtpy/plot_mt_response.py", line 11, in mto.plot_mt_response() File "C:\Git\mtpy\mtpy\core\mt.py", line 1878, in plot_mt_response **kwargs) File "C:\Git\mtpy\mtpy\imaging\plot_mt_response.py", line 444, in init self.plot() File "C:\Git\mtpy\mtpy\imaging\plot_mt_response.py", line 821, in plot tmin = min([np.nanmin(tyr), np.nanmin(tyi.min)]) File "C:\Users\u64125\AppData\Local\Continuum\Miniconda2\envs\mtpy27\lib\site-packages\numpy\lib\nanfunctions.py", line 238, in nanmin if np.isnan(res).any(): TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

issue28

alkirkby commented 6 years ago

now fixed