EcohydroLib  1.29
Functions | Variables
DumpMetadataToiRODSXML Namespace Reference

Dump EcohydroLib metadata to iRODS XML metadata import format. More...

Functions

def writeAVUToXMLFile
 Write Attribute, Value, Unit (AVU) element to iRODS metadata XML file. More...
 
def writeDictToXMLFile (outfile, target, dict)
 Write the contents of a dict as AVU elements in an iRODS metadata XML file. More...
 

Variables

string PATH_SEP_IRODS = '/'
 
string OUTFILE_NAME = 'metadata.xml'
 
tuple parser = argparse.ArgumentParser(description='Dump point climate station information from EcohydroLib metadata to standard output')
 
string help = 'The directory from which metadata should be read'
 
tuple args = parser.parse_args()
 
tuple context = Context(args.projectDir, None)
 
tuple collection = args.collection.rstrip(PATH_SEP_IRODS)
 
tuple outfilePath = os.path.join(context.projectDir, OUTFILE_NAME)
 
tuple outfile = codecs.getwriter('utf-8')
 
tuple history = GenericMetadata.getProcessingHistoryList(context)
 
int i = 1
 
string attribute = "processing_step_%d"
 
tuple provenance = GenericMetadata.readAssetProvenanceObjects(context)
 
 target = collection+PATH_SEP_IRODS+entry.dcIdentifier
 
tuple stations = GenericMetadata.readClimatePointStations(context)
 

Detailed Description

Dump EcohydroLib metadata to iRODS XML metadata import format.

This software is provided free of charge under the New BSD License. Please see the following license information:

Copyright (c) 2013, University of North Carolina at Chapel Hill All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Author
Brian Miles brian.nosp@m._mil.nosp@m.es@un.nosp@m.c.ed.nosp@m.u

Pre conditions:

  1. Metadata exist for the specified project directory

Post conditions:

  1. A file named metadata.xml will be written to the specified project directory

Usage:

1 DumpMetadataToiRODSXML.py -p /path/to/project_dir -c /irods/collection/path

Function Documentation

def DumpMetadataToiRODSXML.writeAVUToXMLFile (   outfile,
  target,
  attribute,
  value,
  unit = None 
)

Write Attribute, Value, Unit (AVU) element to iRODS metadata XML file.

Parameters
outfileStreamWriter representing the XML file. It is assumed that opening <metadata> element has already been written to the file
targetString representing the contents of the Target element
attributeString representing the contents of the Attribute element
valueString representing the contents of the Value element
unitString representing the contents of the Unit element. If None, an empty element will be written
def DumpMetadataToiRODSXML.writeDictToXMLFile (   outfile,
  target,
  dict 
)

Write the contents of a dict as AVU elements in an iRODS metadata XML file.

Parameters
outfileStreamWriter representing the XML file. It is assumed that opening <metadata> element has already been written to the file
targetString representing the contents of the Target element
dictThe dictionary whose key will serve as attributes and whose values will serve as values. Units will be written as empty elements for each AVU written

Variable Documentation

tuple DumpMetadataToiRODSXML.args = parser.parse_args()
string DumpMetadataToiRODSXML.attribute = "processing_step_%d"
tuple DumpMetadataToiRODSXML.collection = args.collection.rstrip(PATH_SEP_IRODS)
tuple DumpMetadataToiRODSXML.context = Context(args.projectDir, None)
string DumpMetadataToiRODSXML.help = 'The directory from which metadata should be read'
tuple DumpMetadataToiRODSXML.history = GenericMetadata.getProcessingHistoryList(context)
int DumpMetadataToiRODSXML.i = 1
tuple DumpMetadataToiRODSXML.outfile = codecs.getwriter('utf-8')
string DumpMetadataToiRODSXML.OUTFILE_NAME = 'metadata.xml'
tuple DumpMetadataToiRODSXML.outfilePath = os.path.join(context.projectDir, OUTFILE_NAME)
tuple DumpMetadataToiRODSXML.parser = argparse.ArgumentParser(description='Dump point climate station information from EcohydroLib metadata to standard output')
string DumpMetadataToiRODSXML.PATH_SEP_IRODS = '/'
tuple DumpMetadataToiRODSXML.provenance = GenericMetadata.readAssetProvenanceObjects(context)
tuple DumpMetadataToiRODSXML.stations = GenericMetadata.readClimatePointStations(context)
DumpMetadataToiRODSXML.target = collection+PATH_SEP_IRODS+entry.dcIdentifier