Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
IPSL
E
ESPRI
ESPRI-Mod
catalog
Commits
5d5df3f1
Commit
5d5df3f1
authored
Jan 18, 2022
by
TROUSSELLIER Laurent
Browse files
Ajout possibilite a partir de gran = 'project'
parent
3e9ceae9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
22 deletions
+10
-22
ScriptCiclad.py
ScriptCiclad.py
+10
-22
No files found.
ScriptCiclad.py
View file @
5d5df3f1
...
...
@@ -272,30 +272,18 @@ class GuillaumeIdea(): # 1 worker / fichier
## nameCat = project+"_"+nameCat[:-1]+".csv"
## pathCat = os.path.join(dirCat,nameCat)
## ### OU BIEN EN one liner =>
pathCat
=
os
.
path
.
join
(
rootDirCat
,
project
,
"_"
.
join
([
facets
[
drs
.
dir_keys
[
i
]]
for
i
in
range
(
drs
.
dir_keys
.
index
(
str
(
gran
))
+
1
)])
+
".csv"
)
#print(pathCat,nameCat, "path : ",pathCat)
##########################
# On a toute les infos ...
# Append avec lock
##########################
#ft3 = time.time()
#print("3:",ft3-ft2)
# NOTE : Python 3.7> pour 'garantir' l'ordonancement du dict : https://stackoverflow.com/questions/39980323/are-dictionaries-ordered-in-python-3-6
## data = pathFromCiclad+","+project+","
## for _,v in facets.items():
## #print(k,v)
## data = data + str(v) +","
## data = data + flagLatest
pathCat
=
""
if
(
gran
==
"project"
):
pathCat
=
os
.
path
.
join
(
rootDirCat
,
project
,
project
+
".csv"
)
else
:
pathCat
=
os
.
path
.
join
(
rootDirCat
,
project
,
"_"
.
join
([
facets
[
drs
.
dir_keys
[
i
]]
for
i
in
range
(
drs
.
dir_keys
.
index
(
str
(
gran
))
+
1
)])
+
".csv"
)
data
=
os
.
path
.
join
(
"/bdd"
,
Path
(
path
))
+
","
+
project
+
","
+
","
.
join
(
facets
.
values
())
+
","
+
flagLatest
#print(data)
#print(data)
lock
=
LockFile
(
pathCat
)
#print(pathCat)
with
lock
:
# A TESTER : si il existe ? osef .. sinon on le cree AVEC entete ...
with
open
(
pathCat
,
'a+'
)
as
f
:
#print("ON APPEND:", data)
f
.
write
(
data
+
"
\n
"
)
...
...
@@ -446,7 +434,7 @@ def main():
#file = open(pathDesFichiers, 'r')
#lines = file.readlines()
#print("Done")
tempNb
=
2000
0
tempNb
=
2000
i
=
0
with
open
(
pathDesFichiers
)
as
fp
:
for
path
in
fp
:
...
...
@@ -504,7 +492,7 @@ def prependCSVAndjsonCreation(rootDirCat,project):
pattern
=
os
.
path
.
join
(
Path
(
rootDirCat
,
project
),
'*.csv'
)
#print(pattern)
for
path
in
iglob
(
pattern
):
#
print(path)
print
(
path
)
line_prepender
(
path
,
header
)
where
=
rootDirCat
+
project
SaveJSON
(
path
.
split
(
"/"
)[
-
1
],
where
,
header
)
...
...
@@ -565,8 +553,8 @@ if __name__ == "__main__":
print
(
"Main de Base"
)
main
()
print
(
"Main Avec creation des csv ET JSON avec le premier worker "
)
mainAtefIdea
()
#
print("Main Avec creation des csv ET JSON avec le premier worker ")
#
mainAtefIdea()
# print("Test")
#protoYAML()
pass
...
...
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