adiwg-mdtranslator 2.20.0.pre.beta.5 → 2.21.0.pre.beta.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/Gemfile.lock +3 -3
- data/README.md +0 -21
- data/Rakefile +0 -1
- data/adiwg-mdtranslator.gemspec +1 -1
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +45 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +133 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_environment.rb +47 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb +88 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrument.rb +73 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEvent.rb +77 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEventList.rb +62 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +11 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_objective.rb +104 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_operation.rb +119 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_pass.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_plan.rb +80 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb +87 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requestedDate.rb +51 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb +98 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_revision.rb +50 -0
- data/lib/adiwg/mdtranslator/version.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_acquisition.rb +199 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +19 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_environment.rb +58 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_event.rb +121 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_instrument.rb +98 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_instrumentationEvent.rb +84 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_instrumentationEventList.rb +90 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_objective.rb +155 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_operation.rb +178 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_pass.rb +72 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_plan.rb +93 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_platform.rb +117 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_requestedDate.rb +33 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_requirement.rb +139 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_revision.rb +55 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb +42 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_environment.rb +28 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb +37 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrument.rb +35 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEvent.rb +30 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb +32 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadata.rb +2 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_objective.rb +37 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_operation.rb +34 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_pass.rb +30 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_plan.rb +32 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_platform.rb +35 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requestedDate.rb +26 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requirement.rb +36 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_revision.rb +28 -0
- data/lib/adiwg/mdtranslator_cli.rb +1 -1
- metadata +45 -36
- data/DCAT-US.md +0 -67
- data/lib/adiwg/mdtranslator/writers/dcat_us/dcat_us_writer.rb +0 -98
- data/lib/adiwg/mdtranslator/writers/dcat_us/readme.md +0 -10
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_access_level.rb +0 -55
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_access_url.rb +0 -17
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_accrualPeriodicity.rb +0 -45
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_bureau_code.rb +0 -33
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_contact_point.rb +0 -29
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_dcat_us.rb +0 -104
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_described_by.rb +0 -29
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_described_by_type.rb +0 -33
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_description.rb +0 -19
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_distribution.rb +0 -59
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_download_url.rb +0 -17
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_identifier.rb +0 -29
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_is_part_of.rb +0 -27
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_issued.rb +0 -19
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_keyword.rb +0 -19
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_landing_page.rb +0 -27
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_language.rb +0 -23
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_license.rb +0 -18
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_media_type.rb +0 -17
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_modified.rb +0 -29
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_primaryITInvestmentUII.rb +0 -19
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_program_code.rb +0 -33
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_publisher.rb +0 -74
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_references.rb +0 -50
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_rights.rb +0 -32
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_spatial.rb +0 -32
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_system_of_records.rb +0 -28
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_temporal.rb +0 -40
- data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_theme.rb +0 -28
- data/lib/adiwg/mdtranslator/writers/dcat_us/version.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24a46249aaab639bcbfcf96546503546a9474db0aaf8d3d9136190cbd7ae2c19
|
4
|
+
data.tar.gz: da85309bcd6c126043a653d5e436535d7d29c4eb2107a416acb1cdc4575d3696
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 966ff66ba5977d8f190b38535637cf43b0d346291ed81928179814b8bbb081a2967d56bba02f80847525e0f86fce8c0e1d405d71fbd7dcf1338c7cc5e2c2a31c
|
7
|
+
data.tar.gz: ae9ec9bd0c85646c0b7b99d79adda40be5ea40de1bb14eb133471028a3b9800b86138591abf2e1c87d6c3bc8e5e07741a66f816755558823cdc76697d30b9845
|
data/.github/workflows/test.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
adiwg-mdtranslator (2.
|
4
|
+
adiwg-mdtranslator (2.21.0.pre.beta.0)
|
5
5
|
adiwg-mdcodes (= 2.10.0)
|
6
|
-
adiwg-mdjson_schemas (= 2.
|
6
|
+
adiwg-mdjson_schemas (= 2.10.0.pre.beta.5)
|
7
7
|
builder (~> 3.2)
|
8
8
|
coderay (~> 1.1)
|
9
9
|
jbuilder (~> 2.5)
|
@@ -37,7 +37,7 @@ GEM
|
|
37
37
|
public_suffix (>= 2.0.2, < 6.0)
|
38
38
|
adiwg-mdcodes (2.10.0)
|
39
39
|
json (~> 2.0)
|
40
|
-
adiwg-mdjson_schemas (2.
|
40
|
+
adiwg-mdjson_schemas (2.10.0.pre.beta.5)
|
41
41
|
base64 (0.2.0)
|
42
42
|
bigdecimal (3.1.8)
|
43
43
|
builder (3.2.4)
|
data/README.md
CHANGED
@@ -23,27 +23,6 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
$ mdtranslator help translate
|
25
25
|
|
26
|
-
## Development
|
27
|
-
|
28
|
-
### Requirements
|
29
|
-
|
30
|
-
Requires
|
31
|
-
- [Ruby](https://www.ruby-lang.org/en/documentation/installation/)
|
32
|
-
- bundler (`gem install bundler`)
|
33
|
-
- rake (`gem install rake`)
|
34
|
-
|
35
|
-
### Tests
|
36
|
-
|
37
|
-
In order to run the tests, first install the dependencies
|
38
|
-
|
39
|
-
$ bundle install
|
40
|
-
|
41
|
-
Then, run the rake command
|
42
|
-
|
43
|
-
$ bundle exec rake
|
44
|
-
|
45
|
-
_TODO: There are currently 4 tests that are not passing, related to mdJSON readers and writers_
|
46
|
-
|
47
26
|
## Contributing
|
48
27
|
|
49
28
|
1. Fork it ( https://github.com/[my-github-username]/mdTranslator/fork )
|
data/Rakefile
CHANGED
data/adiwg-mdtranslator.gemspec
CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_runtime_dependency "thor", "~> 0.19"
|
35
35
|
spec.add_runtime_dependency "uuidtools", "~> 2.1"
|
36
36
|
spec.add_runtime_dependency "json-schema", "~> 2.7"
|
37
|
-
spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.
|
37
|
+
spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.10.0.pre.beta.5"
|
38
38
|
spec.add_runtime_dependency "adiwg-mdcodes", "2.10.0"
|
39
39
|
spec.add_runtime_dependency "jbuilder", "~> 2.5"
|
40
40
|
spec.add_runtime_dependency "kramdown", ">= 1.13", "< 3.0"
|
@@ -143,7 +143,8 @@ class InternalMetadata
|
|
143
143
|
associatedResources: [],
|
144
144
|
additionalDocuments: [],
|
145
145
|
funding: [],
|
146
|
-
dataQuality: []
|
146
|
+
dataQuality: [],
|
147
|
+
acquisitions: []
|
147
148
|
}
|
148
149
|
end
|
149
150
|
|
@@ -158,6 +159,7 @@ class InternalMetadata
|
|
158
159
|
# acquisition ----------------------------
|
159
160
|
def newAcquisition
|
160
161
|
{
|
162
|
+
scope: {},
|
161
163
|
plans: [],
|
162
164
|
requirements: [],
|
163
165
|
objectives: [],
|
@@ -175,19 +177,23 @@ class InternalMetadata
|
|
175
177
|
averageAirTemperature: nil,
|
176
178
|
maxRelativeHumidity: nil,
|
177
179
|
maxAltitude: nil,
|
178
|
-
meteorologicalConditions: nil
|
180
|
+
meteorologicalConditions: nil,
|
181
|
+
solarAzimuth: nil,
|
182
|
+
solarElevation: nil
|
183
|
+
|
179
184
|
}
|
180
185
|
end
|
181
186
|
|
182
187
|
def newEvent
|
183
188
|
{
|
184
189
|
eventId: nil,
|
190
|
+
identifier: {},
|
185
191
|
trigger: nil,
|
186
192
|
context: nil,
|
187
193
|
sequence: nil,
|
188
194
|
dateTime: nil,
|
189
195
|
expectedObjectives: [],
|
190
|
-
relatedPass:
|
196
|
+
relatedPass: {},
|
191
197
|
relatedSensors: []
|
192
198
|
}
|
193
199
|
end
|
@@ -199,7 +205,29 @@ class InternalMetadata
|
|
199
205
|
identifier: {},
|
200
206
|
instrumentType: nil,
|
201
207
|
description: nil,
|
202
|
-
mountedOn:
|
208
|
+
mountedOn: {},
|
209
|
+
histories: [],
|
210
|
+
hostId: {}
|
211
|
+
}
|
212
|
+
end
|
213
|
+
|
214
|
+
def newInstrumentationEvent
|
215
|
+
{
|
216
|
+
citations: [],
|
217
|
+
description: nil,
|
218
|
+
extent: {},
|
219
|
+
eventType: nil,
|
220
|
+
revisionHistories: [],
|
221
|
+
}
|
222
|
+
end
|
223
|
+
|
224
|
+
def newInstrumentationEventList
|
225
|
+
{
|
226
|
+
citation: {},
|
227
|
+
description: nil,
|
228
|
+
locale: {},
|
229
|
+
constraints: [],
|
230
|
+
instrumentationEvents: []
|
203
231
|
}
|
204
232
|
end
|
205
233
|
|
@@ -240,14 +268,15 @@ class InternalMetadata
|
|
240
268
|
def newOperation
|
241
269
|
{
|
242
270
|
operationId: nil,
|
271
|
+
description: nil,
|
243
272
|
citation: {},
|
244
273
|
identifier: {},
|
245
274
|
status: nil,
|
246
275
|
operationType: nil,
|
247
276
|
objectives: [],
|
248
|
-
|
277
|
+
parentOperation: {},
|
249
278
|
childOperations: [],
|
250
|
-
plan:
|
279
|
+
plan: {},
|
251
280
|
platforms: [],
|
252
281
|
significantEvents: []
|
253
282
|
}
|
@@ -267,6 +296,14 @@ class InternalMetadata
|
|
267
296
|
}
|
268
297
|
end
|
269
298
|
|
299
|
+
def newRevision
|
300
|
+
{
|
301
|
+
description: nil,
|
302
|
+
responsibleParty: {},
|
303
|
+
dateInfo: []
|
304
|
+
}
|
305
|
+
end
|
306
|
+
|
270
307
|
def newPlatform
|
271
308
|
{
|
272
309
|
platformId: nil,
|
@@ -274,7 +311,8 @@ class InternalMetadata
|
|
274
311
|
identifier: {},
|
275
312
|
description: nil,
|
276
313
|
sponsors: [],
|
277
|
-
instruments: []
|
314
|
+
instruments: [],
|
315
|
+
history: []
|
278
316
|
}
|
279
317
|
end
|
280
318
|
|
@@ -0,0 +1,133 @@
|
|
1
|
+
require_relative 'module_scope'
|
2
|
+
require_relative 'module_objective'
|
3
|
+
require_relative 'module_requirement'
|
4
|
+
require_relative 'module_platform'
|
5
|
+
require_relative 'module_instrument'
|
6
|
+
require_relative 'module_operation'
|
7
|
+
require_relative 'module_pass'
|
8
|
+
require_relative 'module_event'
|
9
|
+
require_relative 'module_environment'
|
10
|
+
require_relative 'module_plan'
|
11
|
+
|
12
|
+
module ADIWG
|
13
|
+
module Mdtranslator
|
14
|
+
module Readers
|
15
|
+
module MdJson
|
16
|
+
|
17
|
+
module Acquisition
|
18
|
+
|
19
|
+
def self.unpack(hAcquisition, responseObj, inContext = nil)
|
20
|
+
|
21
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
22
|
+
|
23
|
+
outContext = 'acquisition'
|
24
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
25
|
+
|
26
|
+
# instance classes needed in script
|
27
|
+
intMetadataClass = InternalMetadata.new
|
28
|
+
intAcquisition = intMetadataClass.newAcquisition
|
29
|
+
|
30
|
+
if hAcquisition.has_key?('scope')
|
31
|
+
unless hAcquisition['scope'].empty?
|
32
|
+
hReturn = Scope.unpack(hAcquisition['scope'], responseObj, outContext)
|
33
|
+
unless hReturn.nil?
|
34
|
+
intAcquisition[:scope] = hReturn
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
if hAcquisition.has_key?('plan')
|
40
|
+
aItems = hAcquisition['plan']
|
41
|
+
aItems.each do |item|
|
42
|
+
hReturn = Plan.unpack(item, responseObj, outContext)
|
43
|
+
unless hReturn.nil?
|
44
|
+
intAcquisition[:plans] << hReturn
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
if hAcquisition.has_key?('requirement')
|
50
|
+
aItems = hAcquisition['requirement']
|
51
|
+
aItems.each do |item|
|
52
|
+
hReturn = Requirement.unpack(item, responseObj, outContext)
|
53
|
+
unless hReturn.nil?
|
54
|
+
intAcquisition[:requirements] << hReturn
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
if hAcquisition.has_key?('objective')
|
60
|
+
aItems = hAcquisition['objective']
|
61
|
+
aItems.each do |item|
|
62
|
+
hReturn = Objective.unpack(item, responseObj, outContext)
|
63
|
+
unless hReturn.nil?
|
64
|
+
intAcquisition[:objectives] << hReturn
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
if hAcquisition.has_key?('platform')
|
70
|
+
aItems = hAcquisition['platform']
|
71
|
+
aItems.each do |item|
|
72
|
+
hReturn = Platform.unpack(item, responseObj, outContext)
|
73
|
+
unless hReturn.nil?
|
74
|
+
intAcquisition[:platforms] << hReturn
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
if hAcquisition.has_key?('instrument')
|
80
|
+
aItems = hAcquisition['instrument']
|
81
|
+
aItems.each do |item|
|
82
|
+
hReturn = Instrument.unpack(item, responseObj, outContext)
|
83
|
+
unless hReturn.nil?
|
84
|
+
intAcquisition[:instruments] << hReturn
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
if hAcquisition.has_key?('operation')
|
90
|
+
aItems = hAcquisition['operation']
|
91
|
+
aItems.each do |item|
|
92
|
+
hReturn = Operation.unpack(item, responseObj, outContext)
|
93
|
+
unless hReturn.nil?
|
94
|
+
intAcquisition[:operations] << hReturn
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
if hAcquisition.has_key?('event')
|
100
|
+
aItems = hAcquisition['event']
|
101
|
+
aItems.each do |item|
|
102
|
+
hReturn = Event.unpack(item, responseObj, outContext)
|
103
|
+
unless hReturn.nil?
|
104
|
+
intAcquisition[:events] << hReturn
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
if hAcquisition.has_key?('pass')
|
110
|
+
aItems = hAcquisition['pass']
|
111
|
+
aItems.each do |item|
|
112
|
+
hReturn = Pass.unpack(item, responseObj, outContext)
|
113
|
+
unless hReturn.nil?
|
114
|
+
intAcquisition[:passes] << hReturn
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
if hAcquisition.has_key?('environment')
|
120
|
+
intAcquisition[:environment] = Environment.unpack(hAcquisition['environment'], responseObj, outContext)
|
121
|
+
end
|
122
|
+
|
123
|
+
return intAcquisition
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module ADIWG
|
2
|
+
module Mdtranslator
|
3
|
+
module Readers
|
4
|
+
module MdJson
|
5
|
+
|
6
|
+
module Environment
|
7
|
+
def self.unpack(hEnvironment, responseObj, inContext = nil)
|
8
|
+
|
9
|
+
intMetadataClass = InternalMetadata.new
|
10
|
+
intEnvironment = intMetadataClass.newEnvironment
|
11
|
+
|
12
|
+
outContext = 'environment'
|
13
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
14
|
+
|
15
|
+
if hEnvironment.has_key?('averageAirTemperature')
|
16
|
+
intEnvironment[:averageAirTemperature] = hEnvironment['averageAirTemperature']
|
17
|
+
end
|
18
|
+
|
19
|
+
if hEnvironment.has_key?('maxRelativeHumidity')
|
20
|
+
intEnvironment[:maxRelativeHumidity] = hEnvironment['maxRelativeHumidity']
|
21
|
+
end
|
22
|
+
|
23
|
+
if hEnvironment.has_key?('maxAltitude')
|
24
|
+
intEnvironment[:maxAltitude] = hEnvironment['maxAltitude']
|
25
|
+
end
|
26
|
+
|
27
|
+
if hEnvironment.has_key?('meteorologicalConditions')
|
28
|
+
intEnvironment[:meteorologicalConditions] = hEnvironment['meteorologicalConditions']
|
29
|
+
end
|
30
|
+
|
31
|
+
if hEnvironment.has_key?('solarAzimuth')
|
32
|
+
intEnvironment[:solarAzimuth] = hEnvironment['solarAzimuth']
|
33
|
+
end
|
34
|
+
|
35
|
+
if hEnvironment.has_key?('solarElevation')
|
36
|
+
intEnvironment[:solarElevation] = hEnvironment['solarElevation']
|
37
|
+
end
|
38
|
+
|
39
|
+
intEnvironment
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require_relative 'module_identifier'
|
2
|
+
require_relative 'module_dateTime'
|
3
|
+
require_relative 'module_objective'
|
4
|
+
require_relative 'module_pass'
|
5
|
+
require_relative 'module_instrument'
|
6
|
+
|
7
|
+
module ADIWG
|
8
|
+
module Mdtranslator
|
9
|
+
module Readers
|
10
|
+
module MdJson
|
11
|
+
|
12
|
+
module Event
|
13
|
+
def self.unpack(hEvent, responseObj, inContext = nil)
|
14
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
15
|
+
|
16
|
+
intMetadataClass = InternalMetadata.new
|
17
|
+
intEvent = intMetadataClass.newEvent
|
18
|
+
|
19
|
+
outContext = 'Event'
|
20
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
21
|
+
|
22
|
+
if hEvent.has_key?('eventId')
|
23
|
+
intEvent[:eventId] = hEvent['eventId']
|
24
|
+
else
|
25
|
+
@MessagePath.issueWarning(40, responseObj, outContext)
|
26
|
+
end
|
27
|
+
|
28
|
+
if hEvent.has_key?('identifier')
|
29
|
+
intEvent[:identifier] = Identifier.unpack(hEvent['identifier'], responseObj, outContext)
|
30
|
+
else
|
31
|
+
@MessagePath.issueWarning(40, responseObj, outContext)
|
32
|
+
end
|
33
|
+
|
34
|
+
if hEvent.has_key?('trigger')
|
35
|
+
intEvent[:trigger] = hEvent['trigger']
|
36
|
+
else
|
37
|
+
@MessagePath.issueWarning(40, responseObj, outContext)
|
38
|
+
end
|
39
|
+
|
40
|
+
if hEvent.has_key?('context')
|
41
|
+
intEvent[:context] = hEvent['context']
|
42
|
+
else
|
43
|
+
@MessagePath.issueWarning(40, responseObj, outContext)
|
44
|
+
end
|
45
|
+
|
46
|
+
if hEvent.has_key?('sequence')
|
47
|
+
intEvent[:sequence] = hEvent['sequence']
|
48
|
+
else
|
49
|
+
@MessagePath.issueWarning(40, responseObj, outContext,)
|
50
|
+
end
|
51
|
+
|
52
|
+
if hEvent.has_key?('time')
|
53
|
+
intEvent[:time] = DateTime.unpack(hEvent['time'], responseObj, outContext)
|
54
|
+
else
|
55
|
+
@MessagePath.issueWarning(40, responseObj, outContext)
|
56
|
+
end
|
57
|
+
|
58
|
+
if hEvent.has_key?('expectedObjective')
|
59
|
+
hEvent['expectedObjective'].each do |item|
|
60
|
+
hReturn = Objective.unpack(item, responseObj, outContext)
|
61
|
+
unless hReturn.nil?
|
62
|
+
intEvent[:expectedObjectives] << hReturn
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
if hEvent.has_key?('relatedPass')
|
68
|
+
intEvent[:relatedPass] = Pass.unpack(hEvent['relatedPass'], responseObj, outContext)
|
69
|
+
end
|
70
|
+
|
71
|
+
if hEvent.has_key?('relatedSensor')
|
72
|
+
hEvent['relatedSensor'].each do |item|
|
73
|
+
hReturn = Instrument.unpack(item, responseObj, outContext)
|
74
|
+
unless hReturn.nil?
|
75
|
+
intEvent[:relatedSensors] << hReturn
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
intEvent
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require_relative 'module_citation'
|
2
|
+
require_relative 'module_platform'
|
3
|
+
require_relative 'module_instrumentationEventList'
|
4
|
+
require_relative 'module_identifier'
|
5
|
+
|
6
|
+
module ADIWG
|
7
|
+
module Mdtranslator
|
8
|
+
module Readers
|
9
|
+
module MdJson
|
10
|
+
|
11
|
+
module Instrument
|
12
|
+
def self.unpack(hInstrument, responseObj, inContext = nil)
|
13
|
+
|
14
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
15
|
+
|
16
|
+
intMetadataClass = InternalMetadata.new
|
17
|
+
intInstrument = intMetadataClass.newInstrument
|
18
|
+
|
19
|
+
outContext = 'instrument'
|
20
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
21
|
+
|
22
|
+
if hInstrument.has_key?('instrumentId')
|
23
|
+
intInstrument[:instrumentId] = hInstrument['instrumentId']
|
24
|
+
else
|
25
|
+
@MessagePath.issueWarning(40, responseObj, outContext)
|
26
|
+
end
|
27
|
+
|
28
|
+
if hInstrument.has_key?('citation')
|
29
|
+
intInstrument[:citation] = Citation.unpack(hInstrument['citation'], responseObj, outContext)
|
30
|
+
end
|
31
|
+
|
32
|
+
if hInstrument.has_key?('identifier')
|
33
|
+
intInstrument[:identifier] = Identifier.unpack(hInstrument['identifier'], responseObj, outContext)
|
34
|
+
else
|
35
|
+
@MessagePath.issueWarning(40, responseObj, outContext)
|
36
|
+
end
|
37
|
+
|
38
|
+
if hInstrument.has_key?('instrumentType')
|
39
|
+
intInstrument[:instrumentType] = hInstrument['instrumentType']
|
40
|
+
else
|
41
|
+
@MessagePath.issueWarning(40, responseObj, outContext)
|
42
|
+
end
|
43
|
+
|
44
|
+
if hInstrument.has_key?('description')
|
45
|
+
intInstrument[:description] = hInstrument['description']
|
46
|
+
end
|
47
|
+
|
48
|
+
if hInstrument.has_key?('mountedOn')
|
49
|
+
intInstrument[:mountedOn] = Platform.unpack(hInstrument['mountedOn'], responseObj, outContext)
|
50
|
+
end
|
51
|
+
|
52
|
+
if hInstrument.has_key?('history')
|
53
|
+
hInstrument['history'].each do |item|
|
54
|
+
hReturn = InstrumentationEventList.unpack(item, responseObj, outContext)
|
55
|
+
unless hReturn.nil?
|
56
|
+
intInstrument[:histories] << hReturn
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
if hInstrument.has_key?('hostId')
|
62
|
+
intInstrument[:hostId] = Identifier.unpack(hInstrument['hostId'], responseObj, outContext)
|
63
|
+
end
|
64
|
+
|
65
|
+
intInstrument
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require_relative 'module_citation'
|
2
|
+
require_relative 'module_extent'
|
3
|
+
require_relative 'module_revision'
|
4
|
+
|
5
|
+
module ADIWG
|
6
|
+
module Mdtranslator
|
7
|
+
module Readers
|
8
|
+
module MdJson
|
9
|
+
|
10
|
+
module InstrumentationEvent
|
11
|
+
def self.unpack(hInstrumentationEvent, responseObj, inContext = nil)
|
12
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
13
|
+
|
14
|
+
intMetadataClass = InternalMetadata.new
|
15
|
+
intInstrumentationEvent = intMetadataClass.newInstrumentationEvent
|
16
|
+
|
17
|
+
outContext = 'instrumentation event'
|
18
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
19
|
+
|
20
|
+
eventTypeArray = [
|
21
|
+
"announcement",
|
22
|
+
"calibration",
|
23
|
+
"calibrationCoefficientUpdate",
|
24
|
+
"dataLoss",
|
25
|
+
"fatal",
|
26
|
+
"manoeuvre",
|
27
|
+
"missingData",
|
28
|
+
"notice",
|
29
|
+
"prelaunch",
|
30
|
+
"severe",
|
31
|
+
"switchOff",
|
32
|
+
"switchOn",
|
33
|
+
"clean"
|
34
|
+
]
|
35
|
+
|
36
|
+
if hInstrumentationEvent.has_key?('citation')
|
37
|
+
hInstrumentationEvent['citation'].each do |citation|
|
38
|
+
hReturn = Citation.unpack(citation, responseObj, outContext)
|
39
|
+
unless hReturn.nil?
|
40
|
+
intInstrumentationEvent[:citations] << hReturn
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
if hInstrumentationEvent.has_key?('description')
|
46
|
+
intInstrumentationEvent[:description] = hInstrumentationEvent['description']
|
47
|
+
else
|
48
|
+
@MessagePath.issueWarning(40, responseObj, outContext)
|
49
|
+
end
|
50
|
+
|
51
|
+
if hInstrumentationEvent.has_key?('extent')
|
52
|
+
intInstrumentationEvent[:extent] = Extent.unpack(hInstrumentationEvent['extent'], responseObj, outContext)
|
53
|
+
end
|
54
|
+
|
55
|
+
if hInstrumentationEvent.has_key?('eventType') && eventTypeArray.include?(hInstrumentationEvent['eventType'])
|
56
|
+
intInstrumentationEvent[:eventType] = hInstrumentationEvent['eventType']
|
57
|
+
else
|
58
|
+
@MessagePath.issueWarning(41, responseObj, outContext)
|
59
|
+
end
|
60
|
+
|
61
|
+
if hInstrumentationEvent.has_key?('revisionHistory')
|
62
|
+
hInstrumentationEvent['revisionHistory'].each do |item|
|
63
|
+
hReturn = Revision.unpack(item, responseObj, outContext)
|
64
|
+
unless hReturn.nil?
|
65
|
+
intInstrumentationEvent[:revisionHistories] << hReturn
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
intInstrumentationEvent
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|