Module Expr Str Import alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore Str Assign NameStore Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad Call NameLoad NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore BinOpMod Str TupleLoad Call NameLoad NameLoad For NameStore Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad Call NameLoad SubscriptLoad NameLoad Index NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str decorator_list Assign NameStore Call AttributeLoad NameLoad attr keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr NameLoad Assign NameStore Call Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call NameLoad NameLoad NameLoad Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Num For NameStore NameLoad body Assign NameStore BinOpMod Str TupleLoad NameLoad AugAssignAdd NameStore Num Expr Call NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore NameLoad body Assign NameStore BinOpAdd BinOpAdd NameLoad NameLoad AttributeLoad NameLoad attr Expr Call NameLoad NameLoad NameLoad Str AttributeLoad NameLoad attr Expr Call NameLoad NameLoad NameLoad Str AttributeLoad NameLoad attr Expr Call NameLoad NameLoad NameLoad Str AttributeLoad NameLoad attr Expr Call NameLoad NameLoad NameLoad Str Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Expr Call NameLoad NameLoad NameLoad Str AttributeLoad NameLoad attr Expr Call NameLoad NameLoad NameLoad Str AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore NameLoad body Assign NameStore BinOpAdd BinOpAdd NameLoad NameLoad AttributeLoad NameLoad attr Expr Call NameLoad NameLoad NameLoad Str AttributeLoad NameLoad attr Expr Call NameLoad NameLoad NameLoad Str AttributeLoad NameLoad attr Expr Call NameLoad NameLoad NameLoad Str Call NameLoad AttributeLoad NameLoad attr Str Expr Call NameLoad NameLoad NameLoad Str Call NameLoad AttributeLoad NameLoad attr Str Expr Call NameLoad NameLoad NameLoad Str Call NameLoad AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr
N/A N/A @package DumpMetadataToiRODSXML

@brief 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:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the University of North Carolina at Chapel Hill nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

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_miles@unc.edu>
  

Pre conditions:
--------------
1. Metadata exist for the specified project directory
   

Post conditions:
----------------
2. A file named metadata.xml will be written to the specified project directory

Usage:
@code
DumpMetadataToiRODSXML.py -p /path/to/project_dir -c /irods/collection/path
@endcode
 N/A os N/A codecs N/A argparse xml.sax.saxutils escape ecohydrolib.context Context ecohydrolib.metadata GenericMetadata ecohydrolib.metadata AssetProvenance N/A PATH_SEP_IRODS / N/A OUTFILE_NAME metadata.xml writeAVUToXMLFile N/A N/A outfile target attribute value unit N/A None N/A N/A  Write Attribute, Value, Unit (AVU) element to iRODS metadata XML file
    
        @param outfile StreamWriter representing the XML file. It is assumed that opening 
        <metadata> element has already been written to the file
        @param target String representing the contents of the Target element
        @param attribute String representing the contents of the Attribute element
        @param value String representing the contents of the Value element
        @param unit String representing the contents of the Unit element.  
        If None, an empty element will be written 
     N/A N/A N/A outfile write 	<AVU>
 N/A N/A N/A outfile write N/A 		<Target>%s</Target>
 N/A N/A escape target N/A N/A N/A outfile write N/A 		<Attribute>%s</Attribute>
 N/A N/A escape attribute N/A N/A N/A outfile write N/A 		<Value>%s</Value>
 N/A N/A escape value N/A unit N/A N/A N/A N/A outfile write N/A 		<Unit>%s</Unit>
 N/A unit N/A N/A N/A N/A outfile write 		<Unit />
 N/A N/A N/A outfile write 	</AVU>
 N/A writeDictToXMLFile N/A N/A outfile target dict N/A N/A N/A  Write the contents of a dict as AVU elements in an iRODS metadata XML file
    
        @param outfile StreamWriter representing the XML file. It is assumed that opening 
        <metadata> element has already been written to the file
        @param target String representing the contents of the Target element
        @param dict The 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
     N/A targetStr N/A 		<Target>%s</Target>
 N/A N/A escape target N/A key N/A N/A dict keys N/A N/A N/A N/A outfile write 	<AVU>
 N/A N/A N/A outfile write targetStr N/A N/A N/A outfile write N/A 		<Attribute>%s</Attribute>
 N/A N/A escape key N/A N/A N/A outfile write N/A 		<Value>%s</Value>
 N/A N/A escape N/A dict N/A key N/A N/A N/A outfile write 		<Unit />
 N/A N/A N/A outfile write 	</AVU>
 N/A N/A parser N/A N/A argparse ArgumentParser description Dump point climate station information from EcohydroLib metadata to standard output N/A N/A N/A parser add_argument -p --projectDir dest projectDir required True help The directory from which metadata should be read N/A N/A N/A parser add_argument -c --collection dest collection required True help The iRODS collection corresponding to the project directory N/A args N/A N/A parser parse_args N/A context N/A Context N/A args projectDir None N/A collection N/A N/A N/A args collection rstrip PATH_SEP_IRODS N/A outfilePath N/A N/A N/A os path join N/A context projectDir OUTFILE_NAME N/A outfile N/A N/A N/A codecs getwriter utf-8 N/A open outfilePath w N/A N/A N/A outfile write <?xml version="1.0" encoding="UTF-8" ?>
 N/A N/A N/A outfile write <metadata>
 N/A N/A writeDictToXMLFile outfile collection N/A N/A GenericMetadata readStudyAreaEntries context N/A history N/A N/A GenericMetadata getProcessingHistoryList context N/A i 1 N/A entry history N/A N/A attribute N/A processing_step_%d N/A i N/A i 1 N/A N/A writeAVUToXMLFile outfile collection attribute entry N/A provenance N/A N/A GenericMetadata readAssetProvenanceObjects context N/A entry provenance N/A N/A target N/A N/A collection PATH_SEP_IRODS N/A entry dcIdentifier N/A N/A writeAVUToXMLFile outfile target name N/A entry name N/A N/A writeAVUToXMLFile outfile target dc.source N/A entry dcSource N/A N/A writeAVUToXMLFile outfile target dc.title N/A entry dcTitle N/A N/A writeAVUToXMLFile outfile target dc.date N/A N/A N/A entry dcDate strftime N/A AssetProvenance FMT_DATE N/A N/A writeAVUToXMLFile outfile target dc.publisher N/A entry dcPublisher N/A N/A writeAVUToXMLFile outfile target dc.description N/A entry dcDescription N/A stations N/A N/A GenericMetadata readClimatePointStations context N/A station stations N/A N/A target N/A N/A collection PATH_SEP_IRODS N/A station data N/A N/A writeAVUToXMLFile outfile target id N/A station id N/A N/A writeAVUToXMLFile outfile target name N/A station name N/A N/A writeAVUToXMLFile outfile target longitude N/A str N/A station longitude WGS84 degrees N/A N/A writeAVUToXMLFile outfile target latitude N/A str N/A station latitude WGS84 degrees N/A N/A writeAVUToXMLFile outfile target elevation N/A str N/A station elevation meters N/A N/A N/A outfile write </metadata>
 N/A N/A N/A outfile close