Commit c6916817e8524013b01c28103b0a56159efff64a
1 parent
708ed8e6
Exists in
master
Add 'list' option to the python script.
Showing
1 changed file
with
8 additions
and
2 deletions
Show diff stats
src/main/resources/scripts/get_epncore_parameters.py
... | ... | @@ -7,7 +7,8 @@ from re import sub |
7 | 7 | """ |
8 | 8 | This script parse the Parameters table on the EpnTAPv2 VO-Paris Confluence page |
9 | 9 | (voparis-confluence.obspm.fr) and print them in several ways (by setting EXPORT_TYPE): |
10 | -- CSV: A simple CSV table whicj have the same content as the Confluence table; | |
10 | +- list: A python list; | |
11 | +- CSV: A simple CSV table which have the same content as the Confluence table; | |
11 | 12 | example: `"incidence_min";"";"incidence_min";"Double";"deg";"Min incidence angle (solar zenithal angle)";"pos.posAng;stat.min";"";"N"` |
12 | 13 | - init: A Java code for parameters initalisation, in camelCase |
13 | 14 | example: `public double incidenceMin;` |
... | ... | @@ -15,7 +16,7 @@ This script parse the Parameters table on the EpnTAPv2 VO-Paris Confluence page |
15 | 16 | example: `INCIDENCE_MIN("incidence_min", class.Double, false, false, "deg", "pos.posAng;stat.min", "Min incidence angle (solar zenithal angle)"),` |
16 | 17 | """ |
17 | 18 | |
18 | -EXPORT_TYPE = 'init' # 'CSV', or 'init', or 'enum'. | |
19 | +EXPORT_TYPE = 'list' # 'list', 'CSV', or 'init', or 'enum'. | |
19 | 20 | URL = 'https://voparis-confluence.obspm.fr/display/VES/EPN-TAP+V2.0+parameters' |
20 | 21 | |
21 | 22 | tmp_file, headers = urllib.request.urlretrieve(URL) |
... | ... | @@ -38,6 +39,11 @@ for tr in table: |
38 | 39 | continue |
39 | 40 | row.append('N' if mandatory else 'Y') |
40 | 41 | |
42 | + if EXPORT_TYPE == 'list': | |
43 | + var_type = row[3].lower().replace('double', 'double precision') | |
44 | + print("('%s', '%s', '%s', %s, %s, '%s', '%s')," | |
45 | + % (row[0], var_type, row[6], 'True' if mandatory else 'False', \ | |
46 | + 'True' if row[1]=='Y' else 'False', row[4], row[5])) | |
41 | 47 | if EXPORT_TYPE == 'CSV': |
42 | 48 | print('"' + '";"'.join(row) + '"') |
43 | 49 | elif EXPORT_TYPE == 'init': | ... | ... |