flet-gpumap
気象の格子データ(等緯度経度の格子)を GPU で描く Flet の拡張。 AIseed Weather(weather.time-j.net)の地図画面の「動く地図」で使っている。
- 色の場: シェーダー(
shaders/field.frag)が画面の画素ごとに投影を逆にたどって 経緯度を求め、格子を双一次補間して配色する。配色表は透明度も持ち、透ける所には陸海の地色が出る - 風の粒子: Dart で動かし、直近 12 コマの位置を細い三角形の列にして 1 回で描く
- 等値線と数値、海岸線: 経緯度の線を受け取り、表示に合わせて描く
- 投影:
plate_carree(全球なら経度方向につながる)、polar_north・polar_south(正距方位) - 拡大(ホイール・ピンチ)・移動(ドラッグ)・読み取りは部品の中で完結する
Python から
from flet_gpumap import GpuField, GpuFrame
GpuField(
nx=361, ny=281, lon0=95.0, lat0=65.0, dlon=0.25, dlat=0.25,
projection="plate_carree", center_lon=140, center_lat=30, px_per_deg=14,
vmin=-20, vmax=40, lut=lut_256_rgba, base=land_mask_bytes, coast=coast_bytes,
label="2m気温", unit="°C",
frames=[GpuFrame(index=i, scalar=..., wind=..., contours=..., contours_bold=..., labels=...)
for i in ...],
step=0,
attribution="Data: ECMWF Open Data (CC-BY-4.0)",
on_ready=..., on_stats=...,
)
データの形は src/flet_gpumap/gpufield.py の説明のとおり(値は 16 bit を RGBA の RG に、
風は int16 の 0.01 m/s、線は float32 の (経度, 緯度) で切れ目は NaN)。
時刻は GpuFrame を足していき、step を変えるだけで切り替える。
値が階級(レーダーの降水強度など)のときは sampling="nearest" で補間せずに塗り、
classes=["", "〜1", "1〜5", …] で読み取りに階級の名前を出す。細かい格子の階級は
GpuFrame(scalar8=…)(1 格子点 1 バイト)で送ると RGBA の 4 分の 1 で済む。風の無い量は
show_particles=False, particles=0。
実行環境
自作の部品は Flet の出来合いの実行環境では表示されない。部品入りの実行環境を flet build で
build/linux に作り、プロジェクトのフォルダーで flet run する(Linux の Flet は build/linux を
先に使う)。
部品(Dart・シェーダー)を変えたら作り直す。
Linux(Intel 内蔵 GPU)で 57〜59 fps(粒子 10,000、等値線・海岸線あり)。Web でも描ける。
ライセンス
MIT(LICENSE)。aiai-tools のほかのコードは AGPL-3.0-or-later だが、この部品は ほかのアプリでも使えるように MIT にした(2026-10-14)。AIseed Weather の flet-gpufield を元にし、 地図とグラフを描ける部品に広げる(DESIGN.md)。
公開
flet-gpumap-v0.1.0 のようなタグを push すると、GitHub Actions(.github/workflows/publish-flet-gpumap.yml)
が PyPI に出す。
Metadata
Release files for flet-gpumap 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flet_gpumap-0.1.0.tar.gz | 20.4 kB | With provenance | Details for flet_gpumap-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flet_gpumap-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for flet_gpumap-0.1.0-py3-none-any.whl |
Total release size: 43.0 kB
Release files / flet_gpumap-0.1.0.tar.gz
| Download URL | flet_gpumap-0.1.0.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ec3de5fc7654037d571fc1d31a47a766079a92bf1ded8de2716b3e942f6e332
|
|
BLAKE2b-256 checksum How to use checksums |
63ffcd40bdfab021ca3ed3aa6d226ec6d743bf58233e260652bd17c9440759b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logRelease files / flet_gpumap-0.1.0-py3-none-any.whl
| Download URL | flet_gpumap-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4781a095429be18b7b1ac027ffc7b461625445d211dc50352b508a662d8a2c41
|
|
BLAKE2b-256 checksum How to use checksums |
56582d579b8b938191f980bd43d47e347b2452137b16c7d3b93ec756e5e0a3c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logSecurity for flet-gpumap 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for flet_gpumap-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.