Module: ADIWG::Mdtranslator::Readers::Fgdc::GeologicAge

Defined in:
lib/adiwg/mdtranslator/readers/fgdc/modules/module_geologicAge.rb

Class Method Summary collapse

Class Method Details

.unpack(xGeoAge, hResponseObj) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/module_geologicAge.rb', line 18

def self.unpack(xGeoAge, hResponseObj)

   # instance classes needed in script
   intMetadataClass = .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