Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Last active June 11, 2025 10:56
Show Gist options
  • Save ThomasG77/7c9a838f80578d619296f22e0a23adf3 to your computer and use it in GitHub Desktop.
Save ThomasG77/7c9a838f80578d619296f22e0a23adf3 to your computer and use it in GitHub Desktop.
Rapide exploitation des données SWI catnat (grilles et données)

Rapide exploitation des données SWI catnat (grilles et données)

Coordonnées des mailles https://donneespubliques.meteofrance.fr/client/document/metadonnees_swi_276.csv (pris depuis la page https://donneespubliques.meteofrance.fr/?fond=produit&id_produit=301&id_rubrique=40 partie Documentation)

curl -s https://donneespubliques.meteofrance.fr/client/document/metadonnees_swi_276.csv | sed 1,4d | sed 's/#//g' >| mailles_safran.csv

ogr2ogr -f "ESRI Shapefile" -dialect SQLite -sql "SELECT num_maille, lambx, lamby, lambx93, lamby93,lat_dg,lon_dg,PolygonFromText('POLYGON((' || (lambx * 100 - 4000) || ' ' || (lamby * 100 - 4000) || ',' || (lambx * 100 - 4000) || ' ' || (lamby * 100 + 4000) || ',' || (lambx * 100 + 4000) || ' ' || (lamby * 100 + 4000) || ',' || (lambx * 100 + 4000) || ' ' || (lamby * 100 - 4000) || ',' || (lambx * 100 - 4000) || ' ' || (lamby * 100 - 4000) || '))', 27572) AS geometry FROM mailles_safran" mailles_safran.shp mailles_safran.csv
zip mailles_safran.zip mailles_safran.shp mailles_safran.shx mailles_safran.dbf mailles_safran.prj
rm mailles_safran.shp mailles_safran.shx mailles_safran.dbf mailles_safran.prj

Données SWI Catnat

https://donneespubliques.meteofrance.fr/?fond=produit&id_produit=301&id_rubrique=40

wget https://donneespubliques.meteofrance.fr/donnees_libres/Txt/Swi/SWI_Package_1969-2023.zip
unp SWI_Package_1969-2023.zip
rm SWI_Package_1969-2023.zip
xsv cat rows -d ';' swi.*.csv | xsv select NUMERO,DATE,SWI_UNIF_MENS3 | awk 'BEGIN{FS=OFS="\""} {for (i=2; i<=NF; i+=2) gsub(/,/,".",$i)} 1' | sed 's#"##g' >| all_swi.csv
zip all_swi.csv.zip all_swi.csv
rm all_swi.csv
This file has been truncated, but you can view the full file.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment