@@ -189,11 +189,11 @@ def meca(
189
189
Depth(s) of event location in kilometers. Must be the same length as
190
190
the number of events. Will override the ``depth`` values in ``spec``
191
191
if ``spec`` is a dict or pd.DataFrame.
192
- plot_longitude: int, float, list, or 1d numpy array
192
+ plot_longitude: int, float, str, list, or 1d numpy array
193
193
Longitude(s) at which to place beachball. Must be the same length as
194
194
the number of events. Will override the ``plot_longitude`` values in
195
195
``spec`` if ``spec`` is a dict or pd.DataFrame.
196
- plot_latitude: int, float, list, or 1d numpy array
196
+ plot_latitude: int, float, str, list, or 1d numpy array
197
197
Latitude(s) at which to place beachball. List must be the same length
198
198
as the number of events. Will override the ``plot_latitude`` values in
199
199
``spec`` if ``spec`` is a dict or pd.DataFrame.
@@ -272,10 +272,10 @@ def meca(
272
272
spec ["latitude" ] = np .atleast_1d (latitude )
273
273
if depth is not None :
274
274
spec ["depth" ] = np .atleast_1d (depth )
275
- if plot_longitude is not None : # must be in string type
276
- spec ["plot_longitude" ] = np .atleast_1d (plot_longitude ). astype ( str )
277
- if plot_latitude is not None : # must be in string type
278
- spec ["plot_latitude" ] = np .atleast_1d (plot_latitude ). astype ( str )
275
+ if plot_longitude is not None :
276
+ spec ["plot_longitude" ] = np .atleast_1d (plot_longitude )
277
+ if plot_latitude is not None :
278
+ spec ["plot_latitude" ] = np .atleast_1d (plot_latitude )
279
279
if event_name is not None :
280
280
spec ["event_name" ] = np .atleast_1d (event_name ).astype (str )
281
281
@@ -293,9 +293,13 @@ def meca(
293
293
newcols = ["longitude" , "latitude" , "depth" ] + param_conventions [convention ]
294
294
if "plot_longitude" in spec .columns and "plot_latitude" in spec .columns :
295
295
newcols += ["plot_longitude" , "plot_latitude" ]
296
+ spec [["plot_longitude" , "plot_latitude" ]] = spec [
297
+ ["plot_longitude" , "plot_latitude" ]
298
+ ].astype (str )
296
299
kwargs ["A" ] = True
297
300
if "event_name" in spec .columns :
298
301
newcols += ["event_name" ]
302
+ spec ["event_name" ] = spec ["event_name" ].astype (str )
299
303
# reorder columns in DataFrame
300
304
spec = spec .reindex (newcols , axis = 1 )
301
305
elif isinstance (spec , np .ndarray ) and spec .ndim == 1 :
0 commit comments