| |
- builtins.object
-
- libhydro.conv.xml._from_xml.Scenario
- libhydro.conv.xml._xml.Message
class Message(builtins.object) |
|
ClasseMessage.
Classe pour manipuler les messages Xml hydrometrie.
Proprietes:
scenario (xml.Scenario) = un objet Scenario obligatoire
intervenants (liste d'intervenant.Intervenant)
siteshydro (liste de sitehydro.Sitehydro)
sitesmeteo (liste de sitemeteo.Sitemeteo)
seuilshydro (liste de seuil.Seuilhydro)
modelesprevision (liste de modeleprevision.Modeleprevision)
evenements (liste de evenement.Evenement)
courbestarage (liste de courbetarage.CourbeTarage)
jaugeages (liste de jaugeage.Jaugeage)
courbescorrection (liste de courbecorrection.CourbeCorrection)
serieshydro (liste de obshydro.Serie)
seriesmeteo (liste de obsmeteo.Serie)
seriesobselab (liste de obselaboree.SerieObsElab)
simulations (liste de simulation.Simulation) |
|
Methods defined here:
- __init__(self, scenario, intervenants=None, siteshydro=None, sitesmeteo=None, seuilshydro=None, modelesprevision=None, evenements=None, courbestarage=None, jaugeages=None, courbescorrection=None, serieshydro=None, seriesmeteo=None, seriesobselab=None, simulations=None, strict=True)
- Initialisation.
Arguments:
scenario (xml.Scenario) = un objet Scenario obligatoire
intervenants (intervenant.Intervenant iterable ou None)
siteshydro (sitehydro.Sitehydro iterable ou None)
sitesmeteo (sitemeteo.Sitemeteo iterable ou None)
seuilshydro (seuil.Seuilhydro iterable ou None)
modelesprevision (modeleprevision.Modeleprevision iterable ou None)
evenements (evenement.Evenement iterable ou None)
courbestarage (courbetarage.CourbeTarage iterable ou None)
jaugeages (jaugeage.Jaugeage iterable ou None)
courbescorrection (courbecorrection.CourbeCorrection ou None)
serieshydro (obshydro.Serie iterable ou None)
seriesmeteo (obsmeteo.Serie iterable ou None)
seriesobselab (obselaboreehydro.SerieObsElab ou None)
simulations (simulation.Simulation iterable ou None)
strict (bool, defaut True) = le mode permissif permet de lever les
controles de validite des elements
- __str__(self)
- Return string representation from __unicode__ method.
- __unicode__(self)
- Return unicode representation.
- add(self, **kargs)
- Ajoute des elements au Message.
Les elements a ajouter doivent etre passes sous la forme:
Message.add(cle=valeur, ...)
avec les regles suivantes:
CLE PARMI / VALEUR
intervenants = iterable d'intervenant.Intervenant
siteshydro = iterable de sitehydro.Sitehydro
sitesmeteo = iterable de sitemeteo.Sitemeteo
seuilshydro = iterable de seuil.Seuilhydro
modelesprevision = iterable de modeleprevision.Modeleprevision
evenements = iterable d'evenement.Evenement
courbestarage = iterable de courbetarage.CourbeTarage
jaugeages = iterable de Jaugeage.Jaugeage
courbescorrection = iterable de courbecorrection.CourbeCorrection
serieshydro = iterable de obshydro.Serie
seriesmeteo = iterable de obsmeteo.Serie
seriesobselab = iterable de obselaboreehydro.SerieObsElab
simulations = iterable de simulation.Simulation
- show(self, bdhydro=False, ordered=False, pretty_print=False)
- Return a pretty print XML.
Arguments:
bdhydro (bool, defaut False) = utilise le format bdhydro
ordered (bool, defaut False) = si True essaie de conserver l'ordre
de certains elements
pretty_print (bool, defaut False) = option de debogage
- to_string(self, bdhydro=False, ordered=False)
- Return an unicode xml
- write(self, file, encoding='utf-8', compression=0, force=False, bdhydro=False, ordered=False, pretty_print=False)
- Ecrit le Message dans le fichier <file>.
Cette methode est un wrapper autour de lxml.etree.ElementTree.write.
Se referer a la documentation de lxml pour le detail des options.
Arguments:
file (str ou objet fichier) = fichier de destination
encoding (string, defaut utf-8) = encodage
compression (int de 0 a 9, defaut 0) = niveau de compression gzip
force (bool, defaut False) = ecrase un fichier deja existant
bdhydro (bool, defaut False) = utilise le format bdhydro
ordered (bool, defaut False) = si True essaie de conserver l'ordre
de certains elements
pretty_print (bool, defaut False) = option de debogage
Static methods defined here:
- from_file(src, ordered=False)
- Parse le fichier src et retourne un xml.Message.
Supprime les eventuels namespaces.
Arguments:
src (nom de fichier, url, objet fichier...) = source de donnee. Les
type de src acceptes sont ceux de lxml.etree.parse
ordered (bool, defaut False) = si True essaie de conserver l'ordre
de certains elements
- from_string(strxml, ordered=False)
- Parse le xml fournis sous forme de string et retourne un xml.Message.
Supprime les eventuels namespaces.
Arguments:
strxml (str(unicode) ou bytes) = source de donnee.
ordered (bool, defaut False) = si True essaie de conserver l'ordre
de certains elements
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- courbescorrection
- Class Rlistproperty
A descriptor to deal with a list of restricted items.
Raises a TypeError when value is not allowed.
Properties:
cls (class) = the type of the list items
required (bool, defaut True) = wether or not instance's value can
be None
default = a defautl value returned if the instance's value is not
in the dictionnary. Should be unused if the property has been
initialized.
data (weakref.WeakKeyDictionary)
- courbestarage
- Class Rlistproperty
A descriptor to deal with a list of restricted items.
Raises a TypeError when value is not allowed.
Properties:
cls (class) = the type of the list items
required (bool, defaut True) = wether or not instance's value can
be None
default = a defautl value returned if the instance's value is not
in the dictionnary. Should be unused if the property has been
initialized.
data (weakref.WeakKeyDictionary)
- evenements
- Class Rlistproperty
A descriptor to deal with a list of restricted items.
Raises a TypeError when value is not allowed.
Properties:
cls (class) = the type of the list items
required (bool, defaut True) = wether or not instance's value can
be None
default = a defautl value returned if the instance's value is not
in the dictionnary. Should be unused if the property has been
initialized.
data (weakref.WeakKeyDictionary)
- intervenants
- Class Rlistproperty
A descriptor to deal with a list of restricted items.
Raises a TypeError when value is not allowed.
Properties:
cls (class) = the type of the list items
required (bool, defaut True) = wether or not instance's value can
be None
default = a defautl value returned if the instance's value is not
in the dictionnary. Should be unused if the property has been
initialized.
data (weakref.WeakKeyDictionary)
- jaugeages
- Class Rlistproperty
A descriptor to deal with a list of restricted items.
Raises a TypeError when value is not allowed.
Properties:
cls (class) = the type of the list items
required (bool, defaut True) = wether or not instance's value can
be None
default = a defautl value returned if the instance's value is not
in the dictionnary. Should be unused if the property has been
initialized.
data (weakref.WeakKeyDictionary)
- modelesprevision
- Class Rlistproperty
A descriptor to deal with a list of restricted items.
Raises a TypeError when value is not allowed.
Properties:
cls (class) = the type of the list items
required (bool, defaut True) = wether or not instance's value can
be None
default = a defautl value returned if the instance's value is not
in the dictionnary. Should be unused if the property has been
initialized.
data (weakref.WeakKeyDictionary)
- scenario
- Return scenario.
- serieshydro
- Class Rlistproperty
A descriptor to deal with a list of restricted items.
Raises a TypeError when value is not allowed.
Properties:
cls (class) = the type of the list items
required (bool, defaut True) = wether or not instance's value can
be None
default = a defautl value returned if the instance's value is not
in the dictionnary. Should be unused if the property has been
initialized.
data (weakref.WeakKeyDictionary)
- seriesmeteo
- Class Rlistproperty
A descriptor to deal with a list of restricted items.
Raises a TypeError when value is not allowed.
Properties:
cls (class) = the type of the list items
required (bool, defaut True) = wether or not instance's value can
be None
default = a defautl value returned if the instance's value is not
in the dictionnary. Should be unused if the property has been
initialized.
data (weakref.WeakKeyDictionary)
- seriesobselab
- Class Rlistproperty
A descriptor to deal with a list of restricted items.
Raises a TypeError when value is not allowed.
Properties:
cls (class) = the type of the list items
required (bool, defaut True) = wether or not instance's value can
be None
default = a defautl value returned if the instance's value is not
in the dictionnary. Should be unused if the property has been
initialized.
data (weakref.WeakKeyDictionary)
- seuilshydro
- Class Rlistproperty
A descriptor to deal with a list of restricted items.
Raises a TypeError when value is not allowed.
Properties:
cls (class) = the type of the list items
required (bool, defaut True) = wether or not instance's value can
be None
default = a defautl value returned if the instance's value is not
in the dictionnary. Should be unused if the property has been
initialized.
data (weakref.WeakKeyDictionary)
- simulations
- Class Rlistproperty
A descriptor to deal with a list of restricted items.
Raises a TypeError when value is not allowed.
Properties:
cls (class) = the type of the list items
required (bool, defaut True) = wether or not instance's value can
be None
default = a defautl value returned if the instance's value is not
in the dictionnary. Should be unused if the property has been
initialized.
data (weakref.WeakKeyDictionary)
- siteshydro
- Class Rlistproperty
A descriptor to deal with a list of restricted items.
Raises a TypeError when value is not allowed.
Properties:
cls (class) = the type of the list items
required (bool, defaut True) = wether or not instance's value can
be None
default = a defautl value returned if the instance's value is not
in the dictionnary. Should be unused if the property has been
initialized.
data (weakref.WeakKeyDictionary)
- sitesmeteo
- Class Rlistproperty
A descriptor to deal with a list of restricted items.
Raises a TypeError when value is not allowed.
Properties:
cls (class) = the type of the list items
required (bool, defaut True) = wether or not instance's value can
be None
default = a defautl value returned if the instance's value is not
in the dictionnary. Should be unused if the property has been
initialized.
data (weakref.WeakKeyDictionary)
|
class Scenario(builtins.object) |
|
Classe Scenario.
Classe pour manipuler les scenarios des messages SANDRE.
Proprietes:
code = hydrometrie
version = 1.1
nom = 'Echange de donnees hydrometriques'
dtprod (datetime.datetime) = date de production
emetteur.intervenant (intervenant.Intervenant)
emetteur.contact (Intervenant.Contact ou None)
destinataire.intervenant (intervenant.Intervenant)
destinataire.contact (Intervenant.Contact ou None)
Emetteur et destinataire sont des collections.namedtuple et ne peuvent
etre modifies que via la methode _replace(). |
|
Methods defined here:
- __init__(self, emetteur, destinataire, dtprod=None)
- Constructeur.
Arguments:
emetteur (intervenant.Intervenant ou Contact) = si un contact
est utilise, sa propriete Intervenant doit etre renseignee
destinataire (intervenant.Intervenant ou Contact) = si un contact
est utilise, sa propriete Intervenant doit etre renseignee
dtprod (numpy.datetime64 string, datetime.datetime...,
defaut utcnow()) = date de production
- __str__(self)
- Return string representation from __unicode__ method.
- __unicode__(self)
- Return unicode representation.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- destinataire
- Return message destinataire.
- dtprod
- Class Datefromeverything.
A descriptor to store a datetime.datetime property that can be initiated
in different manners using numpy.datetime64 facilities.
- emetteur
- Return message emetteur.
Data and other attributes defined here:
- code = 'hydrometrie'
- nom = 'Echange de données hydrométriques'
- version = '1.1'
| |