Public Member Functions | |
def | __init__ |
def | createXML |
def | fillNode |
def | today |
Public Attributes | |
entryId | |
title | |
parameters | |
dataCenter | |
summary | |
sensor | |
source | |
origin | |
creationDate | |
startTime | |
endTime | |
category | |
subcategory | |
commandLine | |
doc | |
nodes | |
Static Public Attributes | |
string | SENSOR_DAYABAY = 'DAYABAY > The Entire DayaBay Experiment' |
string | SENSOR_DB = 'DAYABAY-DB > The DayaBay (near) Hall of DayaBay Experiment' |
string | SENSOR_LA = 'DAYABAY-LA > The Ling Ao Hall of the DayaBay Experiment' |
string | SENSOR_FH = 'DAYABAY-FH > The Far Hall of the DayaBay Experiment' |
string | SENSOR_SAB = 'DAYABAY-SAB > The Surface Assembly Building of the DayaBay Experiment' |
string | DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S' |
tuple | ROOT = (0, 0) |
tuple | DIF = (1, 0) |
tuple | PLUS = (1, DIF[1] + 1) |
tuple | ENTRY_ID = (2, 0) |
tuple | ENTRY_TITLE = (2, ENTRY_ID[1] + 1) |
tuple | PARAMETERS = (2, ENTRY_TITLE[1] + 1) |
tuple | ISO_TOPIC = (2, PARAMETERS[1] + 1) |
tuple | DATA_CENTER = (2, ISO_TOPIC[1] + 1) |
tuple | SUMMARY = (2, DATA_CENTER[1] + 1) |
tuple | META_NAME = (2, SUMMARY[1] + 1) |
tuple | META_VERS = (2, META_NAME[1] + 1) |
tuple | SENSOR = (2, META_VERS[1] + 1) |
tuple | SOURCE = (2, SENSOR[1] + 1) |
tuple | ORIGIN = (2, SOURCE[1] + 1) |
tuple | CREATION = (2, ORIGIN[1] + 1) |
tuple | START_TIME = (2, CREATION[1] + 1) |
tuple | END_TIME = (2, START_TIME[1] + 1) |
tuple | CATEGORY = (2, END_TIME[1] + 1) |
tuple | SUB_CATEGORY = (2, CATEGORY[1] + 1) |
tuple | COMMAND_LINE = (2, SUB_CATEGORY[1] + 1) |
tuple | DATA_CENTER_NAME = (3, 0) |
tuple | DC_PERSONNEL = (3, DATA_CENTER_NAME[1] + 1) |
tuple | DC_ROLE = (4, 0) |
tuple | DC_CONTACT = (4, DC_ROLE[1] + 1) |
list | ELEMENTS |
Definition at line 1 of file Metadata.py.
def SpadeSvc::Metadata::Metadata::__init__ | ( | self, | ||
fileId | ||||
) |
Definition at line 64 of file Metadata.py.
00065 : 00066 import socket 00067 host = socket.gethostname() 00068 from time import gmtime 00069 self.entryId = fileId 00070 self.title = 'title' 00071 self.parameters = 'PARTICLE PHYSICS > Neutrinos > Mixing' 00072 if host.endswith('.cn'): 00073 self.dataCenter = {'name':'IHEP/BEIJING > Institute of High Energy Physics, Beijing, China'} 00074 else: 00075 self.dataCenter = {'name':'DOE/LBNL > Lawrence Berkeley National Laboratory, U. S. Department of Energy'} 00076 self.summary = 'My Summary' 00077 self.sensor = self.SENSOR_DAYABAY 00078 self.source = 'SIMULATION > Data which are numerically generated' 00079 self.origin = host 00080 self.creationDate = None 00081 self.startTime = gmtime(0) 00082 self.endTime = gmtime(0) 00083 self.category = 'calibration' 00084 self.subcategory = 'unset' 00085 self.commandLine = '' 00086 00087 def createXML(self):
def SpadeSvc::Metadata::Metadata::createXML | ( | self | ) |
Definition at line 88 of file Metadata.py.
00088 : 00089 # Create the minidom document 00090 from xml.dom.minidom import Document 00091 self.doc = Document() 00092 dif_plus = self.doc.createElement('DIF_Plus') 00093 dif_plus.setAttribute('xmlns:xsi', 00094 'http://www.w3.org/2001/XMLSchema-instance') 00095 dif_plus.setAttribute('xsi:noNamespaceSchemaLocation', 00096 'http://dayabay.lbl.gov/xml/spade/v0.1/DybMetadata.xsd') 00097 self.doc.appendChild(dif_plus) 00098 00099 self.nodes = [[dif_plus], 00100 [], 00101 [], 00102 [], 00103 []] 00104 00105 from time import strftime 00106 for depth in range (1, len(self.nodes)): 00107 for e in range(0, len(self.ELEMENTS[depth])): 00108 self.nodes[depth].append(self.doc.createElement(self.ELEMENTS[depth][e][0])) 00109 self.nodes[depth - 1][self.ELEMENTS[depth][e][1]].appendChild(self.nodes[depth][e]) 00110 self.fillNode(self.ENTRY_ID, 00111 self.entryId) 00112 self.fillNode(self.ENTRY_TITLE, 00113 self.title) 00114 self.fillNode(self.PARAMETERS, 00115 self.parameters) 00116 self.fillNode(self.ISO_TOPIC, 00117 'Geoscientific Information') 00118 self.fillNode(self.DATA_CENTER_NAME, 00119 self.dataCenter['name']) 00120 self.fillNode(self.DC_ROLE, 00121 'Data Center Contact') 00122 self.fillNode(self.SUMMARY, 00123 self.summary) 00124 self.fillNode(self.META_NAME, 00125 'DIF') 00126 self.fillNode(self.META_VERS, 00127 '9.7.1') 00128 self.fillNode(self.SENSOR, 00129 self.sensor) 00130 self.fillNode(self.SOURCE, 00131 self.source) 00132 self.fillNode(self.ORIGIN, 00133 self.origin) 00134 if (None == self.creationDate): 00135 self.creationDate = self.today() 00136 self.fillNode(self.CREATION, 00137 self.creationDate) 00138 self.fillNode(self.START_TIME, 00139 strftime(self.DATETIME_FORMAT, 00140 self.startTime)) 00141 self.fillNode(self.END_TIME, 00142 strftime(self.DATETIME_FORMAT, 00143 self.endTime)) 00144 self.fillNode(self.CATEGORY, 00145 self.category) 00146 self.fillNode(self.SUB_CATEGORY, 00147 self.subcategory) 00148 self.fillNode(self.COMMAND_LINE, 00149 self.commandLine) 00150 return self.doc 00151 00152 def fillNode(self,
def SpadeSvc::Metadata::Metadata::fillNode | ( | self, | ||
element, | ||||
text | ||||
) |
Definition at line 153 of file Metadata.py.
00155 : 00156 self.nodes[element[0]][element[1]].appendChild(self.doc.createTextNode(text)) 00157 00158 def today(self):
def SpadeSvc::Metadata::Metadata::today | ( | self | ) |
Definition at line 159 of file Metadata.py.
00159 : 00160 from time import gmtime, strftime 00161 return strftime('%Y-%m-%d', 00162 gmtime()) 00163 if __name__ == '__main__' :
string SpadeSvc::Metadata::Metadata::SENSOR_DAYABAY = 'DAYABAY > The Entire DayaBay Experiment' [static] |
Definition at line 4 of file Metadata.py.
string SpadeSvc::Metadata::Metadata::SENSOR_DB = 'DAYABAY-DB > The DayaBay (near) Hall of DayaBay Experiment' [static] |
Definition at line 5 of file Metadata.py.
string SpadeSvc::Metadata::Metadata::SENSOR_LA = 'DAYABAY-LA > The Ling Ao Hall of the DayaBay Experiment' [static] |
Definition at line 6 of file Metadata.py.
string SpadeSvc::Metadata::Metadata::SENSOR_FH = 'DAYABAY-FH > The Far Hall of the DayaBay Experiment' [static] |
Definition at line 7 of file Metadata.py.
string SpadeSvc::Metadata::Metadata::SENSOR_SAB = 'DAYABAY-SAB > The Surface Assembly Building of the DayaBay Experiment' [static] |
Definition at line 8 of file Metadata.py.
string SpadeSvc::Metadata::Metadata::DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S' [static] |
Definition at line 10 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::ROOT = (0, 0) [static] |
Definition at line 13 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::DIF = (1, 0) [static] |
Definition at line 14 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::PLUS = (1, DIF[1] + 1) [static] |
Definition at line 15 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::ENTRY_ID = (2, 0) [static] |
Definition at line 16 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::ENTRY_TITLE = (2, ENTRY_ID[1] + 1) [static] |
Definition at line 17 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::PARAMETERS = (2, ENTRY_TITLE[1] + 1) [static] |
Definition at line 18 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::ISO_TOPIC = (2, PARAMETERS[1] + 1) [static] |
Definition at line 19 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::DATA_CENTER = (2, ISO_TOPIC[1] + 1) [static] |
Definition at line 20 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::SUMMARY = (2, DATA_CENTER[1] + 1) [static] |
Definition at line 21 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::META_NAME = (2, SUMMARY[1] + 1) [static] |
Definition at line 22 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::META_VERS = (2, META_NAME[1] + 1) [static] |
Definition at line 23 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::SENSOR = (2, META_VERS[1] + 1) [static] |
Definition at line 24 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::SOURCE = (2, SENSOR[1] + 1) [static] |
Definition at line 25 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::ORIGIN = (2, SOURCE[1] + 1) [static] |
Definition at line 26 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::CREATION = (2, ORIGIN[1] + 1) [static] |
Definition at line 27 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::START_TIME = (2, CREATION[1] + 1) [static] |
Definition at line 28 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::END_TIME = (2, START_TIME[1] + 1) [static] |
Definition at line 29 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::CATEGORY = (2, END_TIME[1] + 1) [static] |
Definition at line 30 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::SUB_CATEGORY = (2, CATEGORY[1] + 1) [static] |
Definition at line 31 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::COMMAND_LINE = (2, SUB_CATEGORY[1] + 1) [static] |
Definition at line 32 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::DATA_CENTER_NAME = (3, 0) [static] |
Definition at line 33 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::DC_PERSONNEL = (3, DATA_CENTER_NAME[1] + 1) [static] |
Definition at line 34 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::DC_ROLE = (4, 0) [static] |
Definition at line 35 of file Metadata.py.
tuple SpadeSvc::Metadata::Metadata::DC_CONTACT = (4, DC_ROLE[1] + 1) [static] |
Definition at line 36 of file Metadata.py.
list SpadeSvc::Metadata::Metadata::ELEMENTS [static] |
Initial value:
['', [('DIF', ROOT[1]), ('Plus', ROOT[1])], [('Entry_ID', DIF[1]), ('Entry_Title', DIF[1]), ('Parameters', DIF[1]), ('ISO_Topic_Category', DIF[1]), ('Data_Center', DIF[1]), ('Summary', DIF[1]), ('Metadata_Name', DIF[1]), ('Metadata_Version', DIF[1]), ('Sensor_Name', DIF[1]), ('Source_Name', DIF[1]), ('Originating_Center', DIF[1]), ('DIF_Creation_Date', DIF[1]), ('Start_DateTime', PLUS[1]), ('End_DateTime', PLUS[1]), ('Category', PLUS[1]), ('Subcategory', PLUS[1]), ('Command_Line', PLUS[1])], [('Data_Center_Name', DATA_CENTER[1]), ('Personnel', DATA_CENTER[1])], [('Role', DC_PERSONNEL[1]), ('Contact_Address', DC_PERSONNEL[1])]]
Definition at line 38 of file Metadata.py.
Definition at line 68 of file Metadata.py.
Definition at line 69 of file Metadata.py.
Definition at line 70 of file Metadata.py.
Definition at line 72 of file Metadata.py.
Definition at line 75 of file Metadata.py.
Definition at line 76 of file Metadata.py.
Definition at line 77 of file Metadata.py.
Definition at line 78 of file Metadata.py.
Definition at line 79 of file Metadata.py.
Definition at line 80 of file Metadata.py.
Definition at line 81 of file Metadata.py.
Definition at line 82 of file Metadata.py.
Definition at line 83 of file Metadata.py.
Definition at line 84 of file Metadata.py.
Definition at line 91 of file Metadata.py.
Definition at line 99 of file Metadata.py.