When I run Example 2 - Draw Your Own Area from map2loop2-notebooks, I get an error!
import os
from map2loop.project import Project
from map2loop.m2l_enums import VerboseLevel
from datetime import datetime
import time
import warnings
t0 = time.time()
warnings.filterwarnings('ignore')
nowtime=datetime.now().isoformat(timespec='minutes')
model_name=nowtime.replace(":","-").replace("T","-")
proj = Project(
loopdata_state="WA",
overwrite="true",
verbose_level=VerboseLevel.NONE,
project_path=model_name,
working_projection="EPSG:28350",
)
proj.update_config(
out_dir=model_name,
bbox_3d={
"minx": mbbox.total_bounds[0], #500000,
"miny": mbbox.total_bounds[1], #7490000,
"maxx": mbbox.total_bounds[2], #545000,
"maxy": mbbox.total_bounds[3], #7520000,
"base": -4800,
"top": 1200,
},
#loopFilename='test.loop3d',
run_flags={
'aus': True,
'close_dip': -999,
'contact_decimate': 5,
'contact_dip': -999,
'contact_orientation_decimate': 5,
'deposits': "Fe,Cu,Au,NONE",
'dist_buffer': 10,
'dtb': '',
'fat_step': 750,
'fault_decimate': 5,
'fault_dip': -999,
'fold_decimate': 5,
'interpolation_scheme': 'scipy_rbf',
'interpolation_spacing': 500,
'intrusion_mode': 0,
'max_thickness_allowed': 10000,
'min_fault_length': 5000,
'misorientation': 30,
'null_scheme': 'null',
'orientation_decimate': 0,
'pluton_dip': 45,
'pluton_form': 'domes',
'thickness_buffer': 5000,
'use_fat': False,
'use_interpolations': False,
'fault_orientation_clusters':2,
'fault_length_clusters':2,
'map2graph':True,
'granular_map2graph':True
},
)
proj.config.c_l['intrusive']='intrusive'
#proj.config.c_l['intrusive']='mafic intrusive'
proj.workflow['fold_axial_traces']=False
proj.run()
t1 = time.time()
print("m2l",(t1-t0)/60.0,"minutes")
ValueError Traceback (most recent call last)
Cell In[8], line 21
12 model_name=nowtime.replace(":","-").replace("T","-")
13 proj = Project(
14 loopdata_state="WA",
15 overwrite="true",
(...)
18 working_projection="EPSG:28350",
19 )
---> 21 proj.update_config(
22 out_dir=model_name,
23 bbox_3d={
24 "minx": mbbox.total_bounds[0], #500000,
25 "miny": mbbox.total_bounds[1], #7490000,
26 "maxx": mbbox.total_bounds[2], #545000,
27 "maxy": mbbox.total_bounds[3], #7520000,
28 "base": -4800,
29 "top": 1200,
30 },
31 #loopFilename='test.loop3d',
32 run_flags={
33 'aus': True,
34 'close_dip': -999,
35 'contact_decimate': 5,
36 'contact_dip': -999,
37 'contact_orientation_decimate': 5,
38 'deposits': "Fe,Cu,Au,NONE",
39 'dist_buffer': 10,
40 'dtb': '',
41 'fat_step': 750,
42 'fault_decimate': 5,
43 'fault_dip': -999,
44 'fold_decimate': 5,
45 'interpolation_scheme': 'scipy_rbf',
46 'interpolation_spacing': 500,
47 'intrusion_mode': 0,
48 'max_thickness_allowed': 10000,
49 'min_fault_length': 5000,
50 'misorientation': 30,
51 'null_scheme': 'null',
52 'orientation_decimate': 0,
53 'pluton_dip': 45,
54 'pluton_form': 'domes',
55 'thickness_buffer': 5000,
56 'use_fat': False,
57 'use_interpolations': False,
58 'fault_orientation_clusters':2,
59 'fault_length_clusters':2,
60 'map2graph':True,
61 'granular_map2graph':True
62 },
63 )
64 proj.config.c_l['intrusive']='intrusive'
65 #proj.config.c_l['intrusive']='mafic intrusive'
File <@beartype(map2loop.project.Project.update_config) at 0x1700519cd30>:48, in update_config(__beartype_func, __beartype_conf, __beartype_get_violation, *args, **kwargs)
File D:\Anaconda3\envs\test39\lib\site-packages\map2loop\project.py:435, in Project.update_config(self, overwrite, bbox_3d, dtm_crs, step_out, clut_path, run_flags, **kwargs)
432 if self.state in ["WA", "NSW", "VIC", "SA", "QLD", "ACT", "TAS"]:
433 clut_path = clut_paths[self.state]
--> 435 self.config.update(
436 self.project_path,
437 bbox_3d,
438 polygon,
439 step_out,
440 dtm_crs,
441 self.map_data.working_projection,
442 self.map_data.get_filename(Datatype.METADATA),
443 clut_path=clut_path,
444 run_flags=run_flags,
445 )
447 self.map_data.load_all_map_data(self.config)
File <@beartype(map2loop.config.Config.update) at 0x170046715e0>:66, in update(__beartype_func, __beartype_conf, __beartype_get_violation, *args, **kwargs)
File D:\Anaconda3\envs\test39\lib\site-packages\map2loop\config.py:162, in Config.update(self, project_path, bbox_3d, polygon, step_out, dtm_crs, project_crs, metadata_filename, clut_path, run_flags)
159 self.project_crs = project_crs
161 self.read_metadata(metadata_filename)
--> 162 self.create_cmap()
File D:\Anaconda3\envs\test39\lib\site-packages\map2loop\config.py:204, in Config.create_cmap(self)
197 def create_cmap(self):
198 # Make colours consistent from map to model
199 formations = sorted(
200 [
201 formation.replace(" ", "_").replace("-", "_")
202 for formation in list(
203 set(
--> 204 self.map_data.get_map_data(Datatype.GEOLOGY)[
205 "UNIT_NAME"
206 ].to_numpy()
207 )
208 )
209 ]
210 )
211 temp_colours = [""] * len(formations)
212 self.colour_dict = dict(zip(formations, temp_colours))
File <@beartype(map2loop.mapdata.MapData.get_map_data) at 0x1700502ee50>:31, in get_map_data(__beartype_func, __beartype_conf, __beartype_get_violation, __beartype_object_1580561287408, *args, **kwargs)
File D:\Anaconda3\envs\test39\lib\site-packages\map2loop\mapdata.py:366, in MapData.get_map_data(self, datatype)
363 @beartype.beartype
364 def get_map_data(self, datatype: Datatype):
365 if self.data_states[datatype] != Datastate.COMPLETE:
--> 366 self.load_map_data(datatype)
367 return self.data[datatype]
File <@beartype(map2loop.mapdata.MapData.load_map_data) at 0x1700502e700>:31, in load_map_data(__beartype_func, __beartype_conf, __beartype_get_violation, __beartype_object_1580561287408, *args, **kwargs)
File D:\Anaconda3\envs\test39\lib\site-packages\map2loop\mapdata.py:196, in MapData.load_map_data(self, datatype)
193 self.data_states[datatype] = Datastate.CLIPPED
194 if self.data_states[datatype] == Datastate.CLIPPED:
195 # Convert column names using codes_and_labels dictionary
--> 196 self.check_map(datatype)
197 self.data_states[datatype] = Datastate.CONVERTED
198 if self.data_states[datatype] == Datastate.CONVERTED:
File <@beartype(map2loop.mapdata.MapData.check_map) at 0x1700502e940>:31, in check_map(__beartype_func, __beartype_conf, __beartype_get_violation, __beartype_object_1580561287408, *args, **kwargs)
File D:\Anaconda3\envs\test39\lib\site-packages\map2loop\mapdata.py:256, in MapData.check_map(self, datatype)
254 _errors = []
255 if datatype == Datatype.GEOLOGY:
--> 256 self.data[Datatype.GEOLOGY] = m2l_map_checker.check_geology_map(
257 self.data[Datatype.GEOLOGY],
258 self.config.c_l,
259 self.config.run_flags["ignore_codes"],
260 _warnings,
261 _errors,
262 True,
263 self.config.verbose_level,
264 )
265 if datatype == Datatype.STRUCTURE:
266 self.data[Datatype.STRUCTURE] = m2l_map_checker.check_structure_map(
267 self.data[Datatype.STRUCTURE],
268 self.config.c_l,
(...)
271 self.config.verbose_level,
272 )
File D:\Anaconda3\envs\test39\lib\site-packages\map2loop\m2l_map_checker.py:454, in check_geology_map(geology, c_l, ignore_codes, m2l_warnings, m2l_errors, explode_intrusives, verbose_level)
450 elif len(geology[~geology[c_l["o"]].isnull()] != len(geology)):
451 vals = geology[geology[c_l["o"]].astype(str).str.isnumeric()][
452 c_l["o"]
453 ].astype(int)
--> 454 next_index = int(np.nanmax(vals)) + 1
455 for ind, layer in geology.iterrows():
456 if pd.isna(layer[c_l["o"]]):
File <__array_function__ internals>:180, in nanmax(*args, **kwargs)
File D:\Anaconda3\envs\test39\lib\site-packages\numpy\lib\nanfunctions.py:483, in nanmax(a, axis, out, keepdims, initial, where)
480 else:
481 # Slow, but safe for subclasses of ndarray
482 a, mask = _replace_nan(a, -np.inf)
--> 483 res = np.amax(a, axis=axis, out=out, **kwargs)
484 if mask is None:
485 return res
File <__array_function__ internals>:180, in amax(*args, **kwargs)
File D:\Anaconda3\envs\test39\lib\site-packages\numpy\core\fromnumeric.py:2793, in amax(a, axis, out, keepdims, initial, where)
2677 @array_function_dispatch(_amax_dispatcher)
2678 def amax(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
2679 where=np._NoValue):
2680 """
2681 Return the maximum of an array or maximum along an axis.
2682
(...)
2791 5
2792 """
-> 2793 return _wrapreduction(a, np.maximum, 'max', axis, None, out,
2794 keepdims=keepdims, initial=initial, where=where)
File D:\Anaconda3\envs\test39\lib\site-packages\numpy\core\fromnumeric.py:86, in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
83 else:
84 return reduction(axis=axis, out=out, **passkwargs)
---> 86 return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation maximum which has no identity