module ADIWG::Mdtranslator::Readers::Fgdc::GeologicAge

Public Class Methods

unpack(xGeoAge, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/readers/fgdc/modules/module_geologicAge.rb, line 18
def self.unpack(xGeoAge, hResponseObj)

   # instance classes needed in script
   intMetadataClass = InternalMetadata.new
   intGeoAge = intMetadataClass.newGeologicAge

   # geologic age bio (geolscal) - time scale (required)
   scale = xGeoAge.xpath('./geolscal').text
   unless scale.empty?
      intGeoAge[:ageTimeScale] = scale
   end
   if scale.empty?
      hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO geologic age time scale is missing'
   end

   # geologic age bio (geolest) - age estimate (required)
   estimate = xGeoAge.xpath('./geolest').text
   unless estimate.empty?
      intGeoAge[:ageEstimate] = estimate
   end
   if estimate.empty?
      hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO geologic age estimate is missing'
   end

   # geologic age bio (geolun) - age estimate uncertainty
   uncertain = xGeoAge.xpath('./geolun').text
   unless uncertain.empty?
      intGeoAge[:ageUncertainty] = uncertain
   end

   # geologic age bio (geolexpl) - explanation
   explain = xGeoAge.xpath('./geolexpl').text
   unless explain.empty?
      intGeoAge[:ageExplanation] = explain
   end

   # geologic age bio (geolcit) - age references [] {citation}
   axReferences = xGeoAge.xpath('./geolcit')
   unless axReferences.empty?
      axReferences.each do |xCitation|
         hCitation = Citation.unpack(xCitation, hResponseObj)
         intGeoAge[:ageReferences] << hCitation unless hCitation.nil?
      end
   end

   return intGeoAge

end