PyGeoModel 1.0.11__tar.gz → 1.0.13__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.11 → pygeomodel-1.0.13}/PKG-INFO +3 -4
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/PyGeoModel.egg-info/PKG-INFO +3 -4
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/README.md +2 -3
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/__init__.py +1 -1
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/client.py +23 -1
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/results.py +1 -1
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/setup.py +1 -1
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/tests/test_core_api.py +41 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/LICENSE +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/MANIFEST.in +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/PyGeoModel.egg-info/SOURCES.txt +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/PyGeoModel.egg-info/dependency_links.txt +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/PyGeoModel.egg-info/requires.txt +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/PyGeoModel.egg-info/top_level.txt +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/ogmsServer2/__init__.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/ogmsServer2/base.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/ogmsServer2/constants.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/ogmsServer2/openModel.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/ogmsServer2/openUtils/__init__.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/ogmsServer2/openUtils/exceptions.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/ogmsServer2/openUtils/http_client.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/ogmsServer2/openUtils/mdlUtils.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/ogmsServer2/openUtils/parameterValidator.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/ogmsServer2/openUtils/stateManager.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/config.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/consensus.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/context.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/data/__init__.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/data/computeModel.json +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/data/modelContext.txt +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/modeler.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/models.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/notebook.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/qa.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/pygeomodel/recommendation.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/scripts.py +0 -0
- {pygeomodel-1.0.11 → pygeomodel-1.0.13}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyGeoModel
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.13
|
|
4
4
|
Summary: A Python package for integrating OpenGMS geographic model services.
|
|
5
5
|
Home-page: https://github.com/MpLebron/PyGeoModel
|
|
6
6
|
Author: Peilong Ma
|
|
@@ -101,11 +101,10 @@ modeler.invoke_model("Roof Photovoltaic Carbon Emission Reduction Potential Asse
|
|
|
101
101
|
|
|
102
102
|
The notebook interface renders model search, metadata inspection, parameter entry, task execution, and output display. It uses the same `search_models()`, `get_model()`, and `invoke()` functions as the programmatic API so GUI operations can be converted into explicit Python parameters and saved model outputs when needed.
|
|
103
103
|
|
|
104
|
-
## Recommendation and Q&A
|
|
104
|
+
## Recommendation and Q&A
|
|
105
105
|
|
|
106
106
|
```python
|
|
107
|
-
recommendation = modeler.suggest_model(
|
|
108
|
-
recommendation.to_json("recommendation_record.json")
|
|
107
|
+
recommendation = modeler.suggest_model()
|
|
109
108
|
|
|
110
109
|
answer = modeler.ask_model(
|
|
111
110
|
"Roof Photovoltaic Carbon Emission Reduction Potential Assessment Model",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyGeoModel
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.13
|
|
4
4
|
Summary: A Python package for integrating OpenGMS geographic model services.
|
|
5
5
|
Home-page: https://github.com/MpLebron/PyGeoModel
|
|
6
6
|
Author: Peilong Ma
|
|
@@ -101,11 +101,10 @@ modeler.invoke_model("Roof Photovoltaic Carbon Emission Reduction Potential Asse
|
|
|
101
101
|
|
|
102
102
|
The notebook interface renders model search, metadata inspection, parameter entry, task execution, and output display. It uses the same `search_models()`, `get_model()`, and `invoke()` functions as the programmatic API so GUI operations can be converted into explicit Python parameters and saved model outputs when needed.
|
|
103
103
|
|
|
104
|
-
## Recommendation and Q&A
|
|
104
|
+
## Recommendation and Q&A
|
|
105
105
|
|
|
106
106
|
```python
|
|
107
|
-
recommendation = modeler.suggest_model(
|
|
108
|
-
recommendation.to_json("recommendation_record.json")
|
|
107
|
+
recommendation = modeler.suggest_model()
|
|
109
108
|
|
|
110
109
|
answer = modeler.ask_model(
|
|
111
110
|
"Roof Photovoltaic Carbon Emission Reduction Potential Assessment Model",
|
|
@@ -56,11 +56,10 @@ modeler.invoke_model("Roof Photovoltaic Carbon Emission Reduction Potential Asse
|
|
|
56
56
|
|
|
57
57
|
The notebook interface renders model search, metadata inspection, parameter entry, task execution, and output display. It uses the same `search_models()`, `get_model()`, and `invoke()` functions as the programmatic API so GUI operations can be converted into explicit Python parameters and saved model outputs when needed.
|
|
58
58
|
|
|
59
|
-
## Recommendation and Q&A
|
|
59
|
+
## Recommendation and Q&A
|
|
60
60
|
|
|
61
61
|
```python
|
|
62
|
-
recommendation = modeler.suggest_model(
|
|
63
|
-
recommendation.to_json("recommendation_record.json")
|
|
62
|
+
recommendation = modeler.suggest_model()
|
|
64
63
|
|
|
65
64
|
answer = modeler.ask_model(
|
|
66
65
|
"Roof Photovoltaic Carbon Emission Reduction Potential Assessment Model",
|
|
@@ -5,13 +5,18 @@ from __future__ import annotations
|
|
|
5
5
|
import time
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
from typing import Any
|
|
8
|
-
from urllib.parse import quote
|
|
8
|
+
from urllib.parse import quote, urlparse, urlunparse
|
|
9
9
|
|
|
10
10
|
import requests
|
|
11
11
|
|
|
12
12
|
from .config import OpenGMSConfig, get_opengms_config
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
PUBLIC_DATA_DOWNLOAD_HOST = "geomodeling.njnu.edu.cn"
|
|
16
|
+
PUBLIC_DATA_DOWNLOAD_PREFIX = "/dataTransferServer"
|
|
17
|
+
INTERNAL_DATA_DOWNLOAD_HOSTS = {"221.224.35.86:38083"}
|
|
18
|
+
|
|
19
|
+
|
|
15
20
|
class OpenGMSClient:
|
|
16
21
|
"""Thin client around OpenGMS model-service endpoints."""
|
|
17
22
|
|
|
@@ -105,6 +110,7 @@ def download_output_files(outputs: list[dict[str, Any]], output_dir: str | Path)
|
|
|
105
110
|
url = output.get("url")
|
|
106
111
|
if not url:
|
|
107
112
|
continue
|
|
113
|
+
url = normalize_download_url(url)
|
|
108
114
|
suffix = output.get("suffix") or "dat"
|
|
109
115
|
tag = output.get("tag") or output.get("event") or f"output_{index + 1}"
|
|
110
116
|
target = output_path / f"{tag}.{suffix}"
|
|
@@ -113,3 +119,19 @@ def download_output_files(outputs: list[dict[str, Any]], output_dir: str | Path)
|
|
|
113
119
|
target.write_bytes(response.content)
|
|
114
120
|
downloaded.append(str(target))
|
|
115
121
|
return downloaded
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def normalize_download_url(url: str) -> str:
|
|
125
|
+
parsed = urlparse(url)
|
|
126
|
+
if parsed.netloc in INTERNAL_DATA_DOWNLOAD_HOSTS and parsed.path.startswith("/data/"):
|
|
127
|
+
return urlunparse(
|
|
128
|
+
(
|
|
129
|
+
"https",
|
|
130
|
+
PUBLIC_DATA_DOWNLOAD_HOST,
|
|
131
|
+
f"{PUBLIC_DATA_DOWNLOAD_PREFIX}{parsed.path}",
|
|
132
|
+
"",
|
|
133
|
+
parsed.query,
|
|
134
|
+
parsed.fragment,
|
|
135
|
+
)
|
|
136
|
+
)
|
|
137
|
+
return url
|
|
@@ -30,7 +30,7 @@ class TaskResult:
|
|
|
30
30
|
params: dict[str, Any] = field(default_factory=dict)
|
|
31
31
|
uploaded_inputs: dict[str, Any] = field(default_factory=dict)
|
|
32
32
|
endpoint: str | None = None
|
|
33
|
-
pygeomodel_version: str = "1.0.
|
|
33
|
+
pygeomodel_version: str = "1.0.13"
|
|
34
34
|
execution_time: float | None = None
|
|
35
35
|
record_path: str | None = None
|
|
36
36
|
created_at: float = field(default_factory=time.time)
|
|
@@ -127,6 +127,47 @@ class CoreApiTests(unittest.TestCase):
|
|
|
127
127
|
[str(Path(tmpdir) / "outputs" / "SolarCalculation-roofSloar.zip")],
|
|
128
128
|
)
|
|
129
129
|
|
|
130
|
+
def test_download_rewrites_internal_data_node_urls_to_public_gateway(self):
|
|
131
|
+
import pygeomodel.client as client_module
|
|
132
|
+
|
|
133
|
+
requested_urls = []
|
|
134
|
+
|
|
135
|
+
class FakeResponse:
|
|
136
|
+
content = b"downloaded-output"
|
|
137
|
+
|
|
138
|
+
def raise_for_status(self):
|
|
139
|
+
return None
|
|
140
|
+
|
|
141
|
+
original_get = client_module.requests.get
|
|
142
|
+
try:
|
|
143
|
+
def fake_get(url, timeout):
|
|
144
|
+
requested_urls.append(url)
|
|
145
|
+
self.assertEqual(timeout, 120)
|
|
146
|
+
return FakeResponse()
|
|
147
|
+
|
|
148
|
+
client_module.requests.get = fake_get
|
|
149
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
150
|
+
returned = client_module.download_output_files(
|
|
151
|
+
[
|
|
152
|
+
{
|
|
153
|
+
"url": "http://221.224.35.86:38083/data/687d91a4-f205-4659-ae9d-dd2aed896f8c?pwd=",
|
|
154
|
+
"tag": "SolarCalculation-roofSloar",
|
|
155
|
+
"suffix": "zip",
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
tmpdir,
|
|
159
|
+
)
|
|
160
|
+
self.assertEqual(Path(returned[0]).read_bytes(), b"downloaded-output")
|
|
161
|
+
finally:
|
|
162
|
+
client_module.requests.get = original_get
|
|
163
|
+
|
|
164
|
+
self.assertEqual(
|
|
165
|
+
requested_urls,
|
|
166
|
+
[
|
|
167
|
+
"https://geomodeling.njnu.edu.cn/dataTransferServer/data/687d91a4-f205-4659-ae9d-dd2aed896f8c?pwd="
|
|
168
|
+
],
|
|
169
|
+
)
|
|
170
|
+
|
|
130
171
|
def test_model_invocation_preserves_multi_child_internal_params(self):
|
|
131
172
|
from pygeomodel import GeoModeler
|
|
132
173
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|