Changes between Initial Version and Version 1 of GroupActivities/Meetings/Retreat20151119/Coding


Ignore:
Timestamp:
2015-11-10T13:54:06+01:00 (8 years ago)
Author:
ajornet
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GroupActivities/Meetings/Retreat20151119/Coding

    v1 v1  
     1In order to give you some help you can use those commands and/or scripts: 
     2 
     3In our case: 
     4 
     51. File sechiba.f90: 
     6 
     7 
     8How to get info for column '''field id''': 
     9 
     10{{{ 
     11cat src_sechiba/sechiba.f90 | grep xios_orchidee_send_field | cut -d\" -f2 > fields_id.txt 
     12}}} 
     13 
     142. At src_xml/file_def_orchidee.xml 
     15 
     16Python script to extract the columns showned below: 
     17 
     18{{{ 
     19# def xml file  
     20with open('field_def_orchidee_sechiba.xml', 'r') as content_file: 
     21    data = content_file.readlines() 
     22 
     23# contains all ids to search 
     24with open('fields_id.txt', 'r') as cfile: 
     25    fids= cfile.readlines() 
     26 
     27# search for all keys 
     28for idf in fids: 
     29    cleanid =  idf.replace('\n','') 
     30 
     31    # search for all lines from xml 
     32    for line in data: 
     33        # split lines into array according to " char 
     34        splt = line.split('"') 
     35 
     36        # ignore empty lines or those with 1 element 
     37        if splt is None or len(splt) == 1: 
     38            continue 
     39        # replace return carry to nothing 
     40        lineid = line.split('"')[1].replace('\n','') 
     41 
     42        # it is mandatory to get the exact match 
     43        if cleanid == lineid: 
     44            # print on screen 
     45            print line.split('"')[NUMBER_TO_CHANGE] 
     46}}} 
     47 
     48Regarding line:  
     49{{{ 
     50print line.split('"')[NUMBER_TO_CHANGE] 
     51}}} 
     52 
     53'''Replace NUMBER_TO_CHANGE according to those numbers to get the desired colum info''': 
     54* use 3, Output name set in field_def 
     55* use 5, Long name 
     56* use 7, Unit in output 
     57 
     58For field_def_orchidee_sechiba.xml, it was modified deleting all those non sechiba keys in order to minimize errors. Modify according to your needs. 
     59 
     60Once extracted, you can directly paste data into excel page.