vercors.me : collecte Météo-France / Infoclimat / VP2, archive SQLite, accueil en carte, forum (squelette)
- collecte : collecter_meteofrance, extraire_infoclimat, extraire_vp2, archiver_historique, importer_opendata ; WeatherLink allégé (alleger) - tests : meteofrance, infoclimat, vp2, archive, opendata (tous verts) - maquettes/accueil-carte : sources de la maquette (générateurs de tuiles, page, À propos, CGU, confidentialité) - forum : noyau local (rôles, droits, SQLite, serveur de test, 18 tests) - deploy : Caddyfile.vercors.me.v2 (non appliqué) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Cette révision appartient à :
1 Parent
956d08ffd7
révision
ff42faca16
42 fichiers modifiés
+5127
Aucun fichier ne correspond à votre recherche
@@ -0,0 +1,31 @@
|
||||
# Courbes de niveau légères, une par altitude, pour l'animation d'ouverture (du plus haut au plus bas).
|
||||
import json, math
|
||||
import numpy as np
|
||||
import contourpy
|
||||
from pnr import rdp, f
|
||||
|
||||
c = json.load(open('carte.json', encoding='utf-8'))
|
||||
LAT0, LAT1, LON0, LON1 = 44.66, 45.31, 5.12, 5.82
|
||||
H, W = 1560, 1200
|
||||
z = np.fromfile('mnt.bil', '<f4').reshape(H, W).astype(np.float64)
|
||||
# sous-échantillonnage ×3 puis léger lissage : traits simples, fichier petit
|
||||
z = z[::3, ::3]
|
||||
k = np.exp(-0.5 * (np.arange(-3, 4) / 1.2) ** 2); k /= k.sum()
|
||||
for ax in (0, 1):
|
||||
z = np.apply_along_axis(lambda v: np.convolve(np.pad(v, 3, mode='edge'), k, 'valid'), ax, z)
|
||||
X = (np.arange(z.shape[1]) + 0.5) / z.shape[1] * c['vw']
|
||||
Y = (np.arange(z.shape[0]) + 0.5) / z.shape[0] * c['vh']
|
||||
gen = contourpy.contour_generator(X, Y, z, line_type='Separate')
|
||||
niveaux = []
|
||||
for t in range(2300, 199, -100):
|
||||
d = ''
|
||||
for l in gen.lines(t):
|
||||
if len(l) < 10:
|
||||
continue
|
||||
s = rdp(np.asarray(l), 1.6)
|
||||
if len(s) >= 2:
|
||||
d += 'M' + 'L'.join(f'{f(x)} {f(y)}' for x, y in s)
|
||||
if d:
|
||||
niveaux.append([t, d])
|
||||
json.dump(niveaux, open('intro.json', 'w'))
|
||||
print(len(niveaux), 'niveaux', sum(len(d) for _, d in niveaux) // 1024, 'Ko')
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur