def decode_responsible_party(xml, nsmap):
    """Decodes an instance of the following type: responsible party.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.ResponsibleParty

    """
    decodings = [
        ('abbreviation', False, 'unicode', 'child::cim:abbreviation'),
        ('address', False, 'unicode', 'child::gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:deliveryPoint'),
        ('address', False, 'unicode', 'child::gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:deliveryPoint/gco:CharacterString'),
        ('email', False, 'unicode', 'child::gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress'),
        ('email', False, 'unicode', 'child::gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString'),
        ('individual_name', False, 'unicode', 'child::gmd:individualName'),
        ('individual_name', False, 'unicode', 'child::gmd:individualName/gco:CharacterString'),
        ('organisation_name', False, 'unicode', 'child::gmd:organisationName'),
        ('organisation_name', False, 'unicode', 'child::gmd:organisationName/gco:CharacterString'),
        ('role', False, 'unicode', 'gmd:role/gmd:CI_RoleCode/@codeListValue'),
        ('url', False, 'unicode', 'child::gmd:contactInfo/gmd:CI_Contact/gmd:onlineResource/gmd:CI_OnlineResource/gmd:linkage/gmd:URL'),
    ]

    return set_attributes(typeset.shared.ResponsibleParty(), xml, nsmap, decodings)
def decode_conformance(xml, nsmap):
    """Decodes an instance of the following type: conformance.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.Conformance

    """
    decodings = [
        ('description', False, 'unicode', 'child::cim:description'),
        ('frequency', False, 'unicode', 'child::cim:frequency'),
        ('is_conformant', False, 'bool', '@conformant'),
        ('requirements', True, decode_boundary_condition, 'child::cim:requirement/cim:requirement/cim:boundaryCondition'),
        ('requirements', True, decode_doc_reference, 'child::cim:requirement/cim:reference'),
        ('requirements', True, decode_initial_condition, 'child::cim:requirement/cim:requirement/cim:initialCondition'),
        ('requirements', True, decode_lateral_boundary_condition, 'child::cim:requirement/cim:requirement/cim:lateralBoundaryCondition'),
        ('requirements', True, decode_output_requirement, 'child::cim:requirement/cim:requirement/cim:outputRequirement'),
        ('requirements', True, decode_spatio_temporal_constraint, 'child::cim:requirement/cim:requirement/cim:spatioTemporalConstraint'),
        ('sources', True, decode_component_property, 'child::cim:source/cim:source/cim:componentProperty'),
        ('sources', True, decode_data_content, 'child::cim:source/cim:source/cim:dataContent'),
        ('sources', True, decode_data_object, 'child::cim:source/cim:source/cim:dataObject'),
        ('sources', True, decode_doc_reference, 'child::cim:source/cim:reference'),
        ('sources', True, decode_model_component, 'child::cim:source/cim:source/cim:softwareComponent'),
        ('sources', True, decode_processor_component, 'child::cim:source/cim:source/cim:softwareComponent'),
        ('sources', True, decode_statistical_model_component, 'child::cim:source/cim:source/cim:softwareComponent'),
        ('type', False, 'unicode', '@type'),
    ]

    return set_attributes(typeset.activity.Conformance(), xml, nsmap, decodings)
Beispiel #3
0
def decode_component_property(xml, nsmap):
    """Decodes an instance of the following type: component property.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.ComponentProperty

    """
    decodings = [
        ('citations', True, decode_citation, 'child::cim:citation'),
        ('description', False, 'str', 'child::cim:description'),
        ('intent', False, 'str', 'self::cim:componentProperty/@intent'),
        ('is_represented', False, 'bool',
         'self::cim:componentProperty/@represented'),
        ('long_name', False, 'str', 'child::cim:longName'),
        ('short_name', False, 'str', 'child::cim:shortName'),
        ('standard_names', True, 'str', 'child::cim:standardName/@value'),
        ('sub_properties', True, decode_component_property,
         'child::cim:componentProperty'),
        ('units', False, 'str', 'child::cim:units/@value'),
        ('values', True, 'str', 'child::cim:value'),
    ]

    return set_attributes(typeset.software.ComponentProperty(), xml, nsmap,
                          decodings)
Beispiel #4
0
def decode_data_extent_geographical(xml, nsmap):
    """Decodes an instance of the following type: data extent geographical.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.data.DataExtentGeographical

    """
    decodings = [
        ('east', False, 'float',
         'child::gmd:EX_GeographicBoundingBox/gmd:eastBoundLongitude/gco:Decimal'
         ),
        ('north', False, 'float',
         'child::gmd:EX_GeographicBoundingBox/gmd:northBoundLatitude/gco:Decimal'
         ),
        ('south', False, 'float',
         'child::gmd:EX_GeographicBoundingBox/gmd:southBoundLatitude/gco:Decimal'
         ),
        ('west', False, 'float',
         'child::gmd:EX_GeographicBoundingBox/gmd:westBoundLongitude/gco:Decimal'
         ),
    ]

    return set_attributes(typeset.data.DataExtentGeographical(), xml, nsmap,
                          decodings)
def decode_boundary_condition(xml, nsmap):
    """Decodes an instance of the following type: boundary condition.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.BoundaryCondition

    """
    decodings = [
        ("description", False, "str", "child::cim:description"),
        ("id", False, "str", "child::cim:id"),
        ("name", False, "str", "child::cim:name"),
        ("options", True, decode_numerical_requirement_option, "child::cim:requirementOption"),
        ("source", False, decode_data_object, "child::cim:source/cim:source/cim:dataObject"),
        ("source", False, decode_data_content, "child::cim:source/cim:source/cim:dataContent"),
        ("source", False, decode_component_property, "child::cim:source/cim:source/cim:componentProperty"),
        ("source", False, decode_model_component, "child::cim:source/cim:source/cim:softwareComponent"),
        ("source", False, decode_processor_component, "child::cim:source/cim:source/cim:softwareComponent"),
        ("source", False, decode_statistical_model_component, "child::cim:source/cim:source/cim:softwareComponent"),
        ("source_reference", False, decode_doc_reference, "child::cim:source/cim:reference"),
    ]

    return set_attributes(typeset.activity.BoundaryCondition(), xml, nsmap, decodings)
Beispiel #6
0
def decode_machine(xml, nsmap):
    """Decodes an instance of the following type: machine.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.Machine

    """
    decodings = [
        ('cores_per_processor', False, 'int',
         'child::cim:machineCoresPerProcessor'),
        ('description', False, 'str', 'child::cim:machineDescription'),
        ('interconnect', False, 'str',
         'child::cim:machineInterconnect/@value'),
        ('libraries', True, 'str', 'child::cim:machineLibrary'),
        ('location', False, 'str', 'child::cim:machineLocation'),
        ('maximum_processors', False, 'int',
         'child::cim:machineMaximumProcessors'),
        ('name', False, 'str', 'child::cim:machineName'),
        ('operating_system', False, 'str',
         'child::cim:machineOperatingSystem/@value'),
        ('processor_type', False, 'str',
         'child::cim:machineProcessorType/@value'),
        ('system', False, 'str', 'child::cim:machineSystem'),
        ('type', False, 'str', '@machineType'),
        ('vendor', False, 'str', 'child::cim:machineVendor/@value'),
    ]

    return set_attributes(typeset.shared.Machine(), xml, nsmap, decodings)
def decode_component_property(xml, nsmap):
    """Decodes an instance of the following type: component property.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.ComponentProperty

    """
    decodings = [
        ('citations', True, decode_citation, 'child::cim:citation'),
        ('description', False, 'str', 'child::cim:description'),
        ('intent', False, 'str', 'self::cim:componentProperty/@intent'),
        ('is_represented', False, 'bool', 'self::cim:componentProperty/@represented'),
        ('long_name', False, 'str', 'child::cim:longName'),
        ('short_name', False, 'str', 'child::cim:shortName'),
        ('standard_names', True, 'str', 'child::cim:standardName/@value'),
        ('sub_properties', True, decode_component_property, 'child::cim:componentProperty'),
        ('units', False, 'str', 'child::cim:units/@value'),
        ('values', True, 'str', 'child::cim:value'),
    ]

    return set_attributes(typeset.software.ComponentProperty(), xml, nsmap, decodings)
def decode_numerical_activity(xml, nsmap):
    """Decodes an instance of the following type: numerical activity.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.NumericalActivity

    """
    decodings = [
        ("description", False, "str", "child::cim:description"),
        ("funding_sources", True, "str", "child::cim:fundingSource"),
        ("long_name", False, "str", "child::cim:longName"),
        ("projects", True, "str", "child::cim:project/@value"),
        ("rationales", True, "str", "child::cim:rationale"),
        ("responsible_parties", True, decode_responsible_party, "child::cim:responsibleParty"),
        ("short_name", False, "str", "child::cim:shortName"),
        ("supports", True, decode_experiment, "child::cim:supports/cim:experiment"),
        ("supports_references", True, decode_doc_reference, "child::cim:supports/cim:reference"),
    ]

    return set_attributes(typeset.activity.NumericalActivity(), xml, nsmap, decodings)
def decode_coupling_endpoint(xml, nsmap):
    """Decodes an instance of the following type: coupling endpoint.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.CouplingEndpoint

    """
    decodings = [
        ('data_source', False, decode_data_object, 'child::cim:dataSource/cim:dataSource/cim:dataObject'),
        ('data_source', False, decode_data_content, 'child::cim:dataSource/cim:dataSource/cim:dataContent'),
        ('data_source', False, decode_component_property, 'child::cim:dataSource/cim:dataSource/cim:componentProperty'),
        ('data_source', False, decode_model_component, 'child::cim:dataSource/cim:dataSource/cim:softwareComponent'),
        ('data_source', False, decode_processor_component, 'child::cim:dataSource/cim:dataSource/cim:softwareComponent'),
        ('data_source', False, decode_statistical_model_component, 'child::cim:dataSource/cim:dataSource/cim:softwareComponent'),
        ('data_source_reference', False, decode_doc_reference, 'child::cim:dataSource/cim:reference'),
        ('instance_id', False, 'str', 'child::cim:instanceID'),
        ('properties', True, decode_coupling_property, 'child::cim:couplingProperty'),
    ]

    return set_attributes(typeset.software.CouplingEndpoint(), xml, nsmap, decodings)
def decode_statistical_model_component(xml, nsmap):
    """Decodes an instance of the following type: statistical model component.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.StatisticalModelComponent

    """
    decodings = [
        ('citations', True, decode_citation, 'child::cim:citation'),
        ('description', False, 'str', 'child::cim:description'),
        ('language', False, decode_component_language, 'child::cim:componentLanguage'),
        ('long_name', False, 'str', 'child::cim:longName'),
        ('meta', False, decode_doc_meta_info, 'self::cim:statisticalModelComponent'),
        ('properties', True, decode_component_property, 'child::cim:componentProperties/cim:componentProperty'),
        ('properties', True, decode_component_property, 'child::cim:scientificProperties/cim:componentProperty'),
        ('properties', True, decode_component_property, 'child::cim:numericalProperties/cim:componentProperty'),
        ('release_date', False, 'datetime.datetime', 'child::cim:releaseDate'),
        ('responsible_parties', True, decode_responsible_party, 'child::cim:responsibleParty'),
        ('short_name', False, 'str', 'child::cim:shortName'),
        ('sub_components', True, decode_model_component, 'child::cim:childComponent/cim:modelComponent'),
        ('sub_components', True, decode_processor_component, 'child::cim:childComponent/cim:processorComponent'),
        ('timing', False, decode_timing, 'child::cim:timing'),
        ('type', False, 'str', 'child::cim:type[1]/@value'),
        ('types', True, 'str', 'child::cim:type/@value'),
    ]

    return set_attributes(typeset.software.StatisticalModelComponent(), xml, nsmap, decodings)
def decode_component(xml, nsmap):
    """Decodes an instance of the following type: component.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.Component

    """
    decodings = [
        ('citations', True, decode_citation, 'child::cim:citation'),
        ('description', False, 'unicode', 'child::cim:description'),
        ('language', False, decode_component_language, 'child::cim:componentLanguage'),
        ('long_name', False, 'unicode', 'child::cim:longName'),
        ('properties', True, decode_component_property, 'child::cim:componentProperties/cim:componentProperty'),
        ('properties', True, decode_component_property, 'child::cim:numericalProperties/cim:componentProperty'),
        ('properties', True, decode_component_property, 'child::cim:scientificProperties/cim:componentProperty'),
        ('release_date', False, 'datetime.datetime', 'child::cim:releaseDate'),
        ('responsible_parties', True, decode_responsible_party, 'child::cim:responsibleParty'),
        ('short_name', False, 'unicode', 'child::cim:shortName'),
        ('sub_components', True, decode_model_component, 'child::cim:childComponent/cim:modelComponent'),
        ('sub_components', True, decode_processor_component, 'child::cim:childComponent/cim:processorComponent'),
    ]

    return set_attributes(typeset.software.Component(), xml, nsmap, decodings)
def decode_connection(xml, nsmap):
    """Decodes an instance of the following type: connection.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.Connection

    """
    decodings = [
        ('description', False, 'str', 'child::cim:description'),
        ('priming', False, decode_data_object, 'child::cim:priming/cim:priming/cim:dataObject'),
        ('priming', False, decode_data_content, 'child::cim:priming/cim:priming/cim:dataContent'),
        ('priming', False, decode_component_property, 'child::cim:priming/cim:priming/cim:componentProperty'),
        ('priming', False, decode_model_component, 'child::cim:priming/cim:priming/cim:softwareComponent'),
        ('priming', False, decode_processor_component, 'child::cim:priming/cim:priming/cim:softwareComponent'),
        ('priming', False, decode_statistical_model_component, 'child::cim:priming/cim:priming/cim:softwareComponent'),
        ('priming_reference', False, decode_doc_reference, 'child::cim:priming/cim:reference'),
        ('properties', True, decode_connection_property, 'child::cim:connectionProperty'),
        ('sources', True, decode_connection_endpoint, 'child::cim:connectionSource'),
        ('spatial_regridding', True, decode_spatial_regridding, 'child::cim:spatialRegridding'),
        ('target', False, decode_connection_endpoint, 'child::cim:connectionTarget'),
        ('time_lag', False, 'str', 'child::cim:timeLag'),
        ('time_profile', False, decode_timing, 'child::cim:timeProfile'),
        ('time_transformation', False, decode_time_transformation, 'child::cim:timeTransformation'),
        ('transformers', True, decode_processor_component, 'child::cim:transformer/cim:processorComponent'),
        ('transformers_references', True, decode_doc_reference, 'child::cim:transformer/cim:reference'),
        ('type', False, 'str', 'child::cim:type/@value'),
    ]

    return set_attributes(typeset.software.Connection(), xml, nsmap, decodings)
Beispiel #13
0
def decode_citation(xml, nsmap):
    """Decodes an instance of the following type: citation.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.Citation

    """
    decodings = [
        ('alternative_title', False, 'str',
         'child::gmd:alternateTitle/gco:CharacterString'),
        ('collective_title', False, 'str',
         'gmd:collectiveTitle/gco:CharacterString'),
        ('date', False, 'datetime.datetime',
         'child::gmd:date/gmd:CI_Date/gmd:date/gco:Date'),
        ('date_type', False, 'str',
         'child::gmd:date/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode/@codeListValue'
         ),
        ('location', False, 'str',
         'child::gmd:otherCitationDetails/gco:CharacterString'),
        ('title', False, 'str', 'child::gmd:title/gco:CharacterString'),
        ('type', False, 'str',
         'child::gmd:presentationForm/gmd:CI_PresentationFormCode/@codeListValue'
         ),
    ]

    return set_attributes(typeset.shared.Citation(), xml, nsmap, decodings)
def decode_coupling(xml, nsmap):
    """Decodes an instance of the following type: coupling.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.Coupling

    """
    decodings = [
        ('connections', True, decode_connection, 'child::cim:connection'),
        ('description', False, 'unicode', 'child::cim:description'),
        ('is_fully_specified', False, 'bool', '@fullySpecified'),
        ('priming', False, decode_component_property, 'child::cim:priming/cim:priming/cim:componentProperty'),
        ('priming', False, decode_data_content, 'child::cim:priming/cim:priming/cim:dataContent'),
        ('priming', False, decode_data_object, 'child::cim:priming/cim:priming/cim:dataObject'),
        ('priming', False, decode_doc_reference, 'child::cim:priming/cim:reference'),
        ('priming', False, decode_model_component, 'child::cim:priming/cim:priming/cim:softwareComponent'),
        ('priming', False, decode_processor_component, 'child::cim:priming/cim:priming/cim:softwareComponent'),
        ('priming', False, decode_statistical_model_component, 'child::cim:priming/cim:priming/cim:softwareComponent'),
        ('properties', True, decode_coupling_property, 'child::cim:couplingProperty'),
        ('purpose', False, 'unicode', '@purpose'),
        ('sources', True, decode_coupling_endpoint, 'child::cim:couplingSource'),
        ('spatial_regriddings', True, decode_spatial_regridding, 'child::cim:spatialRegridding'),
        ('target', False, decode_coupling_endpoint, 'child::cim:couplingTarget'),
        ('time_lag', False, decode_time_lag, 'child::cim:timeLag'),
        ('time_profile', False, decode_timing, 'child::cim:timeProfile'),
        ('time_transformation', False, decode_time_transformation, 'child::cim:timeTransformation'),
        ('transformers', True, decode_doc_reference, 'child::cim:transformer/cim:reference'),
        ('transformers', True, decode_processor_component, 'child::cim:transformer/cim:processorComponent'),
        ('type', False, 'unicode', 'child::cim:type/@value'),
    ]

    return set_attributes(typeset.software.Coupling(), xml, nsmap, decodings)
def decode_ensemble(xml, nsmap):
    """Decodes an instance of the following type: ensemble.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.Ensemble

    """
    decodings = [
        ('description', False, 'unicode', 'child::cim:description'),
        ('funding_sources', True, 'unicode', 'child::cim:fundingSource'),
        ('long_name', False, 'unicode', 'child::cim:longName'),
        ('members', True, decode_ensemble_member, 'child::cim:ensembleMember'),
        ('meta', False, decode_doc_meta_info, 'self::cim:ensemble'),
        ('outputs', True, decode_component_property, 'child::cim:output/cim:output/cim:componentProperty'),
        ('outputs', True, decode_data_content, 'child::cim:output/cim:output/cim:dataContent'),
        ('outputs', True, decode_data_object, 'child::cim:output/cim:output/cim:dataObject'),
        ('outputs', True, decode_doc_reference, 'child::cim:output/cim:reference'),
        ('outputs', True, decode_model_component, 'child::cim:output/cim:output/cim:softwareComponent'),
        ('outputs', True, decode_processor_component, 'child::cim:output/cim:output/cim:softwareComponent'),
        ('outputs', True, decode_statistical_model_component, 'child::cim:output/cim:output/cim:softwareComponent'),
        ('projects', True, 'unicode', 'child::cim:project/@value'),
        ('rationales', True, 'unicode', 'child::cim:rationale'),
        ('responsible_parties', True, decode_responsible_party, 'child::cim:responsibleParty'),
        ('short_name', False, 'unicode', 'child::cim:shortName'),
        ('supports', True, decode_doc_reference, 'child::cim:supports/cim:reference'),
        ('supports', True, decode_experiment, 'child::cim:supports/cim:experiment'),
        ('types', True, 'unicode', 'child::cim:ensembleType/@value'),
    ]

    return set_attributes(typeset.activity.Ensemble(), xml, nsmap, decodings)
def decode_spatio_temporal_constraint(xml, nsmap):
    """Decodes an instance of the following type: spatio temporal constraint.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.SpatioTemporalConstraint

    """
    decodings = [
        ('date_range', False, decode_closed_date_range, 'child::cim:requiredDuration/cim:closedDateRange'),
        ('date_range', False, decode_open_date_range, 'child::cim:requiredDuration/cim:openDateRange'),
        ('description', False, 'unicode', 'child::cim:description'),
        ('id', False, 'unicode', 'child::cim:id'),
        ('name', False, 'unicode', 'child::cim:name'),
        ('options', True, decode_numerical_requirement_option, 'child::cim:requirementOption'),
        ('source', False, decode_component_property, 'child::cim:source/cim:source/cim:componentProperty'),
        ('source', False, decode_data_content, 'child::cim:source/cim:source/cim:dataContent'),
        ('source', False, decode_data_object, 'child::cim:source/cim:source/cim:dataObject'),
        ('source', False, decode_doc_reference, 'child::cim:source/cim:reference'),
        ('source', False, decode_model_component, 'child::cim:source/cim:source/cim:softwareComponent'),
        ('source', False, decode_processor_component, 'child::cim:source/cim:source/cim:softwareComponent'),
        ('source', False, decode_statistical_model_component, 'child::cim:source/cim:source/cim:softwareComponent'),
        ('spatial_resolution', False, 'unicode', 'child::cim:spatialResolution'),
    ]

    return set_attributes(typeset.activity.SpatioTemporalConstraint(), xml, nsmap, decodings)
Beispiel #17
0
def decode_spatial_regridding(xml, nsmap):
    """Decodes an instance of the following type: spatial regridding.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.SpatialRegridding

    """
    decodings = [
        ('dimension', False, 'str', 'child::cim:spatialRegriddingDimension'),
        ('properties', True, decode_spatial_regridding_property,
         'child::cim:spatialRegriddingProperty'),
        ('standard_method', False, 'str',
         'child::cim:spatialRegriddingStandardMethod'),
        ('user_method', False, decode_spatial_regridding_user_method,
         'child::cim:spatialRegriddingUserMethod'),
    ]

    return set_attributes(typeset.software.SpatialRegridding(), xml, nsmap,
                          decodings)
def decode_ensemble_member(xml, nsmap):
    """Decodes an instance of the following type: ensemble member.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.EnsembleMember

    """
    decodings = [
        ('description', False, 'unicode', 'child::cim:description'),
        ('ensemble', False, decode_doc_reference, 'child::cim:ensemble/cim:reference'),
        ('ensemble', False, decode_ensemble, 'child::cim:ensemble/cim:ensemble'),
        ('ensemble_ids', True, decode_standard_name, 'child::cim:ensembleMemberID'),
        ('funding_sources', True, 'unicode', 'child::cim:fundingSource'),
        ('long_name', False, 'unicode', 'child::cim:longName'),
        ('projects', True, 'unicode', 'child::cim:project/@value'),
        ('rationales', True, 'unicode', 'child::cim:rationale'),
        ('responsible_parties', True, decode_responsible_party, 'child::cim:responsibleParty'),
        ('short_name', False, 'unicode', 'child::cim:shortName'),
        ('simulation', False, decode_doc_reference, 'child::cim:simulation/cim:reference'),
        ('simulation', False, decode_simulation, 'child::cim:ensemble/cim:simulation'),
        ('supports', True, decode_doc_reference, 'child::cim:supports/cim:reference'),
        ('supports', True, decode_experiment, 'child::cim:supports/cim:experiment'),
    ]

    return set_attributes(typeset.activity.EnsembleMember(), xml, nsmap, decodings)
Beispiel #19
0
def decode_deployment(xml, nsmap):
    """Decodes an instance of the following type: deployment.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.Deployment

    """
    decodings = [
        ('deployment_date', False, 'datetime.datetime',
         'child::cim:deploymentDate'),
        ('description', False, 'str', 'child::cim:description'),
        ('executable_arguments', True, 'str', 'child::cim:executableArgument'),
        ('executable_name', False, 'str', 'child::cim:executableName'),
        ('parallelisation', False, decode_parallelisation,
         'child::cim:parallelisation'),
        ('platform', False, decode_platform,
         'child::cim:platform/cim:platform'),
        ('platform_reference', False, decode_doc_reference,
         'child::cim:platform/cim:reference'),
    ]

    return set_attributes(typeset.software.Deployment(), xml, nsmap, decodings)
def decode_simulation(xml, nsmap):
    """Decodes an instance of the following type: simulation.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.Simulation

    """
    decodings = [
        ('authors', False, 'unicode', 'child::cim:authorsList/cim:list'),
        ('calendar', False, decode_daily_360, 'child::cim:calendar/cim:daily-360'),
        ('calendar', False, decode_perpetual_period, 'child::cim:calendar/cim:perpetualPeriod'),
        ('calendar', False, decode_real_calendar, 'child::cim:calendar/cim:realCalendar'),
        ('conformances', True, decode_conformance, 'child::cim:conformance/cim:conformance'),
        ('conformances', True, decode_physical_modification, 'child::cim:conformance/cim:physicalModification'),
        ('control_simulation', False, decode_doc_reference, 'child::cim:controlSimulation/cim:reference'),
        ('control_simulation', False, decode_simulation, 'child::cim:controlSimulation/cim:controlSimulation'),
        ('deployments', True, decode_deployment, 'child::cim:deployment'),
        ('description', False, 'unicode', 'child::cim:description'),
        ('funding_sources', True, 'unicode', 'child::cim:fundingSource'),
        ('inputs', True, decode_coupling, 'child::cim:input'),
        ('long_name', False, 'unicode', 'child::cim:longName'),
        ('projects', True, 'unicode', 'child::cim:project/@value'),
        ('rationales', True, 'unicode', 'child::cim:rationale'),
        ('responsible_parties', True, decode_responsible_party, 'child::cim:responsibleParty'),
        ('short_name', False, 'unicode', 'child::cim:shortName'),
        ('simulation_id', False, 'unicode', 'child::cim:simulationID'),
        ('spinup_date_range', False, decode_closed_date_range, 'child::cim:dateRange/cim:closedDateRange'),
        ('supports', True, decode_doc_reference, 'child::cim:supports/cim:reference'),
        ('supports', True, decode_experiment, 'child::cim:supports/cim:experiment'),
    ]

    return set_attributes(typeset.activity.Simulation(), xml, nsmap, decodings)
def decode_spatio_temporal_constraint(xml, nsmap):
    """Decodes an instance of the following type: spatio temporal constraint.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.SpatioTemporalConstraint

    """
    decodings = [
        ("date_range", False, decode_closed_date_range, "child::cim:requiredDuration/cim:closedDateRange"),
        ("date_range", False, decode_open_date_range, "child::cim:requiredDuration/cim:openDateRange"),
        ("description", False, "str", "child::cim:description"),
        ("id", False, "str", "child::cim:id"),
        ("name", False, "str", "child::cim:name"),
        ("options", True, decode_numerical_requirement_option, "child::cim:requirementOption"),
        ("source", False, decode_data_object, "child::cim:source/cim:source/cim:dataObject"),
        ("source", False, decode_data_content, "child::cim:source/cim:source/cim:dataContent"),
        ("source", False, decode_component_property, "child::cim:source/cim:source/cim:componentProperty"),
        ("source", False, decode_model_component, "child::cim:source/cim:source/cim:softwareComponent"),
        ("source", False, decode_processor_component, "child::cim:source/cim:source/cim:softwareComponent"),
        ("source", False, decode_statistical_model_component, "child::cim:source/cim:source/cim:softwareComponent"),
        ("source_reference", False, decode_doc_reference, "child::cim:source/cim:reference"),
        ("spatial_resolution", False, "str", "child::cim:spatialResolution"),
    ]

    return set_attributes(typeset.activity.SpatioTemporalConstraint(), xml, nsmap, decodings)
def decode_citation(xml, nsmap):
    """Decodes an instance of the following type: citation.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.Citation

    """
    decodings = [
        ('alternative_title', False, 'unicode', 'child::gmd:alternateTitle'),
        ('alternative_title', False, 'unicode', 'child::gmd:alternateTitle/gco:CharacterString'),
        ('collective_title', False, 'unicode', 'gmd:collectiveTitle'),
        ('collective_title', False, 'unicode', 'gmd:collectiveTitle/gco:CharacterString'),
        ('date', False, 'datetime.datetime', 'child::gmd:date/gmd:CI_Date/gmd:date/gco:Date'),
        ('date_type', False, 'unicode', 'child::gmd:date/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode/@codeListValue'),
        ('location', False, 'unicode', 'child::gmd:otherCitationDetails'),
        ('location', False, 'unicode', 'child::gmd:otherCitationDetails/gco:CharacterString'),
        ('title', False, 'unicode', 'child::gmd:title'),
        ('title', False, 'unicode', 'child::gmd:title/gco:CharacterString'),
        ('type', False, 'unicode', 'child::gmd:presentationForm/gmd:CI_PresentationFormCode/@codeListValue'),
    ]

    return set_attributes(typeset.shared.Citation(), xml, nsmap, decodings)
def decode_grid_mosaic(xml, nsmap):
    """Decodes an instance of the following type: grid mosaic.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.grids.GridMosaic

    """
    decodings = [
        ('citations', True, decode_citation, 'child::cim:citationList/cim:citation'),
        ('description', False, 'unicode', 'child::cim:description'),
        ('has_congruent_tiles', False, 'bool', '@congruentTiles'),
        ('id', False, 'unicode', '@id'),
        ('is_leaf', False, 'bool', '@isLeaf'),
        ('long_name', False, 'unicode', 'child::cim:longName'),
        ('mnemonic', False, 'unicode', 'child::cim:mnemonic'),
        ('mosaic_count', False, 'int', '@numMosaics'),
        ('mosaics', True, decode_grid_mosaic, 'child::cim:gridMosaic'),
        ('short_name', False, 'unicode', 'child::cim:shortName'),
        ('tile_count', False, 'int', '@numTiles'),
        ('tiles', True, decode_grid_tile, 'child::cim:gridTile'),
        ('type', False, 'unicode', '@gridType'),
    ]

    return set_attributes(typeset.grids.GridMosaic(), xml, nsmap, decodings)
def decode_grid_tile(xml, nsmap):
    """Decodes an instance of the following type: grid tile.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.grids.GridTile

    """
    decodings = [
        ('description', False, 'unicode', 'child::cim:description'),
        ('discretization_type', False, 'unicode', '@discretizationType'),
        ('extent', False, decode_grid_extent, 'child::cim:extent'),
        ('geometry_type', False, 'unicode', '@geometryType'),
        ('horizontal_resolution', False, decode_grid_tile_resolution_type, 'child::cim:horizontalResolution'),
        ('id', False, 'unicode', '@id'),
        ('is_conformal', False, 'bool', '@isConformal'),
        ('is_regular', False, 'bool', '@isRegular'),
        ('is_terrain_following', False, 'bool', '@isTerrainFollowing'),
        ('is_uniform', False, 'bool', '@isUniform'),
        ('long_name', False, 'unicode', 'child::cim:longName'),
        ('mnemonic', False, 'unicode', 'child::cim:mnemonic'),
        ('nx', False, 'int', '@nx'),
        ('ny', False, 'int', '@ny'),
        ('nz', False, 'int', '@nz'),
        ('refinement_scheme', False, 'unicode', '@refinementScheme'),
        ('short_name', False, 'unicode', 'child::cim:shortName'),
        ('vertical_resolution', False, decode_grid_tile_resolution_type, 'child::cim:verticalResolution'),
        ('zcoords', False, decode_vertical_coordinate_list, 'child::cim:zcoords'),
    ]

    return set_attributes(typeset.grids.GridTile(), xml, nsmap, decodings)
Beispiel #25
0
def decode_responsible_party_contact_info(xml, nsmap):
    """Decodes an instance of the following type: responsible party contact info.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.ResponsiblePartyContactInfo

    """
    decodings = [
        ('address', False, 'str',
         'child::gmd:address/gmd:CI_Address/gmd:deliveryPoint/gco:CharacterString'
         ),
        ('email', False, 'str',
         'child::gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString'
         ),
        ('url', False, 'str',
         'child::gmd:onlineResource/gmd:CI_OnlineResource/gmd:linkage/gmd:URL'
         ),
    ]

    return set_attributes(typeset.shared.ResponsiblePartyContactInfo(), xml,
                          nsmap, decodings)
Beispiel #26
0
def decode_coupling_endpoint(xml, nsmap):
    """Decodes an instance of the following type: coupling endpoint.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.CouplingEndpoint

    """
    decodings = [
        ('data_source', False, decode_data_object,
         'child::cim:dataSource/cim:dataSource/cim:dataObject'),
        ('data_source', False, decode_data_content,
         'child::cim:dataSource/cim:dataSource/cim:dataContent'),
        ('data_source', False, decode_component_property,
         'child::cim:dataSource/cim:dataSource/cim:componentProperty'),
        ('data_source', False, decode_model_component,
         'child::cim:dataSource/cim:dataSource/cim:softwareComponent'),
        ('data_source', False, decode_processor_component,
         'child::cim:dataSource/cim:dataSource/cim:softwareComponent'),
        ('data_source', False, decode_statistical_model_component,
         'child::cim:dataSource/cim:dataSource/cim:softwareComponent'),
        ('data_source_reference', False, decode_doc_reference,
         'child::cim:dataSource/cim:reference'),
        ('instance_id', False, 'str', 'child::cim:instanceID'),
        ('properties', True, decode_coupling_property,
         'child::cim:couplingProperty'),
    ]

    return set_attributes(typeset.software.CouplingEndpoint(), xml, nsmap,
                          decodings)
def decode_grid_mosaic(xml, nsmap):
    """Decodes an instance of the following type: grid mosaic.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.grids.GridMosaic

    """
    decodings = [
        ("citations", True, decode_citation, "child::cim:citationList/cim:citation"),
        ("description", False, "str", "child::cim:description"),
        ("has_congruent_tiles", False, "bool", "@congruentTiles"),
        ("id", False, "str", "@id"),
        ("is_leaf", False, "bool", "@isLeaf"),
        ("long_name", False, "str", "child::cim:longName"),
        ("mnemonic", False, "str", "child::cim:mnemonic"),
        ("mosaic_count", False, "int", "@numMosaics"),
        ("mosaics", True, decode_grid_mosaic, "child::cim:gridMosaic"),
        ("short_name", False, "str", "child::cim:shortName"),
        ("tile_count", False, "int", "@numTiles"),
        ("tiles", True, decode_grid_tile, "child::cim:gridTile"),
        ("type", False, "str", "@gridType"),
    ]

    return set_attributes(typeset.grids.GridMosaic(), xml, nsmap, decodings)
Beispiel #28
0
def decode_evaluation(xml, nsmap):
    """Decodes an instance of the following type: evaluation.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.quality.Evaluation

    """
    decodings = [
        ('date', False, 'datetime.datetime', 'child::gmd:result/gmd:DQ_ConformanceResult/gmd:specification/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date/gco:Date'),
        ('description', False, 'str', 'gmd:evaluationMethodDescription/gco:CharacterString'),
        ('did_pass', False, 'bool', 'child::gmd:result/gmd:DQ_ConformanceResult/gmd:pass/gco:Boolean'),
        ('explanation', False, 'str', 'child::gmd:result/gmd:DQ_ConformanceResult/gmd:explanation/gco:CharacterString'),
        ('specification', False, 'str', 'child::gmd:result/gmd:DQ_ConformanceResult/gmd:specification/@xlink:title'),
        ('specification_hyperlink', False, 'str', 'child::gmd:result/gmd:DQ_ConformanceResult/gmd:specification/@xlink:href'),
        ('title', False, 'str', 'child::gmd:result/gmd:DQ_ConformanceResult/gmd:specification/gmd:CI_Citation/gmd:title/gco:CharacterString'),
        ('type', False, 'str', 'child::gmd:result/@xlink:title'),
        ('type_hyperlink', False, 'str', 'child::gmd:result/@xlink:href'),
    ]

    return set_attributes(typeset.quality.Evaluation(), xml, nsmap, decodings)
Beispiel #29
0
def decode_doc_meta_info(xml, nsmap):
    """Decodes an instance of the following type: doc meta info.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.DocMetaInfo

    """
    decodings = [
        ('author', False, decode_responsible_party,
         'child::cim:documentAuthor'),
        ('create_date', False, 'datetime.datetime',
         'child::cim:documentCreationDate'),
        ('external_ids', True, decode_standard_name, 'child::cim:externalID'),
        ('genealogy', False, decode_doc_genealogy,
         'child::cim:documentGenealogy'),
        ('id', False, 'uuid.UUID', 'child::cim:documentID'),
        ('version', False, 'int', 'child::cim:documentVersion'),
    ]

    return set_attributes(typeset.shared.DocMetaInfo(), xml, nsmap, decodings)
def decode_boundary_condition(xml, nsmap):
    """Decodes an instance of the following type: boundary condition.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.BoundaryCondition

    """
    decodings = [
        ('description', False, 'unicode', 'child::cim:description'),
        ('id', False, 'unicode', 'child::cim:id'),
        ('name', False, 'unicode', 'child::cim:name'),
        ('options', True, decode_numerical_requirement_option, 'child::cim:requirementOption'),
        ('source', False, decode_component_property, 'child::cim:source/cim:source/cim:componentProperty'),
        ('source', False, decode_data_content, 'child::cim:source/cim:source/cim:dataContent'),
        ('source', False, decode_data_object, 'child::cim:source/cim:source/cim:dataObject'),
        ('source', False, decode_doc_reference, 'child::cim:source/cim:reference'),
        ('source', False, decode_model_component, 'child::cim:source/cim:source/cim:softwareComponent'),
        ('source', False, decode_processor_component, 'child::cim:source/cim:source/cim:softwareComponent'),
        ('source', False, decode_statistical_model_component, 'child::cim:source/cim:source/cim:softwareComponent'),
    ]

    return set_attributes(typeset.activity.BoundaryCondition(), xml, nsmap, decodings)
def decode_data_object(xml, nsmap):
    """Decodes an instance of the following type: data object.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.data.DataObject

    """
    decodings = [
        ('acronym', False, 'str', 'child::cim:acronym'),
        ('citations', True, decode_citation, '//cim:citation[not(cim:citation)]'),
        ('content', True, decode_data_content, 'child::cim:content'),
        ('data_status', False, 'str', 'self::cim:dataObject/@dataStatus'),
        ('description', False, 'str', 'child::cim:description'),
        ('distribution', False, decode_data_distribution, 'child::cim:distribution'),
        ('extent', False, decode_data_extent, 'child::cim:extent'),
        ('hierarchy_level', False, decode_data_hierarchy_level, 'self::cim:dataObject'),
        ('keyword', False, 'str', 'child::cim:keyword'),
        ('meta', False, decode_doc_meta_info, 'self::cim:dataObject'),
        ('properties', True, decode_data_property, 'child::cim:dataProperty/cim:dataProperty'),
        ('purpose', False, 'str', 'self::cim:dataObject/@purpose'),
        ('purpose', False, 'str', 'self::cim:dataObject/@purpose'),
        ('storage', True, decode_data_storage_ip, 'child::cim:storage/cim:ipStorage'),
    ]

    return set_attributes(typeset.data.DataObject(), xml, nsmap, decodings)
def decode_numerical_experiment(xml, nsmap):
    """Decodes an instance of the following type: numerical experiment.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.NumericalExperiment

    """
    decodings = [
        ('description', False, 'unicode', 'child::cim:description'),
        ('experiment_id', False, 'unicode', 'child::cim:experimentID'),
        ('funding_sources', True, 'unicode', 'child::cim:fundingSource'),
        ('long_name', False, 'unicode', 'child::cim:longName'),
        ('meta', False, decode_doc_meta_info, 'self::cim:numericalExperiment'),
        ('projects', True, 'unicode', 'child::cim:project/@value'),
        ('rationales', True, 'unicode', 'child::cim:rationale'),
        ('requirements', True, decode_boundary_condition, 'child::cim:numericalRequirement/cim:boundaryCondition'),
        ('requirements', True, decode_boundary_condition, 'child::cim:numericalRequirement[@xsi:type="BoundaryCondition"]'),
        ('requirements', True, decode_initial_condition, 'child::cim:numericalRequirement/cim:initialCondition'),
        ('requirements', True, decode_initial_condition, 'child::cim:numericalRequirement[@xsi:type="InitialCondition"]'),
        ('requirements', True, decode_lateral_boundary_condition, 'child::cim:numericalRequirement/cim:lateralBoundaryCondition'),
        ('requirements', True, decode_lateral_boundary_condition, 'child::cim:numericalRequirement[@xsi:type="LateralBoundaryCondition"]'),
        ('requirements', True, decode_output_requirement, 'child::cim:numericalRequirement/cim:outputRequirement'),
        ('requirements', True, decode_output_requirement, 'child::cim:numericalRequirement[@xsi:type="OutputRequirement"]'),
        ('requirements', True, decode_spatio_temporal_constraint, 'child::cim:numericalRequirement/cim:spatioTemporalConstraint'),
        ('requirements', True, decode_spatio_temporal_constraint, 'child::cim:numericalRequirement[@xsi:type="SpatioTemporalConstraint"]'),
        ('responsible_parties', True, decode_responsible_party, 'child::cim:responsibleParty'),
        ('short_name', False, 'unicode', 'child::cim:shortName'),
    ]

    return set_attributes(typeset.activity.NumericalExperiment(), xml, nsmap, decodings)
def decode_machine(xml, nsmap):
    """Decodes an instance of the following type: machine.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.Machine

    """
    decodings = [
        ('cores_per_processor', False, 'int', 'child::cim:machineCoresPerProcessor'),
        ('description', False, 'unicode', 'child::cim:machineDescription'),
        ('interconnect', False, 'unicode', 'child::cim:machineInterconnect/@value'),
        ('libraries', True, 'unicode', 'child::cim:machineLibrary'),
        ('location', False, 'unicode', 'child::cim:machineLocation'),
        ('maximum_processors', False, 'int', 'child::cim:machineMaximumProcessors'),
        ('name', False, 'unicode', 'child::cim:machineName'),
        ('operating_system', False, 'unicode', 'child::cim:machineOperatingSystem/@value'),
        ('processor_type', False, 'unicode', 'child::cim:machineProcessorType/@value'),
        ('system', False, 'unicode', 'child::cim:machineSystem'),
        ('type', False, 'unicode', '@machineType'),
        ('vendor', False, 'unicode', 'child::cim:machineVendor/@value'),
    ]

    return set_attributes(typeset.shared.Machine(), xml, nsmap, decodings)
Beispiel #34
0
def decode_responsible_party(xml, nsmap):
    """Decodes an instance of the following type: responsible party.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.ResponsibleParty

    """
    decodings = [
        ('abbreviation', False, 'str', 'child::cim:abbreviation'),
        ('contact_info', False, decode_responsible_party_contact_info,
         'child::gmd:contactInfo/gmd:CI_Contact'),
        ('individual_name', False, 'str',
         'child::gmd:individualName/gco:CharacterString'),
        ('organisation_name', False, 'str',
         'child::gmd:organisationName/gco:CharacterString'),
        ('role', False, 'str', 'gmd:role/gmd:CI_RoleCode/@codeListValue'),
    ]

    return set_attributes(typeset.shared.ResponsibleParty(), xml, nsmap,
                          decodings)
def decode_numerical_requirement_option(xml, nsmap):
    """Decodes an instance of the following type: numerical requirement option.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.NumericalRequirementOption

    """
    decodings = [
        ('description', False, 'unicode', 'child::cim:description'),
        ('description', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:boundaryCondition/cim:description'),
        ('description', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:initialCondition/cim:description'),
        ('description', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:lateralBoundaryCondition/cim:description'),
        ('description', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:outputRequirement/cim:description'),
        ('description', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:spatioTemporalConstraint/cim:description'),
        ('id', False, 'unicode', 'child::cim:id'),
        ('id', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:boundaryCondition/cim:id'),
        ('id', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:initialCondition/cim:id'),
        ('id', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:lateralBoundaryCondition/cim:id'),
        ('id', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:outputRequirement/cim:id'),
        ('id', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:spatioTemporalConstraint/cim:id'),
        ('name', False, 'unicode', 'child::cim:name'),
        ('name', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:boundaryCondition/cim:name'),
        ('name', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:initialCondition/cim:name'),
        ('name', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:lateralBoundaryCondition/cim:name'),
        ('name', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:outputRequirement/cim:name'),
        ('name', False, 'unicode', 'child::cim:requirement/cim:requirement/cim:spatioTemporalConstraint/cim:name'),
        ('relationship', False, 'unicode', 'self::cim:requirementOption/@optionRelationship'),
    ]

    return set_attributes(typeset.activity.NumericalRequirementOption(), xml, nsmap, decodings)
def decode_grid_mosaic(xml, nsmap):
    """Decodes an instance of the following type: grid mosaic.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.grids.GridMosaic

    """
    decodings = [
        ('citations', True, decode_citation, 'child::cim:citationList/cim:citation'),
        ('description', False, 'str', 'child::cim:description'),
        ('has_congruent_tiles', False, 'bool', '@congruentTiles'),
        ('id', False, 'str', '@id'),
        ('is_leaf', False, 'bool', '@isLeaf'),
        ('long_name', False, 'str', 'child::cim:longName'),
        ('mnemonic', False, 'str', 'child::cim:mnemonic'),
        ('mosaic_count', False, 'int', '@numMosaics'),
        ('mosaics', True, decode_grid_mosaic, 'child::cim:gridMosaic'),
        ('short_name', False, 'str', 'child::cim:shortName'),
        ('tile_count', False, 'int', '@numTiles'),
        ('tiles', True, decode_grid_tile, 'child::cim:gridTile'),
        ('type', False, 'str', '@gridType'),
    ]

    return set_attributes(typeset.grids.GridMosaic(), xml, nsmap, decodings)
def decode_conformance(xml, nsmap):
    """Decodes an instance of the following type: conformance.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.Conformance

    """
    decodings = [
        ("description", False, "str", "child::cim:description"),
        ("frequency", False, "str", "child::cim:frequency"),
        ("is_conformant", False, "bool", "@conformant"),
        ("requirements", True, decode_initial_condition, "child::cim:requirement/cim:requirement/cim:initialCondition"),
        (
            "requirements",
            True,
            decode_boundary_condition,
            "child::cim:requirement/cim:requirement/cim:boundaryCondition",
        ),
        (
            "requirements",
            True,
            decode_lateral_boundary_condition,
            "child::cim:requirement/cim:requirement/cim:lateralBoundaryCondition",
        ),
        (
            "requirements",
            True,
            decode_spatio_temporal_constraint,
            "child::cim:requirement/cim:requirement/cim:spatioTemporalConstraint",
        ),
        (
            "requirements",
            True,
            decode_output_requirement,
            "child::cim:requirement/cim:requirement/cim:outputRequirement",
        ),
        ("requirements_references", True, decode_doc_reference, "child::cim:requirement/cim:reference"),
        ("sources", True, decode_data_object, "child::cim:source/cim:source/cim:dataObject"),
        ("sources", True, decode_data_content, "child::cim:source/cim:source/cim:dataContent"),
        ("sources", True, decode_component_property, "child::cim:source/cim:source/cim:componentProperty"),
        ("sources", True, decode_model_component, "child::cim:source/cim:source/cim:softwareComponent"),
        ("sources", True, decode_processor_component, "child::cim:source/cim:source/cim:softwareComponent"),
        ("sources", True, decode_statistical_model_component, "child::cim:source/cim:source/cim:softwareComponent"),
        ("sources_references", True, decode_doc_reference, "child::cim:source/cim:reference"),
        ("type", False, "str", "@type"),
    ]

    return set_attributes(typeset.activity.Conformance(), xml, nsmap, decodings)
Beispiel #38
0
def decode_coupling(xml, nsmap):
    """Decodes an instance of the following type: coupling.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.Coupling

    """
    decodings = [
        ('connections', True, decode_connection, 'child::cim:connection'),
        ('description', False, 'str', 'child::cim:description'),
        ('is_fully_specified', False, 'bool', '@fullySpecified'),
        ('priming', False, decode_data_object,
         'child::cim:priming/cim:priming/cim:dataObject'),
        ('priming', False, decode_data_content,
         'child::cim:priming/cim:priming/cim:dataContent'),
        ('priming', False, decode_component_property,
         'child::cim:priming/cim:priming/cim:componentProperty'),
        ('priming', False, decode_model_component,
         'child::cim:priming/cim:priming/cim:softwareComponent'),
        ('priming', False, decode_processor_component,
         'child::cim:priming/cim:priming/cim:softwareComponent'),
        ('priming', False, decode_statistical_model_component,
         'child::cim:priming/cim:priming/cim:softwareComponent'),
        ('priming_reference', False, decode_doc_reference,
         'child::cim:priming/cim:reference'),
        ('properties', True, decode_coupling_property,
         'child::cim:couplingProperty'),
        ('purpose', False, 'str', '@purpose'),
        ('sources', True, decode_coupling_endpoint,
         'child::cim:couplingSource'),
        ('spatial_regriddings', True, decode_spatial_regridding,
         'child::cim:spatialRegridding'),
        ('target', False, decode_coupling_endpoint,
         'child::cim:couplingTarget'),
        ('time_lag', False, decode_time_lag, 'child::cim:timeLag'),
        ('time_profile', False, decode_timing, 'child::cim:timeProfile'),
        ('time_transformation', False, decode_time_transformation,
         'child::cim:timeTransformation'),
        ('transformers', True, decode_processor_component,
         'child::cim:transformer/cim:processorComponent'),
        ('transformers_references', True, decode_doc_reference,
         'child::cim:transformer/cim:reference'),
        ('type', False, 'str', 'child::cim:type/@value'),
    ]

    return set_attributes(typeset.software.Coupling(), xml, nsmap, decodings)
def decode_simulation_relationship_target(xml, nsmap):
    """Decodes an instance of the following type: simulation relationship target.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.SimulationRelationshipTarget

    """
    decodings = [
    ]

    return set_attributes(typeset.activity.SimulationRelationshipTarget(), xml, nsmap, decodings)
def decode_license(xml, nsmap):
    """Decodes an instance of the following type: license.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.License

    """
    decodings = [
    ]

    return set_attributes(typeset.shared.License(), xml, nsmap, decodings)
def decode_simple_grid_geometry(xml, nsmap):
    """Decodes an instance of the following type: simple grid geometry.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.grids.SimpleGridGeometry

    """
    decodings = [
    ]

    return set_attributes(typeset.grids.SimpleGridGeometry(), xml, nsmap, decodings)
def decode_experiment_relationship(xml, nsmap):
    """Decodes an instance of the following type: experiment relationship.

    :param lxml.etree xml: XML from which type is to be decoded.
    :param dict nsmap: XML namespace mappings.

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.activity.ExperimentRelationship

    """
    decodings = [
    ]

    return set_attributes(typeset.activity.ExperimentRelationship(), xml, nsmap, decodings)
Beispiel #43
0
def decode_data_storage_db(xml, nsmap):
    """Decodes an instance of the following type: data storage db.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.data.DataStorageDb

    """
    decodings = []

    return set_attributes(typeset.data.DataStorageDb(), xml, nsmap, decodings)
Beispiel #44
0
def decode_relationship(xml, nsmap):
    """Decodes an instance of the following type: relationship.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.Relationship

    """
    decodings = []

    return set_attributes(typeset.shared.Relationship(), xml, nsmap, decodings)
Beispiel #45
0
def decode_entry_point(xml, nsmap):
    """Decodes an instance of the following type: entry point.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.EntryPoint

    """
    decodings = []

    return set_attributes(typeset.software.EntryPoint(), xml, nsmap, decodings)
Beispiel #46
0
def decode_date_range(xml, nsmap):
    """Decodes an instance of the following type: date range.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.DateRange

    """
    decodings = [
        ('duration', False, 'str', 'child::cim:duration'),
    ]

    return set_attributes(typeset.shared.DateRange(), xml, nsmap, decodings)
Beispiel #47
0
def decode_component_language(xml, nsmap):
    """Decodes an instance of the following type: component language.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.ComponentLanguage

    """
    decodings = [
        ('name', False, 'str', 'child::cim:name'),
    ]

    return set_attributes(typeset.software.ComponentLanguage(), xml, nsmap,
                          decodings)
Beispiel #48
0
def decode_time_lag(xml, nsmap):
    """Decodes an instance of the following type: time lag.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.TimeLag

    """
    decodings = [
        ('units', False, 'str', '@units'),
        ('value', False, 'int', 'child::cim:value'),
    ]

    return set_attributes(typeset.software.TimeLag(), xml, nsmap, decodings)
Beispiel #49
0
def decode_data_storage_ip(xml, nsmap):
    """Decodes an instance of the following type: data storage ip.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.data.DataStorageIp

    """
    decodings = [
        ('fileName', False, 'str', 'child::cim:fileName'),
        ('format', False, 'str', 'child::cim:dataFormat/@value'),
    ]

    return set_attributes(typeset.data.DataStorageIp(), xml, nsmap, decodings)
Beispiel #50
0
def decode_doc_genealogy(xml, nsmap):
    """Decodes an instance of the following type: doc genealogy.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.DocGenealogy

    """
    decodings = [
        ('relationships', True, decode_doc_relationship,
         'child::cim:relationship/cim:documentRelationship'),
    ]

    return set_attributes(typeset.shared.DocGenealogy(), xml, nsmap, decodings)
Beispiel #51
0
def decode_doc_relationship_target(xml, nsmap):
    """Decodes an instance of the following type: doc relationship target.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.DocRelationshipTarget

    """
    decodings = [
        ('reference', False, decode_doc_reference, 'child::cim:reference'),
    ]

    return set_attributes(typeset.shared.DocRelationshipTarget(), xml, nsmap,
                          decodings)
Beispiel #52
0
def decode_property(xml, nsmap):
    """Decodes an instance of the following type: property.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.Property

    """
    decodings = [
        ('name', False, 'str', 'child::cim:name'),
        ('value', False, 'str', 'child::cim:value'),
    ]

    return set_attributes(typeset.shared.Property(), xml, nsmap, decodings)
def decode_grid_tile_resolution_type(xml, nsmap):
    """Decodes an instance of the following type: grid tile resolution type.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.grids.GridTileResolutionType

    """
    decodings = [
        ('description', False, 'str', '@description'),
        ('properties', True, decode_grid_property, 'child::cim:property'),
    ]

    return set_attributes(typeset.grids.GridTileResolutionType(), xml, nsmap, decodings)
Beispiel #54
0
def decode_cim_quality(xml, nsmap):
    """Decodes an instance of the following type: cim quality.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.quality.CimQuality

    """
    decodings = [
        ('meta', False, decode_doc_meta_info, 'self::cim:cIM_Quality'),
        ('reports', True, decode_report, 'child::cim:report'),
    ]

    return set_attributes(typeset.quality.CimQuality(), xml, nsmap, decodings)
Beispiel #55
0
def decode_statistical_model_component(xml, nsmap):
    """Decodes an instance of the following type: statistical model component.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.software.StatisticalModelComponent

    """
    decodings = [
        ('citations', True, decode_citation, 'child::cim:citation'),
        ('description', False, 'str', 'child::cim:description'),
        ('language', False, decode_component_language,
         'child::cim:componentLanguage'),
        ('long_name', False, 'str', 'child::cim:longName'),
        ('meta', False, decode_doc_meta_info,
         'self::cim:statisticalModelComponent'),
        ('properties', True, decode_component_property,
         'child::cim:componentProperties/cim:componentProperty'),
        ('properties', True, decode_component_property,
         'child::cim:scientificProperties/cim:componentProperty'),
        ('properties', True, decode_component_property,
         'child::cim:numericalProperties/cim:componentProperty'),
        ('release_date', False, 'datetime.datetime', 'child::cim:releaseDate'),
        ('responsible_parties', True, decode_responsible_party,
         'child::cim:responsibleParty'),
        ('short_name', False, 'str', 'child::cim:shortName'),
        ('sub_components', True, decode_model_component,
         'child::cim:childComponent/cim:modelComponent'),
        ('sub_components', True, decode_processor_component,
         'child::cim:childComponent/cim:processorComponent'),
        ('timing', False, decode_timing, 'child::cim:timing'),
        ('type', False, 'str', 'child::cim:type[1]/@value'),
        ('types', True, 'str', 'child::cim:type/@value'),
    ]

    return set_attributes(typeset.software.StatisticalModelComponent(), xml,
                          nsmap, decodings)
def decode_coordinate_list(xml, nsmap):
    """Decodes an instance of the following type: coordinate list.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.grids.CoordinateList

    """
    decodings = [
        ('has_constant_offset', False, 'bool', '@hasConstantOffset'),
        ('length', False, 'int', '@length'),
        ('uom', False, 'str', '@uom'),
    ]

    return set_attributes(typeset.grids.CoordinateList(), xml, nsmap, decodings)
Beispiel #57
0
def decode_machine_compiler_unit(xml, nsmap):
    """Decodes an instance of the following type: machine compiler unit.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.MachineCompilerUnit

    """
    decodings = [
        ('compilers', True, decode_compiler, 'child::cim:compiler'),
        ('machine', False, decode_machine, 'child::cim:machine'),
    ]

    return set_attributes(typeset.shared.MachineCompilerUnit(), xml, nsmap,
                          decodings)
Beispiel #58
0
def decode_standard(xml, nsmap):
    """Decodes an instance of the following type: standard.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.Standard

    """
    decodings = [
        ('description', False, 'str', 'child::cim:description'),
        ('name', False, 'str', 'child::cim:name'),
        ('version', False, 'str', 'child::cim:version'),
    ]

    return set_attributes(typeset.shared.Standard(), xml, nsmap, decodings)
Beispiel #59
0
def decode_standard_name(xml, nsmap):
    """Decodes an instance of the following type: standard name.

    :param xml: XML from which type is to be decoded.
    :type xml: lxml.etree

    :param nsmap: XML namespace mappings.
    :type nsmap: dict

    :returns: A decoded type instance.
    :rtype: cim.v1.typeset.shared.StandardName

    """
    decodings = [
        ('is_open', False, 'bool', '@open'),
        ('standards', True, decode_standard, 'child::cim:standard'),
        ('value', False, 'str', '@value'),
    ]

    return set_attributes(typeset.shared.StandardName(), xml, nsmap, decodings)