@@ -61,9 +61,7 @@ class MTData(OrderedDict, MTStations):
61
61
62
62
def __init__ (self , mt_list = None , ** kwargs ):
63
63
64
- self ._coordinate_reference_frame_options = (
65
- COORDINATE_REFERENCE_FRAME_OPTIONS
66
- )
64
+ self ._coordinate_reference_frame_options = COORDINATE_REFERENCE_FRAME_OPTIONS
67
65
68
66
self .z_model_error = ModelErrors (
69
67
error_value = 5 ,
@@ -150,9 +148,7 @@ def __eq__(self, other):
150
148
value_other = getattr (other , attr )
151
149
152
150
if value_og != value_other :
153
- self .logger .info (
154
- f"Attribute { attr } : { value_og } != { value_other } "
155
- )
151
+ self .logger .info (f"Attribute { attr } : { value_og } != { value_other } " )
156
152
return False
157
153
fail = False
158
154
if len (self ) == len (other ):
@@ -279,9 +275,7 @@ def impedance_units(self, value):
279
275
if not isinstance (value , str ):
280
276
raise TypeError ("Units input must be a string." )
281
277
if value .lower () not in self ._impedance_unit_factors .keys ():
282
- raise ValueError (
283
- f"{ value } is not an acceptable unit for impedance."
284
- )
278
+ raise ValueError (f"{ value } is not an acceptable unit for impedance." )
285
279
286
280
self ._impedance_units = value
287
281
@@ -325,9 +319,7 @@ def get_survey(self, survey_id):
325
319
:rtype: :class:`mtpy.MTData`
326
320
"""
327
321
328
- survey_list = [
329
- mt_obj for key , mt_obj in self .items () if survey_id in key
330
- ]
322
+ survey_list = [mt_obj for key , mt_obj in self .items () if survey_id in key ]
331
323
md = self .clone_empty ()
332
324
md .add_station (survey_list )
333
325
return md
@@ -477,9 +469,7 @@ def get_station(self, station_id=None, survey_id=None, station_key=None):
477
469
if station_key is not None :
478
470
station_key = station_key
479
471
else :
480
- station_key = self ._get_station_key (
481
- station_id , validate_name (survey_id )
482
- )
472
+ station_key = self ._get_station_key (station_id , validate_name (survey_id ))
483
473
484
474
try :
485
475
return self [station_key ]
@@ -634,9 +624,7 @@ def to_geo_df(self, model_locations=False, data_type="station_locations"):
634
624
elif data_type in ["both" , "shapefiles" ]:
635
625
df = self .to_mt_dataframe ().for_shapefiles
636
626
else :
637
- raise ValueError (
638
- f"Option for 'data_type' { data_type } is unsupported."
639
- )
627
+ raise ValueError (f"Option for 'data_type' { data_type } is unsupported." )
640
628
if model_locations :
641
629
gdf = gpd .GeoDataFrame (
642
630
df ,
@@ -853,8 +841,7 @@ def get_nearby_stations(self, station_key, radius, radius_units="m"):
853
841
"Cannot estimate distances in meters without a UTM CRS. Set 'utm_crs' first."
854
842
)
855
843
sdf ["radius" ] = np .sqrt (
856
- (local_station .east - sdf .east ) ** 2
857
- + (local_station .north - sdf .north )
844
+ (local_station .east - sdf .east ) ** 2 + (local_station .north - sdf .north )
858
845
)
859
846
elif radius_units in ["deg" , "degrees" ]:
860
847
sdf ["radius" ] = np .sqrt (
@@ -864,9 +851,7 @@ def get_nearby_stations(self, station_key, radius, radius_units="m"):
864
851
865
852
return [
866
853
f"{ row .survey } .{ row .station } "
867
- for row in sdf .loc [
868
- (sdf .radius <= radius ) & (sdf .radius > 0 )
869
- ].itertuples ()
854
+ for row in sdf .loc [(sdf .radius <= radius ) & (sdf .radius > 0 )].itertuples ()
870
855
]
871
856
872
857
def estimate_spatial_static_shift (
@@ -910,8 +895,7 @@ def estimate_spatial_static_shift(
910
895
911
896
interp_periods = local_site .period [
912
897
np .where (
913
- (local_site .period >= period_min )
914
- & (local_site .period <= period_max )
898
+ (local_site .period >= period_min ) & (local_site .period <= period_max )
915
899
)
916
900
]
917
901
@@ -956,9 +940,7 @@ def estimate_starting_rho(self):
956
940
fig = plt .figure ()
957
941
958
942
ax = fig .add_subplot (1 , 1 , 1 )
959
- (l1 ,) = ax .loglog (
960
- mean_rho .index , mean_rho .res_det , lw = 2 , color = (0.75 , 0.25 , 0 )
961
- )
943
+ (l1 ,) = ax .loglog (mean_rho .index , mean_rho .res_det , lw = 2 , color = (0.75 , 0.25 , 0 ))
962
944
(l2 ,) = ax .loglog (
963
945
median_rho .index , median_rho .res_det , lw = 2 , color = (0 , 0.25 , 0.75 )
964
946
)
@@ -979,9 +961,7 @@ def estimate_starting_rho(self):
979
961
)
980
962
981
963
ax .set_xlabel ("Period (s)" , fontdict = {"size" : 12 , "weight" : "bold" })
982
- ax .set_ylabel (
983
- "Resistivity (Ohm-m)" , fontdict = {"size" : 12 , "weight" : "bold" }
984
- )
964
+ ax .set_ylabel ("Resistivity (Ohm-m)" , fontdict = {"size" : 12 , "weight" : "bold" })
985
965
986
966
ax .legend (
987
967
[l1 , l2 ],
@@ -1206,7 +1186,7 @@ def to_simpeg_2d(self, **kwargs):
1206
1186
- `invert_tm` -> bool
1207
1187
"""
1208
1188
1209
- return Simpeg2DData (self .to_dataframe (), ** kwargs )
1189
+ return Simpeg2DData (self .to_dataframe (impedance_units = "ohm" ), ** kwargs )
1210
1190
1211
1191
def to_simpeg_3d (self , ** kwargs ):
1212
1192
"""Create a data object that Simpeg can work with.
@@ -1228,7 +1208,7 @@ def to_simpeg_3d(self, **kwargs):
1228
1208
- invert_types = ["real", "imaginary"]
1229
1209
"""
1230
1210
1231
- return Simpeg3DData (self .to_dataframe (), ** kwargs )
1211
+ return Simpeg3DData (self .to_dataframe (impedance_units = "ohm" ), ** kwargs )
1232
1212
1233
1213
def plot_mt_response (
1234
1214
self , station_key = None , station_id = None , survey_id = None , ** kwargs
@@ -1262,9 +1242,7 @@ def plot_mt_response(
1262
1242
mt_data = MTData ()
1263
1243
if isinstance (survey_id , (list , tuple )):
1264
1244
if len (survey_id ) != len (station_key ):
1265
- raise ValueError (
1266
- "Number of survey must match number of stations"
1267
- )
1245
+ raise ValueError ("Number of survey must match number of stations" )
1268
1246
elif isinstance (survey_id , (str , type (None ))):
1269
1247
survey_id = [survey_id ] * len (station_id )
1270
1248
for survey , station in zip (survey_id , station_id ):
@@ -1514,9 +1492,7 @@ def to_shp_pt_tipper(
1514
1492
:rtype: dictionary
1515
1493
"""
1516
1494
1517
- sc = ShapefileCreator (
1518
- self .to_mt_dataframe (), output_crs , save_dir = save_dir
1519
- )
1495
+ sc = ShapefileCreator (self .to_mt_dataframe (), output_crs , save_dir = save_dir )
1520
1496
sc .utm = utm
1521
1497
if ellipse_size is None and pt :
1522
1498
sc .ellipse_size = sc .estimate_ellipse_size ()
0 commit comments