Skip to content

Commit

Permalink
[4.1] (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucduron authored May 24, 2024
1 parent 021fa53 commit 04e6731
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
max-parallel: 5
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Journal des modifications
=========================

## [4.1] - 2024-05-24

### Nouveautés
- Ajout `Etude.renommer_sous_modele`

### Corrections
- Ajout des fichiers de données dans le package Python (via MANIFEST.in)
- `stat_diff_calculs_{Cas-tests,Conc}.py` se lisent un Run OTFA
- Remplacement `np.float` et `np.int` qui ont expirés (avec numpy 1.24)
- Mise à jour des fichiers XSD et CCM


## [4.0] - 2023-06-01

### Nouveautés
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include *.md
recursive-include crue10/data *.dbf *.shp *.shx
recursive-include crue10/data *.xml *.xsd
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Crue10 tools
[![Python package](https://github.com/CNR-Engineering/Crue10_tools/workflows/Python%20package/badge.svg)](https://github.com/CNR-Engineering/Crue10_tools/actions)
[![Documentation Status](https://readthedocs.org/projects/crue10-tools/badge/?version=latest)](https://crue10-tools.readthedocs.io/fr/latest/)

Versions Python compatibles : 2.7 (plus testé), 3.7, 3.8, 3.9, 3.10 et 3.11.
Versions Python compatibles : 2.7 (plus testé), 3.7, 3.8, 3.9, 3.10, 3.11 et 3.12.

> Outil pour manipuler des modèles 1D au format `Crue10` (code de calcul, propriétée de CNR).
Expand Down
2 changes: 1 addition & 1 deletion crue10/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# coding: utf-8

#: Version du dépôt Crue10_tools
VERSION = '4.0'
VERSION = '4.1'
12 changes: 5 additions & 7 deletions crue10/base/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# coding: utf-8
import abc
import subprocess
from copy import deepcopy
from io import open # Python2 fix
from lxml import etree
import os.path
import xml.etree.ElementTree as ET

Expand All @@ -18,17 +16,17 @@

class EnsembleFichiersXML(ABC):
"""
Abstract class for Crue10 XML files
Classe abstraite pour les fichiers XML Crue10
:ivar version_grammaire: version de la grammaire
:vartype version_grammaire: str
:ivar xml_trees: dict with XML trees (keys correspond to `FILES_XML_WITHOUT_TEMPLATE` list)
:ivar xml_trees: dictionnaire avec les arbres XML (les clés correspondent à `FILES_XML_WITHOUT_TEMPLATE`)
:vartype xml_trees: {ET.ElementTree}
:ivar metadata: containing metadata (keys correspond to `METADATA_FIELDS` list)
:ivar metadata: dictionnaire avec les méta-données (les clés correspondent à `METADATA_FIELDS`)
:vartype metadata: {dict}
:ivar files: dict with path to xml files (keys correspond to `FILES_XML` list)
:ivar files: dictionnaire avec les chemins vers les fichiers XML (les clés correspondent à `FILES_XML` list)
:vartype files: {str}
:ivar comments: dict with comment of xml files (keys correspond to `FILES_XML` list)
:ivar comments: dictionnaire avec les commentaires en en-tête des fichiers XML (les clés correspondent à `FILES_XML` list)
:vartype comments: {str}
:ivar was_read: True si déjà lu
:vartype was_read: bool
Expand Down
16 changes: 8 additions & 8 deletions crue10/emh/branche.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class Branche(ABC):
:vartype noeud_aval: Noeud
:ivar liste_sections_dans_branche: liste des sections
:vartype liste_sections_dans_branche: list(Section)
:ivar comment: optional text explanation
:vartype comment: str, optional
:ivar comment: commentaire optionnel
:vartype comment: str
"""

TYPES = {
Expand All @@ -88,13 +88,13 @@ class Branche(ABC):
20: 'BrancheSaintVenant'
}

# Branch types whose sections (at least 2) have a geometry (SectionProfil or SectionIdem)
#: Types des branches dont les sections (au minimum 2) ont une géométrie (`SectionProfil` ou `SectionIdem`)
TYPES_WITH_GEOM = [2, 6, 15, 20]

# Branch types which have a non-zero length value
#: Types des branches qui ont une longueur non nulle
TYPES_WITH_LENGTH = [6, 20]

# Branch types which should be located in the river bed (and not the floodplain)
#: Types des branches qui doivent être localisées dans le lit de la rivière (et pas dans la plaine d'inondation)
TYPES_IN_MINOR_BED = [1, 2, 20]

def __init__(self, nom_branche, noeud_amont, noeud_aval, type_branche, is_active=True):
Expand Down Expand Up @@ -159,7 +159,7 @@ def get_section_aval(self):
@property
def length(self):
"""
:return: Longueur schématique affichée dans FC (peut différer de la longueur géométrique)
:return: Longueur schématique affichée dans Fudaa-Crue (peut différer de la longueur géométrique)
:rtype: float
"""
if self.type in Branche.TYPES_WITH_LENGTH:
Expand Down Expand Up @@ -342,7 +342,7 @@ def set_liste_elements_seuil_avec_coef_par_defaut(self, elements_seuil):

def decouper_seuil_elem(self, largeur, delta_z):
"""
Découper les éléments de seuil trop longs
Découper les éléments de seuil dépassant une certaine largeur
:param largeur: largeur maximale des éléments de seuil
:type largeur: float
Expand Down Expand Up @@ -431,7 +431,7 @@ def get_min_z(self):
return self.Zseuil

def validate(self):
"""Valider"""
"""Valider les données de la branche orifice"""
errors = super().validate()
if self.Largeur <= 0.0:
errors.append((self, "La largeur est nulle"))
Expand Down
7 changes: 5 additions & 2 deletions crue10/run/resultats_calcul.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ class ResCalcTrans:
"""
Métadonnées des résultats pour un calcul transitoire
XXX
:ivar name: nom du calcul transitoire
:vartype name: str
:ivar frame_list: liste des frames (tuple avec le temps et l'objet FilePosition)
:vartype frame_list: (float, FilePosition)
"""

def __init__(self, name):
Expand All @@ -141,7 +144,7 @@ def time_serie(self):
return np.array([frame[0] for frame in self.frame_list])

def __repr__(self):
return "Calcul non permanent #%s (%i temps)" % (self.name, len(self.frame_list))
return "Calcul transitoire #%s (%i temps)" % (self.name, len(self.frame_list))


class ResultatsCalcul:
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# -- Project information -----------------------------------------------------

project = 'Crue10_tools'
copyright = '2023, CNR-Engineering'
copyright = '2024, CNR-Engineering'
author = 'CNR-Engineering'


Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python
from setuptools import find_packages, setup

from crue10 import VERSION


Expand All @@ -13,6 +14,7 @@
author='Luc DURON',
author_email='[email protected]',
packages=find_packages(),
include_package_data=True, # includes all non `.py` files found inside package directory (see MANIFEST.in)
install_requires=requirements,
description='Librairie Python pour les formats de fichiers Crue10',
url='https://github.com/CNR-Engineering/crue10_tools',
Expand Down

0 comments on commit 04e6731

Please sign in to comment.