Class | Eml |
In: |
lib/eml.rb
|
Parent: | Object |
The goal of this object is to encapsulate a dom representation of an EML(knb.ecoinformatics.org/software/eml) document and provide quick helper methods to access commonly needed attributes. These methods will return a more "ruby friendly" representation of this metadata.
At their core Eml objects contain a REXML::Document in the instance variable @doc. Until this object is feature-complete, this dom document can be used when this object is returned from this module’s Metacat client.
metacat = Metacat.new('http://data.piscoweb.org/catalog/metacat') eml_object = metacat.find(:docid => 'HMS001_020ADCP019R00_20060612.50.1') geographic_coverage = eml_object.geographic_coverage => [{ "latitude"=>-121.8996, "longitude"=>36.6214, "id"=>"HMS001", "description"=> "Hopkins Marine Station: HMS001: This inner-shelf mooring is located offshore of the city of Monterey, California, USA, near Hopkins Marine Station. The mooring is located in an overall water depth of 020 meters (referenced to Mean Sea Level, MSL). The altitudeMinimum and altitudeMaximum tags in this initial coverage section refer to the ADCP measurement range and are also referenced to MSL. They do not represent the overall water depth. Note the nominal range of the ADCP may extend from near-bottom (a depth expressed as a negative altitude) to slightly above MSL (a height expressed as a positive altitude)."}]
eml_object.data_tables.each do |data_table| file = File.new("./store/#{data_table.id}") # data_table is an object, with method read data_table.read do |buffer| file.write(buffer) end file.close() end