Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Commandre Benjamin
TELIS
Commits
e3abb29a
Commit
e3abb29a
authored
Jun 06, 2019
by
Commandre Benjamin
Browse files
Ajout doc pour le fichier de config, possibilité de télécharger les archives
parent
aba26126
Changes
4
Show whitespace changes
Inline
Side-by-side
app/Archive.py
View file @
e3abb29a
...
...
@@ -261,7 +261,7 @@ class Archive():
self
.
logger
.
info
(
"{0} image(s) correspondent aux critères."
.
format
(
len
(
self
.
liste_archive
)))
def
download_auto
(
self
,
identifiant
,
mdp
,
proxy
=
""
):
def
download_auto
(
self
,
identifiant
,
mdp
,
proxy
=
""
,
extraction
=
True
):
"""
Méthode pour télécharger les archives sur le site Theia.
...
...
@@ -380,10 +380,17 @@ class Archive():
self
.
logger
.
debug
(
"url : {}"
.
format
(
url
))
# Requête pour récupérer l'archive
reponse
=
requests
.
get
(
url
,
headers
=
head
,
proxies
=
proxyDict
)
if
extraction
:
# Ajout de l'archive à la liste
liste_content
.
append
(
reponse
.
content
)
del
reponse
else
:
dossier
=
"{0}/{1}/Images"
.
format
(
self
.
dossier_sortie
,
cle
[:
4
])
with
open
(
"{0}/{1}"
.
format
(
dossier
,
img
[
1
].
split
(
"/"
)[
-
1
]),
"wb"
)
as
fichier
:
fichier
.
write
(
reponse
.
content
)
if
extraction
:
# Traitement des images (fusion, découpage selon la zone d'étude ...)
self
.
traitement_images
(
cle
,
liste_content
)
del
liste_content
...
...
app/Processing.py
View file @
e3abb29a
...
...
@@ -30,7 +30,7 @@ class Processing(object):
self
.
check_download
=
Archive
.
Archive
(
self
.
capteur
,
self
.
bandes
,
self
.
niveau
,
self
.
emprise
,
self
.
zone_etude
,
\
self
.
resultats
,
self
.
annee_debut
,
int
(
self
.
annee_fin
),
self
.
seuil_nuage
)
self
.
check_download
.
listing
()
self
.
check_download
.
download_auto
(
self
.
id
,
self
.
mdp
,
self
.
proxy
)
self
.
check_download
.
download_auto
(
self
.
id
,
self
.
mdp
,
self
.
proxy
,
extraction
=
self
.
extraction
)
self
.
liste_dossier
=
dict
()
...
...
config.ini
View file @
e3abb29a
[donnees]
# chemin/vers/shapefile/emprise
chemin_emprise
=
# chemin/vers/shapefile/zone_etude
# Si vide, zone d'étude = emprise
chemin_zone_etude
=
# Année à partir de laquelle les images ont été prises
annee_debut
=
# Année limite d'acquisition des images
# Si vide, l'année de fin correspond à l'année actuelle
annee_fin
=
# Pourcentage maximal d'ennuagement
seuil_nuage
=
5.0
[sortie]
# chemin/dossier/resultats
chemin
=
# Vrai si extraction des images des archives, faux si téléchagement de celles-ci
extraction
=
True
[theia]
# Identifiant Theia-land
identifiant
=
# Mot de passe Theia-land
mdp
=
# Proxy de connection si nécessaire
proxy
=
[satellite]
capteur
=
processingLevel=
bandes
=
\ No newline at end of file
# Type du satellite source
# Possibilités :- SENTINEL2
# - LANDSAT8
capteur
=
SENTINEL2
# Niveau de traitement des images satellites
# Possibilités :- LEVEL2A (Acquisition standard)
# - LEVEL3A (Synthèse mensuelle)
processingLevel
=
LEVEL2A
# Bandes d'intêrets
# Possibilités :- RGB (Bandes Rouge, Verte, Bleue)
# - RGBI (Bandes Rouge, Verte, Bleue + Proche Infra-rouge)
bandes
=
RGB
main.py
View file @
e3abb29a
...
...
@@ -10,6 +10,9 @@ from app.Processing import Processing
import
app.Constantes
as
Constantes
import
app.Outils
as
Outils
def
str2bool
(
v
):
return
v
.
lower
()
in
([
"false"
])
class
Telechargement
(
Processing
):
def
__init__
(
self
,
parent
=
None
):
...
...
@@ -36,6 +39,14 @@ class Telechargement(Processing):
self
.
niveau
=
"{}"
.
format
(
configfile
[
"satellite"
][
"processingLevel"
])
self
.
bandes
=
"{}"
.
format
(
configfile
[
"satellite"
][
"bandes"
])
try
:
if
str2bool
(
"{}"
.
format
(
configfile
[
"sortie"
][
"extraction"
])):
self
.
extraction
=
False
else
:
self
.
extraction
=
True
except
:
self
.
extraction
=
True
# Date de début et de fin de la recherche
try
:
self
.
annee_debut
=
int
(
"{}"
.
format
(
configfile
[
"donnees"
][
"annee_debut"
]))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment