-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Script d'export d'une table de correspondance entre les entiers 32bits du graphe de mosaiquage et les noms d'OPI | ||
""" | ||
import os | ||
import argparse | ||
import json | ||
|
||
|
||
def read_args(): | ||
"""Gestion des arguments""" | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-i", "--input", required=True, help="input overview") | ||
parser.add_argument( | ||
"-o", "--output", required=True, help="output CSV file" | ||
) | ||
return parser.parse_args() | ||
|
||
args = read_args() | ||
|
||
fileOverviews = open(args.input) | ||
overviews = json.load(fileOverviews) | ||
fileOverviews.close() | ||
|
||
with open(args.output, 'w') as out: | ||
for opi in overviews['list_OPI']: | ||
colors = overviews['list_OPI'][opi] | ||
out.write(opi + ';' + str(colors[0] + 256 * (colors[1] + 256 * colors[2])) + '\n') | ||
|