-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlire_etudes.py
40 lines (30 loc) · 1.32 KB
/
lire_etudes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# coding: utf-8
"""
Lecture d'études Crue10 et vérification des fichiers XML de tous les modèles Conc
Bilan des différentes modifications du texte des fichiers introduites par le passage dans Crue10_tools.
TODO
"""
from glob import glob
import logging
import os.path
from crue10.etude import Etude
from crue10.utils import ExceptionCrue10, logger
logger.setLevel(logging.INFO)
for folder in glob(os.path.join('..', '..', 'Crue10_examples', 'sharepoint_modeles_Conc', '*')):
for etu_path in glob(os.path.join(folder, '*.etu.xml')):
logger.info(etu_path)
try:
etude = Etude(etu_path)
try:
etude.check_xml_files()
except IOError: # avoid some Crue9 missing files in `Etu_BV2016_Conc_Etatref - ISfonds2016_K2016`
pass
etude.read_all()
# Write etude (to check in integrity, see difference in file docstring above)
out_folder = os.path.join('..', 'tmp', 'sharepoint_modeles_Conc', os.path.basename(folder))
etude.write_all(out_folder)
# Write topographical graph for each modele
# for _, modele in etude.modeles.items():
# modele.write_topological_graph([os.path.join(out_folder, modele.id + '.png')])
except ExceptionCrue10 as e:
logger.critical(e)