MTgeophysics / mtpy

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

V2: plotting strike with no tipper #175

Open kujaku11 opened 1 year ago

kujaku11 commented 1 year ago

If tipper is empty, when using plot_strike get an error:

File ~\.conda\envs\em\lib\site-packages\mtpy-2.0.0-py3.10.egg\mtpy\imaging\plot_strike.py:905, in PlotStrike.plot(self, show)
    900 """
    901 plot Strike angles as rose plots
    902 
    903 """
    904 if self.strike_df is None:
--> 905     self.make_strike_df()
    907 # -----Plot Histograms of the strike angles-----------------------------
    908 
    909 # ------------------plot indivdual decades------------------------------
    910 if self.plot_type == 1:

File ~\.conda\envs\em\lib\site-packages\mtpy-2.0.0-py3.10.egg\mtpy\imaging\plot_strike.py:266, in PlotStrike.make_strike_df(self)
    264 else:
    265     if tip is None:
--> 266         tip = Tipper(
    267             np.zeros((len(mt.period), 1, 2), dtype="complex"),
    268             frequency=[1],
    269         )
    270         tip.compute_mag_direction()
    271         tip.compute_amp_phase()

File ~\.conda\envs\em\lib\site-packages\mtpy-2.0.0-py3.10.egg\mtpy\core\tipper.py:89, in Tipper.__init__(self, tipper_array, tipper_err_array, frequency, tipper_model_err_array)
     87 self.tipper = tipper_array
     88 self.tipper_err = tipper_err_array
---> 89 self.frequency = frequency
     90 self.tipper_model_err = tipper_model_err_array
     92 self._amplitude = None

File ~\.conda\envs\em\lib\site-packages\mtpy-2.0.0-py3.10.egg\mtpy\core\tipper.py:202, in Tipper.frequency(self, frequency_arr)
    197         msg = (
    198             "New frequency array is not correct shape for existing z"
    199             + "new: {self._frequency.size} != old: {self.tipper.shape[0]}"
    200         )
    201         self.logger.error(msg)
--> 202         raise MTpyError_Tipper
    203 # for consistency recalculate amplitude and phase
    204 self.compute_amp_phase()

MTpyError_Tipper: