MTgeophysics / mtpy

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

Many warnings on implementing RMS maps using ModEM #161

Open wilsonweijun opened 2 years ago

wilsonweijun commented 2 years ago

There are many RuntimeWarnings and UserWarnings on implementing RMS maps in ModEM module.

Expected Behavior

they will stop to appear.

Current Behavior

WARNING:mtpy.utils.mtpy_decorator:GDAL_DATA environment variable is not set Please see https://trac.osgeo.org/gdal/wiki/FAQInstallationAndBuilding#HowtosetGDAL_DATAvariable C:\Users\lenovo.conda\envs\wilson37\lib_collections_abc.py:720: MatplotlibDeprecationWarning: The global colormaps dictionary is no longer considered public API. yield from self._mapping D:\mtpywin\mtpy\mtpy\imaging\mtcolors.py:252: MatplotlibDeprecationWarning: The global colormaps dictionary is no longer considered public API. cmapdict.update(cm.cmap_d) If you want to write a vtk file for 3d viewing, you need download and install evtk from https://bitbucket.org/pauloh/pyevtk INFO:Data:Set rotation angle to 0.0 deg clockwise from N Ignore GDAL as it is not working. Will use pyproj If you want to write a vtk file for 3d viewing, you need download and install evtk from https://bitbucket.org/pauloh/pyevtk Note: if you are using Windows you should build evtk first witheither MinGW or cygwin using the command: python setup.py build -compiler=mingw32 or python setup.py build -compiler=cygwin If you want to write a vtk file for 3d viewing, you need to install pyevtk Note: if you are using Windows you should build evtk first witheither MinGW or cygwin using the command: python setup.py build -compiler=mingw32 or python setup.py build -compiler=cygwin If you want to write a vtk file for 3d viewing, you need download and install evtk from https://bitbucket.org/pauloh/pyevtk If you want to write a vtk file for 3d viewing, you need to pip install PyEVTK: https://bitbucket.org/pauloh/pyevtk Note: if you are using Windows you should build evtk first witheither MinGW or cygwin using the command: python setup.py build -compiler=mingw32 or python setup.py build -compiler=cygwin Did not find center elevation in data file [-20.519] [ 131.99] Did not find center elevation in data file [-20.519] [ 131.99] D:\mtpywin\mtpy\mtpy\utils\calculator.py:371: RuntimeWarning: invalid value encountered in double_scalars z_rel_err = error/z_amp D:\mtpywin\mtpy\mtpy\modeling\modem\residual.py:257: RuntimeWarning: invalid value encountered in true_divide z_norm = np.abs(res_vals['z']) / (np.real(res_vals['z_err']) * 2. 0.5) D:\mtpywin\mtpy\mtpy\modeling\modem\residual.py:280: RuntimeWarning: invalid value encountered in true_divide tip_norm = np.abs(res_vals['tip']) / (np.real(res_vals['tip_err']) * 2. 0.5) D:\mtpywin\mtpy\mtpy\modeling\modem\residual.py:288: RuntimeWarning: invalid value encountered in true_divide self.rms_array['rms_tip_period'][sta_ind] = (np.nansum(tip_norm.reshape(tip_norm.shape[0],2)2,axis=1)/count_tip)0.5 D:\mtpywin\mtpy\mtpy\modeling\modem\residual.py:305: RuntimeWarning: invalid value encountered in true_divide self.rms_array['rms_period'][sta_ind] = (np.nansum(rms_value_list_ztip2,axis=1)/count_ztip)*0.5 D:\mtpywin\mtpy\mtpy\modeling\modem\residual.py:327: RuntimeWarning: invalid value encountered in true_divide (np.real(self.residual_array[cpt+'_err']) 2.0.5) D:\mtpywin\mtpy\mtpy\modeling\modem\residual.py:333: RuntimeWarning: invalid value encountered in true_divide np.nansum(np.isfinite(res_vals_cpt[:,:,i,j]),axis=1))0.5 D:\mtpywin\mtpy\mtpy\modeling\modem\plot_rms_maps.py:405: MatplotlibDeprecationWarning: Passing non-integers as three-element position specification is deprecated since 3.3 and will be removed two minor releases later. aspect='equal') D:\mtpywin\mtpy\mtpy\modeling\modem\residual.py:257: RuntimeWarning: invalid value encountered in true_divide z_norm = np.abs(res_vals['z']) / (np.real(res_vals['z_err']) * 2. * 0.5) D:\mtpywin\mtpy\mtpy\modeling\modem\residual.py:280: RuntimeWarning: invalid value encountered in true_divide tip_norm = np.abs(res_vals['tip']) / (np.real(res_vals['tip_err']) 2. 0.5) D:\mtpywin\mtpy\mtpy\modeling\modem\residual.py:288: RuntimeWarning: invalid value encountered in true_divide self.rms_array['rms_tip_period'][sta_ind] = (np.nansum(tip_norm.reshape(tip_norm.shape[0],2)2,axis=1)/count_tip)0.5 D:\mtpywin\mtpy\mtpy\modeling\modem\residual.py:305: RuntimeWarning: invalid value encountered in true_divide self.rms_array['rms_period'][sta_ind] = (np.nansum(rms_value_list_ztip2,axis=1)/count_ztip)0.5 D:\mtpywin\mtpy\mtpy\modeling\modem\residual.py:327: RuntimeWarning: invalid value encountered in true_divide (np.real(self.residual_array[cpt+'_err']) * 2.0.5) D:\mtpywin\mtpy\mtpy\modeling\modem\residual.py:333: RuntimeWarning: invalid value encountered in true_divide np.nansum(np.isfinite(res_vals_cpt[:,:,i,j]),axis=1))0.5 D:\mtpywin\mtpy\mtpy\modeling\modem\plot_rms_maps.py:405: MatplotlibDeprecationWarning: Passing non-integers as three-element position specification is deprecated since 3.3 and will be removed two minor releases later. aspect='equal') D:\mtpywin\mtpy\mtpy\modeling\modem\plot_rms_maps.py:475: UserWarning: Matplotlib is currently using module://ipykernel.pylab.backend_inline, which is a non-GUI backend, so cannot show the figure. self.fig.show() saved file to D:/mtpywin/tmp\RMS_AllPeriods.png

Possible Solution

Steps to Reproduce (for bugs)

1. 2. 3. 4.


# Paste your code here
#
import os
import numpy as ny
from mtpy.modeling.modem import PlotRMSMaps
wd='D:/mtpywin/mtpy/examples/model_files/ModEM_2'
savepath='D:/mtpywin/tmp'
resid_fn=os.path.join(wd,'Modular_MPI_NLCG_004.res')
probj=PlotRMSMaps(resid_fn,
                  rms_min=1,
                  rms_max=10,
                  period_index='all'
                  )
probj.save_figure(save_path=savepath,
                  fig_close=False,  # whether or not to close figure
                  save_fig_dpi=350
                  )

## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->

## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
  * Operating system: window 10 
  * MtPy version: V1.0 downloaded in 2020
  * Python version: 3.7.10
<!---if it is data visualization related, also provide-->
  * Matplotlib version:
  * Matplotlib backend (`print(matplotlib.get_backend())`):
<!---if it is graphical user interface (GUI) related-->
  * QT version:

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