PyGeoModel 1.0.12__tar.gz → 1.0.14__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.
Files changed (39) hide show
  1. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/MANIFEST.in +1 -1
  2. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/PKG-INFO +1 -1
  3. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/PyGeoModel.egg-info/PKG-INFO +1 -1
  4. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/PyGeoModel.egg-info/SOURCES.txt +2 -0
  5. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/__init__.py +1 -1
  6. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/client.py +23 -1
  7. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/config.py +7 -7
  8. pygeomodel-1.0.14/pygeomodel/data/description_translations_en.json +5228 -0
  9. pygeomodel-1.0.14/pygeomodel/data/modellist_2070.csv +2072 -0
  10. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/modeler.py +115 -5
  11. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/models.py +20 -3
  12. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/notebook.py +33 -15
  13. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/results.py +1 -1
  14. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/setup.py +2 -2
  15. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/tests/test_core_api.py +164 -7
  16. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/LICENSE +0 -0
  17. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/PyGeoModel.egg-info/dependency_links.txt +0 -0
  18. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/PyGeoModel.egg-info/requires.txt +0 -0
  19. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/PyGeoModel.egg-info/top_level.txt +0 -0
  20. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/README.md +0 -0
  21. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/ogmsServer2/__init__.py +0 -0
  22. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/ogmsServer2/base.py +0 -0
  23. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/ogmsServer2/constants.py +0 -0
  24. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/ogmsServer2/openModel.py +0 -0
  25. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/ogmsServer2/openUtils/__init__.py +0 -0
  26. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/ogmsServer2/openUtils/exceptions.py +0 -0
  27. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/ogmsServer2/openUtils/http_client.py +0 -0
  28. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/ogmsServer2/openUtils/mdlUtils.py +0 -0
  29. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/ogmsServer2/openUtils/parameterValidator.py +0 -0
  30. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/ogmsServer2/openUtils/stateManager.py +0 -0
  31. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/consensus.py +0 -0
  32. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/context.py +0 -0
  33. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/data/__init__.py +0 -0
  34. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/data/computeModel.json +0 -0
  35. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/data/modelContext.txt +0 -0
  36. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/qa.py +0 -0
  37. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/pygeomodel/recommendation.py +0 -0
  38. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/scripts.py +0 -0
  39. {pygeomodel-1.0.12 → pygeomodel-1.0.14}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  include README.md
2
2
  include LICENSE
3
- recursive-include pygeomodel/data *.json *.txt
3
+ recursive-include pygeomodel/data *.json *.txt *.csv
4
4
  global-exclude __pycache__/*
5
5
  global-exclude *.py[co]
6
6
  global-exclude *.pyd
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyGeoModel
3
- Version: 1.0.12
3
+ Version: 1.0.14
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyGeoModel
3
- Version: 1.0.12
3
+ Version: 1.0.14
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
@@ -31,5 +31,7 @@ pygeomodel/recommendation.py
31
31
  pygeomodel/results.py
32
32
  pygeomodel/data/__init__.py
33
33
  pygeomodel/data/computeModel.json
34
+ pygeomodel/data/description_translations_en.json
34
35
  pygeomodel/data/modelContext.txt
36
+ pygeomodel/data/modellist_2070.csv
35
37
  tests/test_core_api.py
@@ -5,7 +5,7 @@ from .modeler import GeoModeler
5
5
  from .models import ModelInput, ModelOutput, ModelService, ModelSummary
6
6
  from .results import QAResult, RecommendationResult, TaskResult
7
7
 
8
- __version__ = "1.0.12"
8
+ __version__ = "1.0.14"
9
9
 
10
10
  __all__ = [
11
11
  "GeoModeler",
@@ -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
@@ -52,13 +52,13 @@ def get_llm_config() -> LLMConfig:
52
52
  dify = local.get("dify", {})
53
53
  consensus = local.get("consensus", {})
54
54
  return LLMConfig(
55
- openai_api_key=os.environ.get("OPENAI_API_KEY") or openai.get("api_key") or PUBLIC_DEMO_OPENAI_API_KEY,
56
- openai_base_url=os.environ.get("OPENAI_BASE_URL") or openai.get("base_url") or PUBLIC_DEMO_OPENAI_BASE_URL,
57
- openai_model=os.environ.get("OPENAI_MODEL") or openai.get("model") or PUBLIC_DEMO_OPENAI_MODEL,
58
- dify_api_key=os.environ.get("DIFY_API_KEY") or dify.get("api_key") or PUBLIC_DEMO_DIFY_API_KEY,
59
- dify_base_url=os.environ.get("DIFY_BASE_URL") or dify.get("base_url") or PUBLIC_DEMO_DIFY_BASE_URL,
60
- consensus_api_key=consensus.get("api_key") or os.environ.get("CONSENSUS_API_KEY"),
61
- consensus_base_url=consensus.get("base_url") or os.environ.get("CONSENSUS_BASE_URL") or LLMConfig.consensus_base_url,
55
+ openai_api_key=os.environ.get("PYGEOMODEL_OPENAI_API_KEY") or openai.get("api_key") or PUBLIC_DEMO_OPENAI_API_KEY,
56
+ openai_base_url=os.environ.get("PYGEOMODEL_OPENAI_BASE_URL") or openai.get("base_url") or PUBLIC_DEMO_OPENAI_BASE_URL,
57
+ openai_model=os.environ.get("PYGEOMODEL_OPENAI_MODEL") or openai.get("model") or PUBLIC_DEMO_OPENAI_MODEL,
58
+ dify_api_key=os.environ.get("PYGEOMODEL_DIFY_API_KEY") or dify.get("api_key") or PUBLIC_DEMO_DIFY_API_KEY,
59
+ dify_base_url=os.environ.get("PYGEOMODEL_DIFY_BASE_URL") or dify.get("base_url") or PUBLIC_DEMO_DIFY_BASE_URL,
60
+ consensus_api_key=consensus.get("api_key") or os.environ.get("PYGEOMODEL_CONSENSUS_API_KEY"),
61
+ consensus_base_url=consensus.get("base_url") or os.environ.get("PYGEOMODEL_CONSENSUS_BASE_URL") or LLMConfig.consensus_base_url,
62
62
  )
63
63
 
64
64