Skip to main content

A Python package for integrating OpenGMS geographic model services.

Project description

PyGeoModel

PyGeoModel is a Python package for integrating OpenGMS geographic model services into Python-based urban data science workflows. It provides programmatic access to model-service discovery, metadata inspection, service invocation, task records, and result management. For exploratory notebook-based analysis, PyGeoModel also provides an optional Jupyter interface built on the same core API.

Installation

pip install PyGeoModel

Use the package in Python with:

from pygeomodel import GeoModeler

Core API

from pygeomodel import GeoModeler

modeler = GeoModeler()

models = modeler.search_models("photovoltaic")
model = modeler.get_model("Roof Photovoltaic Carbon Emission Reduction Potential Assessment Model")

print(model.description)
print(model.inputs)
print(model.outputs)

Model services can be invoked programmatically:

result = modeler.invoke(
    "Roof Photovoltaic Carbon Emission Reduction Potential Assessment Model",
    params={
        "system_efficiency": 0.8,
        "start_time": 201801,
        "end_time": 201812,
        "roof_vector_path": "data/rooftops.zip",
    },
)

result.to_json("execution_record.json")

OpenGMS execution uses the bundled public demo token by default. For stable or private use, configure your own OpenGMS token:

export OGMS_TOKEN="your-token"

Optional endpoint overrides:

export OGMS_BASE_PORTAL_URL="http://222.192.7.75"
export OGMS_BASE_MANAGER_URL="http://222.192.7.75/managerServer"
export OGMS_BASE_DATA_URL="http://222.192.7.75/dataTransferServer"

Notebook Interface

modeler.show_models()
modeler.invoke_model("SWAT_Model")

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 Python dictionaries and execution records.

Recommendation and Q&A Records

recommendation = modeler.suggest_model(return_result=True)
recommendation.to_json("recommendation_record.json")

answer = modeler.ask_model("SWAT_Model", "What input data are required?")
answer.to_json("qa_record.json")

The recommendation service automatically builds notebook/data context and calls the configured Dify workflow. Q&A uses OpenGMS model metadata and an OpenAI-compatible web-enabled model. PyGeoModel includes public demo credentials for these services so the main notebook workflow can run out of the box. For stable, private, or high-volume use, configure your own credentials with DIFY_API_KEY, OPENAI_API_KEY, OPENAI_BASE_URL, and OPENAI_MODEL.

Relation to OpenGMS

OpenGMS provides the model-service platform and online execution infrastructure. PyGeoModel is a Python client package that exposes OpenGMS model-service discovery, metadata inspection, task invocation, and result records to Python and notebook workflows.

Development

Run the lightweight test suite with:

python -m unittest discover -s tests

The source distribution should not include real API keys, local .env files, bytecode caches, generated C files, .pyd binaries, or previous build artifacts.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygeomodel-1.0.7.tar.gz (3.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygeomodel-1.0.7-py3-none-any.whl (4.1 MB view details)

Uploaded Python 3

File details

Details for the file pygeomodel-1.0.7.tar.gz.

File metadata

  • Download URL: pygeomodel-1.0.7.tar.gz
  • Upload date:
  • Size: 3.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for pygeomodel-1.0.7.tar.gz
Algorithm Hash digest
SHA256 233d6466fe8daa07cfb07711f5231e2b2a61915d2e011a60aca29e0f2b5a6c55
MD5 4c1d8df222154cc8fc0a2e6152832331
BLAKE2b-256 7895733022544941764882e772527aabadc963a8ce5a8f62cd135ce4096562c6

See more details on using hashes here.

File details

Details for the file pygeomodel-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: pygeomodel-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 4.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for pygeomodel-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e2220d1c430ac1ef6ced24b2ab3650e48ef22d1f5a2080f9b6acecbdc7e26ea1
MD5 c7097af68c543d470022d8b76c5f19a0
BLAKE2b-256 33cd4741106c14a13af5044243e1b3a0aeda39a8036a90d1c1265abfb98fefd5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page