PyGeoModel 1.0.2__tar.gz → 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/LICENSE +2 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/MANIFEST.in +2 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/PKG-INFO +1 -1
- {pygeomodel-1.0.2/pygeomodel → pygeomodel-1.0.3/PyGeoModel}/__init__.py +147 -150
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/PyGeoModel.egg-info/PKG-INFO +1 -1
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/PyGeoModel.egg-info/SOURCES.txt +4 -4
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/PyGeoModel.egg-info/top_level.txt +1 -1
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/setup.py +4 -2
- {pygeomodel-1.0.2 → pygeomodel-1.0.3/PyGeoModel}/data/computeModel.json +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3/PyGeoModel}/data/modelContext.txt +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/PyGeoModel.egg-info/dependency_links.txt +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/PyGeoModel.egg-info/requires.txt +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/README.md +0 -0
- {pygeomodel-1.0.2/pygeomodel → pygeomodel-1.0.3}/data/computeModel.json +0 -0
- {pygeomodel-1.0.2/pygeomodel → pygeomodel-1.0.3}/data/modelContext.txt +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/__init__.py +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/base.py +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/constants.py +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/data/PGA.tif +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/data/baseclip.tif +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/data/intensity.tif +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/data//345/234/260/351/234/207/347/276/244/345/217/221/346/273/221/345/235/241/346/246/202/347/216/207/350/257/204/344/274/260/351/242/204/350/255/246/346/250/241/345/236/213_67c32dc057e89375/LandSlide-outputIntensitypbtyTif.tif" +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/data//345/234/260/351/234/207/347/276/244/345/217/221/346/273/221/345/235/241/346/246/202/347/216/207/350/257/204/344/274/260/351/242/204/350/255/246/346/250/241/345/236/213_67c32dc057e89375/LandSlide-outputPGApbtyTif.tif" +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/data//345/234/260/351/234/207/347/276/244/345/217/221/346/273/221/345/235/241/346/246/202/347/216/207/350/257/204/344/274/260/351/242/204/350/255/246/346/250/241/345/236/213_7972c0716caa1213/LandSlide-outputIntensitypbtyTif.tif" +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/data//345/234/260/351/234/207/347/276/244/345/217/221/346/273/221/345/235/241/346/246/202/347/216/207/350/257/204/344/274/260/351/242/204/350/255/246/346/250/241/345/236/213_7972c0716caa1213/LandSlide-outputPGApbtyTif.tif" +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/data//345/234/260/351/234/207/347/276/244/345/217/221/346/273/221/345/235/241/346/246/202/347/216/207/350/257/204/344/274/260/351/242/204/350/255/246/346/250/241/345/236/213_a044c410df669372/LandSlide-outputIntensitypbtyTif.tif" +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/data//345/234/260/351/234/207/347/276/244/345/217/221/346/273/221/345/235/241/346/246/202/347/216/207/350/257/204/344/274/260/351/242/204/350/255/246/346/250/241/345/236/213_a044c410df669372/LandSlide-outputPGApbtyTif.tif" +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/data//345/234/260/351/234/207/347/276/244/345/217/221/346/273/221/345/235/241/346/246/202/347/216/207/350/257/204/344/274/260/351/242/204/350/255/246/346/250/241/345/236/213_b6ba56c07bf80c30/LandSlide-outputIntensitypbtyTif.tif" +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/data//345/234/260/351/234/207/347/276/244/345/217/221/346/273/221/345/235/241/346/246/202/347/216/207/350/257/204/344/274/260/351/242/204/350/255/246/346/250/241/345/236/213_b6ba56c07bf80c30/LandSlide-outputPGApbtyTif.tif" +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/openModel.py +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/openUtils/__init__.py +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/openUtils/exceptions.py +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/openUtils/http_client.py +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/openUtils/mdlUtils.py +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/openUtils/parameterValidator.py +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/ogmsServer2/openUtils/stateManager.py +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/scripts.py +0 -0
- {pygeomodel-1.0.2 → pygeomodel-1.0.3}/setup.cfg +0 -0
|
@@ -208,82 +208,27 @@ class GeoModeler:
|
|
|
208
208
|
|
|
209
209
|
def _load_model_names(self):
|
|
210
210
|
"""轻量级加载 - 只加载模型名称,不加载完整数据"""
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
models_data = json.loads(json_content)
|
|
214
|
-
self.model_names = list(models_data.keys())
|
|
215
|
-
except Exception as e:
|
|
216
|
-
print(f"Failed to load model names: {str(e)}")
|
|
217
|
-
self.model_names = []
|
|
211
|
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
212
|
+
json_path = os.path.join(current_dir, "data", "computeModel.json")
|
|
218
213
|
|
|
219
|
-
def _load_json_data(self):
|
|
220
|
-
"""加载 computeModel.json 数据,支持多种环境"""
|
|
221
214
|
try:
|
|
222
|
-
# 方法1: 尝试使用 pkg_resources
|
|
223
|
-
try:
|
|
224
|
-
import pkg_resources
|
|
225
|
-
return pkg_resources.resource_string('pygeomodel', 'data/computeModel.json').decode('utf-8')
|
|
226
|
-
except:
|
|
227
|
-
pass
|
|
228
|
-
|
|
229
|
-
# 方法2: 尝试使用 importlib.resources (Python 3.9+)
|
|
230
|
-
try:
|
|
231
|
-
from importlib import resources
|
|
232
|
-
import sys
|
|
233
|
-
if 'pygeomodel' in sys.modules:
|
|
234
|
-
json_path = resources.files(
|
|
235
|
-
'pygeomodel') / 'data' / 'computeModel.json'
|
|
236
|
-
return json_path.read_text(encoding='utf-8')
|
|
237
|
-
except:
|
|
238
|
-
pass
|
|
239
|
-
|
|
240
|
-
# 方法3: 回退到相对路径(开发环境)
|
|
241
|
-
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
242
|
-
json_path = os.path.join(current_dir, "data", "computeModel.json")
|
|
243
|
-
with open(json_path, encoding='utf-8') as f:
|
|
244
|
-
return f.read()
|
|
245
|
-
|
|
246
|
-
except Exception as e:
|
|
247
|
-
raise Exception(f"Cannot load computeModel.json: {str(e)}")
|
|
248
|
-
|
|
249
|
-
@staticmethod
|
|
250
|
-
def _load_json_data_static():
|
|
251
|
-
"""静态方法加载 computeModel.json 数据,供其他类使用"""
|
|
252
|
-
try:
|
|
253
|
-
# 方法1: 尝试使用 pkg_resources
|
|
254
|
-
try:
|
|
255
|
-
import pkg_resources
|
|
256
|
-
return pkg_resources.resource_string('pygeomodel', 'data/computeModel.json').decode('utf-8')
|
|
257
|
-
except:
|
|
258
|
-
pass
|
|
259
|
-
|
|
260
|
-
# 方法2: 尝试使用 importlib.resources (Python 3.9+)
|
|
261
|
-
try:
|
|
262
|
-
from importlib import resources
|
|
263
|
-
import sys
|
|
264
|
-
if 'pygeomodel' in sys.modules:
|
|
265
|
-
json_path = resources.files('pygeomodel') / 'data' / 'computeModel.json'
|
|
266
|
-
return json_path.read_text(encoding='utf-8')
|
|
267
|
-
except:
|
|
268
|
-
pass
|
|
269
|
-
|
|
270
|
-
# 方法3: 回退到相对路径(开发环境)
|
|
271
|
-
import os
|
|
272
|
-
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
273
|
-
json_path = os.path.join(current_dir, "data", "computeModel.json")
|
|
274
215
|
with open(json_path, encoding='utf-8') as f:
|
|
275
|
-
|
|
276
|
-
|
|
216
|
+
models_data = json.load(f)
|
|
217
|
+
self.model_names = list(models_data.keys())
|
|
277
218
|
except Exception as e:
|
|
278
|
-
|
|
219
|
+
print(f"Failed to load model names: {str(e)}")
|
|
220
|
+
self.model_names = []
|
|
279
221
|
|
|
280
222
|
def _load_models(self):
|
|
281
223
|
"""加载所有模型的完整数据(保留原有方法作为兼容性接口)"""
|
|
224
|
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
225
|
+
json_path = os.path.join(current_dir, "data", "computeModel.json")
|
|
226
|
+
|
|
282
227
|
try:
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
228
|
+
with open(json_path, encoding='utf-8') as f:
|
|
229
|
+
models_data = json.load(f)
|
|
230
|
+
for model_name, model_data in models_data.items():
|
|
231
|
+
self.models[model_name] = Model(model_name, model_data)
|
|
287
232
|
except Exception as e:
|
|
288
233
|
print(f"Failed to load model configuration file: {str(e)}")
|
|
289
234
|
self.models = {}
|
|
@@ -305,26 +250,29 @@ class GeoModeler:
|
|
|
305
250
|
return None
|
|
306
251
|
|
|
307
252
|
# 从文件加载特定模型数据
|
|
253
|
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
254
|
+
json_path = os.path.join(current_dir, "data", "computeModel.json")
|
|
255
|
+
|
|
308
256
|
try:
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
257
|
+
with open(json_path, encoding='utf-8') as f:
|
|
258
|
+
models_data = json.load(f)
|
|
259
|
+
if model_name in models_data:
|
|
260
|
+
model_data = models_data[model_name]
|
|
313
261
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
262
|
+
# 添加到缓存
|
|
263
|
+
if len(self._model_cache) >= self._max_cache_size:
|
|
264
|
+
# 移除最旧的缓存项
|
|
265
|
+
oldest_key = next(iter(self._model_cache))
|
|
266
|
+
del self._model_cache[oldest_key]
|
|
319
267
|
|
|
320
|
-
|
|
321
|
-
|
|
268
|
+
self._model_cache[model_name] = model_data
|
|
269
|
+
self.models[model_name] = Model(model_name, model_data)
|
|
322
270
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
271
|
+
# 定期清理内存
|
|
272
|
+
if len(self.models) % 5 == 0:
|
|
273
|
+
cleanup_memory()
|
|
326
274
|
|
|
327
|
-
|
|
275
|
+
return self.models[model_name]
|
|
328
276
|
except Exception as e:
|
|
329
277
|
print(f"Failed to load model '{model_name}': {str(e)}")
|
|
330
278
|
return None
|
|
@@ -1344,34 +1292,60 @@ class GeoModeler:
|
|
|
1344
1292
|
button_container = widgets.HBox(
|
|
1345
1293
|
layout=widgets.Layout(
|
|
1346
1294
|
display='flex',
|
|
1347
|
-
justify_content='flex-
|
|
1295
|
+
justify_content='flex-end',
|
|
1348
1296
|
gap='10px'
|
|
1349
1297
|
)
|
|
1350
1298
|
)
|
|
1351
1299
|
|
|
1352
|
-
# 创建Run
|
|
1300
|
+
# 创建Run按钮(运行期间禁用)
|
|
1353
1301
|
run_button = widgets.Button(
|
|
1354
1302
|
description='Run',
|
|
1355
1303
|
style=widgets.ButtonStyle(
|
|
1356
1304
|
button_color='#4CAF50', text_color='white')
|
|
1357
1305
|
)
|
|
1358
|
-
run_button.on_click(self._on_run_button_clicked)
|
|
1359
1306
|
|
|
1360
|
-
#
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
button_color='#ef4444', text_color='white'),
|
|
1365
|
-
layout=widgets.Layout(width='80px')
|
|
1366
|
-
)
|
|
1307
|
+
# 运行中动画(放在按钮右侧,默认隐藏)
|
|
1308
|
+
spinner_widget = widgets.HTML(
|
|
1309
|
+
value='', layout=widgets.Layout(margin='0 6px'))
|
|
1310
|
+
self.widgets['running_spinner'] = spinner_widget
|
|
1367
1311
|
|
|
1368
|
-
def
|
|
1369
|
-
|
|
1312
|
+
def on_run_click(b):
|
|
1313
|
+
# 禁用按钮,按钮文案与图标切换为运行中
|
|
1314
|
+
run_button.disabled = True
|
|
1315
|
+
original_desc = run_button.description
|
|
1316
|
+
original_icon = getattr(run_button, 'icon', '')
|
|
1317
|
+
run_button.description = 'Model calculating...'
|
|
1318
|
+
# 在按钮内使用 fontawesome spinner 图标并注入旋转CSS
|
|
1319
|
+
try:
|
|
1320
|
+
run_button.icon = 'spinner'
|
|
1321
|
+
display, HTML, _ = _lazy_import_ipython_display()
|
|
1322
|
+
if not getattr(self, '_spinner_css_injected', False):
|
|
1323
|
+
display(HTML(
|
|
1324
|
+
'<style>@keyframes fa-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}} .fa-spinner{animation:fa-spin 1s linear infinite!important;}</style>'))
|
|
1325
|
+
self._spinner_css_injected = True
|
|
1326
|
+
except Exception:
|
|
1327
|
+
pass
|
|
1328
|
+
# 静默运行,屏蔽底层print日志
|
|
1329
|
+
import contextlib
|
|
1330
|
+
import io
|
|
1331
|
+
_buf_out, _buf_err = io.StringIO(), io.StringIO()
|
|
1332
|
+
try:
|
|
1333
|
+
with contextlib.redirect_stdout(_buf_out), contextlib.redirect_stderr(_buf_err):
|
|
1334
|
+
self._on_run_button_clicked(b)
|
|
1335
|
+
finally:
|
|
1336
|
+
# 恢复按钮状态
|
|
1337
|
+
run_button.disabled = False
|
|
1338
|
+
run_button.description = original_desc
|
|
1339
|
+
try:
|
|
1340
|
+
run_button.icon = original_icon
|
|
1341
|
+
except Exception:
|
|
1342
|
+
pass
|
|
1343
|
+
spinner_widget.value = ''
|
|
1370
1344
|
|
|
1371
|
-
|
|
1345
|
+
run_button.on_click(on_run_click)
|
|
1372
1346
|
|
|
1373
1347
|
# 将按钮添加到按钮容器
|
|
1374
|
-
button_container.children = [run_button,
|
|
1348
|
+
button_container.children = [run_button, spinner_widget]
|
|
1375
1349
|
|
|
1376
1350
|
# 将按钮容器添加到widgets_list
|
|
1377
1351
|
widgets_list.append(button_container)
|
|
@@ -1523,8 +1497,20 @@ class GeoModeler:
|
|
|
1523
1497
|
# 导入requests模块
|
|
1524
1498
|
requests = _lazy_import_requests()
|
|
1525
1499
|
|
|
1526
|
-
|
|
1527
|
-
|
|
1500
|
+
# 检查是否为静默模式
|
|
1501
|
+
silent_mode = getattr(self, '_silent_mode', False)
|
|
1502
|
+
|
|
1503
|
+
# 定义输出上下文
|
|
1504
|
+
if not silent_mode:
|
|
1505
|
+
output_context = self.widgets['output_area']
|
|
1506
|
+
else:
|
|
1507
|
+
# 静默模式下使用空的上下文管理器
|
|
1508
|
+
import contextlib
|
|
1509
|
+
output_context = contextlib.nullcontext()
|
|
1510
|
+
|
|
1511
|
+
with output_context:
|
|
1512
|
+
if not silent_mode:
|
|
1513
|
+
self.widgets['output_area'].clear_output()
|
|
1528
1514
|
|
|
1529
1515
|
missing_required_fields = []
|
|
1530
1516
|
input_files = {}
|
|
@@ -1600,7 +1586,9 @@ class GeoModeler:
|
|
|
1600
1586
|
return
|
|
1601
1587
|
|
|
1602
1588
|
try:
|
|
1603
|
-
|
|
1589
|
+
# 只在非静默模式下打印调试信息
|
|
1590
|
+
if not silent_mode:
|
|
1591
|
+
print(input_files)
|
|
1604
1592
|
# 继续执行模型
|
|
1605
1593
|
# 导入openModel模块
|
|
1606
1594
|
openModel = _lazy_import_openmodel()
|
|
@@ -1617,49 +1605,50 @@ class GeoModeler:
|
|
|
1617
1605
|
# print(result)
|
|
1618
1606
|
|
|
1619
1607
|
# 在UI中展示结果的下载链接(不自动下载到本地)
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
tag
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
<
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1608
|
+
if not silent_mode:
|
|
1609
|
+
display, HTML, _ = _lazy_import_ipython_display()
|
|
1610
|
+
rows = []
|
|
1611
|
+
for output in result:
|
|
1612
|
+
url = output.get('url')
|
|
1613
|
+
tag = output.get('tag', '')
|
|
1614
|
+
suffix = output.get('suffix', '')
|
|
1615
|
+
statename = output.get('statename', '')
|
|
1616
|
+
event = output.get('event', '')
|
|
1617
|
+
filename = f"{tag}.{suffix}" if tag and suffix else (
|
|
1618
|
+
tag or '')
|
|
1619
|
+
if url:
|
|
1620
|
+
rows.append(f"""
|
|
1621
|
+
<tr>
|
|
1622
|
+
<td style=\"padding:8px;border-bottom:1px solid #e5e7eb;text-align:left;\">{statename}</td>
|
|
1623
|
+
<td style=\"padding:8px;border-bottom:1px solid #e5e7eb;text-align:left;\">{event}</td>
|
|
1624
|
+
<td style=\"padding:8px;border-bottom:1px solid #e5e7eb;text-align:left;\">{filename}</td>
|
|
1625
|
+
<td style=\"padding:8px;border-bottom:1px solid #e5e7eb;text-align:left;\"><a href=\"{url}\" target=\"_blank\">Download</a></td>
|
|
1626
|
+
</tr>
|
|
1627
|
+
""")
|
|
1628
|
+
|
|
1629
|
+
# 预生成表格行HTML,避免在f-string表达式中包含反斜杠
|
|
1630
|
+
rows_html = ''.join(
|
|
1631
|
+
rows) if rows else '<tr><td colspan="4" style="padding:8px;color:#64748b;">No outputs</td></tr>'
|
|
1632
|
+
|
|
1633
|
+
table_html = f"""
|
|
1634
|
+
<div style=\"margin:10px 0;\">
|
|
1635
|
+
<div style=\"font-weight:600;margin-bottom:6px;\">Model outputs</div>
|
|
1636
|
+
<table style=\"width:100%;border-collapse:collapse;font-size:14px;\">
|
|
1637
|
+
<thead>
|
|
1638
|
+
<tr style=\"background:#f8fafc;\">
|
|
1639
|
+
<th style=\"text-align:left;padding:8px;border-bottom:1px solid #e5e7eb;\">State</th>
|
|
1640
|
+
<th style=\"text-align:left;padding:8px;border-bottom:1px solid #e5e7eb;\">Event</th>
|
|
1641
|
+
<th style=\"text-align:left;padding:8px;border-bottom:1px solid #e5e7eb;\">File</th>
|
|
1642
|
+
<th style=\"text-align:left;padding:8px;border-bottom:1px solid #e5e7eb;\">Link</th>
|
|
1643
|
+
</tr>
|
|
1644
|
+
</thead>
|
|
1645
|
+
<tbody>
|
|
1646
|
+
{rows_html}
|
|
1647
|
+
</tbody>
|
|
1648
|
+
</table>
|
|
1649
|
+
</div>
|
|
1650
|
+
"""
|
|
1651
|
+
display(HTML(table_html))
|
|
1663
1652
|
|
|
1664
1653
|
except Exception as e:
|
|
1665
1654
|
print(f"❌ Error: Model run failed - {str(e)}")
|
|
@@ -1952,12 +1941,15 @@ Please output in English.
|
|
|
1952
1941
|
import os
|
|
1953
1942
|
|
|
1954
1943
|
# 加载本地模型数据
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1944
|
+
model_data_path = os.path.join(os.path.dirname(
|
|
1945
|
+
__file__), 'data', 'computeModel.json')
|
|
1946
|
+
|
|
1947
|
+
if not os.path.exists(model_data_path):
|
|
1959
1948
|
return []
|
|
1960
1949
|
|
|
1950
|
+
with open(model_data_path, 'r', encoding='utf-8') as f:
|
|
1951
|
+
all_models = json.load(f)
|
|
1952
|
+
|
|
1961
1953
|
# 获取当前模型信息
|
|
1962
1954
|
current_model_name = self.current_model.name
|
|
1963
1955
|
if current_model_name not in all_models:
|
|
@@ -2357,9 +2349,14 @@ class NotebookContext:
|
|
|
2357
2349
|
def _get_model_context(self):
|
|
2358
2350
|
"""获取模型仓库上下文信息"""
|
|
2359
2351
|
try:
|
|
2360
|
-
#
|
|
2361
|
-
|
|
2362
|
-
|
|
2352
|
+
# 获取当前文件所在目录
|
|
2353
|
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
2354
|
+
# 构建JSON文件路径
|
|
2355
|
+
json_path = os.path.join(current_dir, "data", "computeModel.json")
|
|
2356
|
+
|
|
2357
|
+
# 取模型配置文件
|
|
2358
|
+
with open(json_path, encoding='utf-8') as f:
|
|
2359
|
+
models_data = json.load(f)
|
|
2363
2360
|
|
|
2364
2361
|
# 如果没有模型数据,返回相应描述
|
|
2365
2362
|
if not models_data:
|
|
@@ -3,11 +3,14 @@ MANIFEST.in
|
|
|
3
3
|
README.md
|
|
4
4
|
scripts.py
|
|
5
5
|
setup.py
|
|
6
|
+
PyGeoModel/__init__.py
|
|
6
7
|
PyGeoModel.egg-info/PKG-INFO
|
|
7
8
|
PyGeoModel.egg-info/SOURCES.txt
|
|
8
9
|
PyGeoModel.egg-info/dependency_links.txt
|
|
9
10
|
PyGeoModel.egg-info/requires.txt
|
|
10
11
|
PyGeoModel.egg-info/top_level.txt
|
|
12
|
+
PyGeoModel/data/computeModel.json
|
|
13
|
+
PyGeoModel/data/modelContext.txt
|
|
11
14
|
data/computeModel.json
|
|
12
15
|
data/modelContext.txt
|
|
13
16
|
ogmsServer2/__init__.py
|
|
@@ -30,7 +33,4 @@ ogmsServer2/openUtils/exceptions.py
|
|
|
30
33
|
ogmsServer2/openUtils/http_client.py
|
|
31
34
|
ogmsServer2/openUtils/mdlUtils.py
|
|
32
35
|
ogmsServer2/openUtils/parameterValidator.py
|
|
33
|
-
ogmsServer2/openUtils/stateManager.py
|
|
34
|
-
pygeomodel/__init__.py
|
|
35
|
-
pygeomodel/data/computeModel.json
|
|
36
|
-
pygeomodel/data/modelContext.txt
|
|
36
|
+
ogmsServer2/openUtils/stateManager.py
|
|
@@ -11,7 +11,7 @@ def read_readme():
|
|
|
11
11
|
|
|
12
12
|
setup(
|
|
13
13
|
name="PyGeoModel",
|
|
14
|
-
version="1.0.
|
|
14
|
+
version="1.0.3",
|
|
15
15
|
author="Your Name", # 请替换为您的姓名
|
|
16
16
|
author_email="your.email@example.com", # 请替换为您的邮箱
|
|
17
17
|
description="An intelligent Python toolkit for geographic modeling with smart model recommendations",
|
|
@@ -21,7 +21,7 @@ setup(
|
|
|
21
21
|
py_modules=["scripts"],
|
|
22
22
|
packages=find_packages(),
|
|
23
23
|
package_data={
|
|
24
|
-
'
|
|
24
|
+
'PyGeoModel': ['data/*.json', 'data/*.txt'],
|
|
25
25
|
'ogmsServer2': ['data/*.tif', 'data/*/*.tif'],
|
|
26
26
|
},
|
|
27
27
|
include_package_data=True,
|
|
@@ -52,3 +52,5 @@ setup(
|
|
|
52
52
|
],
|
|
53
53
|
keywords="geographic modeling, GIS, machine learning, model recommendation, geospatial analysis, jupyter",
|
|
54
54
|
)
|
|
55
|
+
|
|
56
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|