/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes | Static Public Attributes
SpadeSvc::Metadata::Metadata Class Reference

List of all members.

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'
dictionary SENSOR_HALL
string DATA_CENTER_IHEP = 'IHEP/BEIJING > Institute of High Energy Physics, Beijing, China'
string DATA_CENTER_PDSF = 'DOE/LBNL > Lawrence Berkeley National Laboratory, U. S. Department of Energy'
string SOURCE_EXPERIMENT = 'EXPERIMENTAL > Data with an instrumentation based source'
string SOURCE_SIMULATION = 'SIMULATION > Data which are numerically generated'
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

Detailed Description

Definition at line 1 of file Metadata.py.


Constructor & Destructor Documentation

def SpadeSvc::Metadata::Metadata::__init__ (   self,
  fileId 
)

Definition at line 75 of file Metadata.py.

00077                         :
00078         import socket
00079         host = socket.gethostname()
00080         from time import gmtime
00081         self.entryId = fileId
00082         self.title = 'title'
00083         self.parameters = 'PARTICLE PHYSICS > Neutrinos > Mixing'
00084         if host.endswith('.cn'):
00085             self.dataCenter = {'name':self.DATA_CENTER_IHEP}
00086         else:
00087             self.dataCenter = {'name':self.DATA_CENTER_PDSF}
00088         self.summary = 'My Summary'
00089         self.sensor = self.SENSOR_DAYABAY
00090         self.source = self.SOURCE_SIMULATION
00091         self.origin = host
00092         self.creationDate = None
00093         self.startTime = gmtime(0)
00094         self.endTime = gmtime(0)
00095         self.category = 'calibration'
00096         self.subcategory = 'unset'
00097         self.commandLine = ''
00098 


Member Function Documentation

def SpadeSvc::Metadata::Metadata::createXML (   self)

Definition at line 99 of file Metadata.py.

00100                        :
00101         # Create the minidom document
00102         from xml.dom.minidom import Document
00103         self.doc = Document()
00104         dif_plus = self.doc.createElement('DIF_Plus')
00105         dif_plus.setAttribute('xmlns:xsi',
00106                               'http://www.w3.org/2001/XMLSchema-instance')
00107         dif_plus.setAttribute('xsi:noNamespaceSchemaLocation',
00108                               '../xml/spade/v0.3/DybMetadata.xsd')
00109         self.doc.appendChild(dif_plus)
00110 
00111         self.nodes = [[dif_plus],
00112                  [],
00113                  [],
00114                  [],
00115                  []]
00116 
00117         from time import strftime
00118         for depth in range (1, len(self.nodes)):
00119             for e in range(0, len(self.ELEMENTS[depth])):
00120                 self.nodes[depth].append(self.doc.createElement(self.ELEMENTS[depth][e][0]))
00121                 self.nodes[depth - 1][self.ELEMENTS[depth][e][1]].appendChild(self.nodes[depth][e])
00122         self.fillNode(self.ENTRY_ID,
00123                       self.entryId)        
00124         self.fillNode(self.ENTRY_TITLE,
00125                       self.title)
00126         self.fillNode(self.PARAMETERS,
00127                       self.parameters)
00128         self.fillNode(self.ISO_TOPIC,
00129                       'Geoscientific Information')
00130         self.fillNode(self.DATA_CENTER_NAME,
00131                       self.dataCenter['name'])
00132         self.fillNode(self.DC_ROLE,
00133                       'Data Center Contact')
00134         self.fillNode(self.SUMMARY,
00135                       self.summary)
00136         self.fillNode(self.META_NAME,
00137                       'DIF')
00138         self.fillNode(self.META_VERS,
00139                       '9.7.1')
00140         self.fillNode(self.SENSOR,
00141                       self.sensor)
00142         self.fillNode(self.SOURCE,
00143                       self.source)
00144         self.fillNode(self.ORIGIN,
00145                       self.origin)
00146         if (None == self.creationDate):
00147             self.creationDate = self.today()
00148         self.fillNode(self.CREATION,
00149                       self.creationDate)
00150         self.fillNode(self.START_TIME,
00151                       strftime(self.DATETIME_FORMAT,
00152                                self.startTime))
00153         self.fillNode(self.END_TIME,
00154                       strftime(self.DATETIME_FORMAT,
00155                                self.endTime))
00156         self.fillNode(self.CATEGORY,
00157                       self.category)
00158         self.fillNode(self.SUB_CATEGORY,
00159                       self.subcategory)
00160         self.fillNode(self.COMMAND_LINE,
00161                       self.commandLine)
00162         return self.doc
00163         

def SpadeSvc::Metadata::Metadata::fillNode (   self,
  element,
  text 
)

Definition at line 164 of file Metadata.py.

00167                       :
00168         self.nodes[element[0]][element[1]].appendChild(self.doc.createTextNode(text))    
00169 

def SpadeSvc::Metadata::Metadata::today (   self)

Definition at line 170 of file Metadata.py.

00171                    :
00172         from time import gmtime, strftime
00173         return strftime('%Y-%m-%d',
00174                         gmtime())


Member Data Documentation

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.

Initial value:
{'ALL':SENSOR_DAYABAY,
                   'EH1':SENSOR_DB,
                   'EH2':SENSOR_LA,
                   'EH3':SENSOR_FH,
                   'SAB':SENSOR_SAB}

Definition at line 9 of file Metadata.py.

string SpadeSvc::Metadata::Metadata::DATA_CENTER_IHEP = 'IHEP/BEIJING > Institute of High Energy Physics, Beijing, China' [static]

Definition at line 15 of file Metadata.py.

string SpadeSvc::Metadata::Metadata::DATA_CENTER_PDSF = 'DOE/LBNL > Lawrence Berkeley National Laboratory, U. S. Department of Energy' [static]

Definition at line 16 of file Metadata.py.

string SpadeSvc::Metadata::Metadata::SOURCE_EXPERIMENT = 'EXPERIMENTAL > Data with an instrumentation based source' [static]

Definition at line 18 of file Metadata.py.

string SpadeSvc::Metadata::Metadata::SOURCE_SIMULATION = 'SIMULATION > Data which are numerically generated' [static]

Definition at line 19 of file Metadata.py.

string SpadeSvc::Metadata::Metadata::DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S' [static]

Definition at line 21 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::ROOT = (0, 0) [static]

Definition at line 24 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::DIF = (1, 0) [static]

Definition at line 25 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::PLUS = (1, DIF[1] + 1) [static]

Definition at line 26 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::ENTRY_ID = (2, 0) [static]

Definition at line 27 of file Metadata.py.

Definition at line 28 of file Metadata.py.

Definition at line 29 of file Metadata.py.

Definition at line 30 of file Metadata.py.

Definition at line 31 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::SUMMARY = (2, DATA_CENTER[1] + 1) [static]

Definition at line 32 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::META_NAME = (2, SUMMARY[1] + 1) [static]

Definition at line 33 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::META_VERS = (2, META_NAME[1] + 1) [static]

Definition at line 34 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::SENSOR = (2, META_VERS[1] + 1) [static]

Definition at line 35 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::SOURCE = (2, SENSOR[1] + 1) [static]

Definition at line 36 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::ORIGIN = (2, SOURCE[1] + 1) [static]

Definition at line 37 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::CREATION = (2, ORIGIN[1] + 1) [static]

Definition at line 38 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::START_TIME = (2, CREATION[1] + 1) [static]

Definition at line 39 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::END_TIME = (2, START_TIME[1] + 1) [static]

Definition at line 40 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::CATEGORY = (2, END_TIME[1] + 1) [static]

Definition at line 41 of file Metadata.py.

Definition at line 42 of file Metadata.py.

Definition at line 43 of file Metadata.py.

Definition at line 44 of file Metadata.py.

Definition at line 45 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::DC_ROLE = (4, 0) [static]

Definition at line 46 of file Metadata.py.

tuple SpadeSvc::Metadata::Metadata::DC_CONTACT = (4, DC_ROLE[1] + 1) [static]

Definition at line 47 of file Metadata.py.

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 49 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 75 of file Metadata.py.

Definition at line 99 of file Metadata.py.

Definition at line 99 of file Metadata.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:55:24 for SpadeSvc by doxygen 1.7.4