adiwg-mdtranslator 2.9.2 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -2
  3. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +8 -8
  4. data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +179 -160
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +1 -2
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +1 -2
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +1 -2
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +1 -2
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +1 -2
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +1 -2
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +1 -2
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +1 -2
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +1 -2
  14. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +1 -2
  15. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +1 -2
  16. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +1 -2
  17. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +1 -2
  18. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +1 -2
  19. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +1 -2
  20. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +1 -2
  21. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +1 -2
  22. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +1 -2
  23. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +1 -2
  24. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +1 -2
  25. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +1 -2
  26. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +16 -4
  27. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_citation.rb +14 -1
  28. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_codeSet.rb +8 -2
  29. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb +36 -8
  30. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb +2 -2
  31. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +2 -2
  32. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_digitalForm.rb +8 -2
  33. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_distribution.rb +8 -2
  34. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entity.rb +12 -3
  35. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb +5 -0
  36. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb +4 -1
  37. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_enumerated.rb +12 -3
  38. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +2 -2
  39. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb +13 -4
  40. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb +13 -4
  41. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geologicAge.rb +6 -0
  42. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +3 -3
  43. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +58 -12
  44. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +36 -0
  45. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb +8 -2
  46. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +1 -1
  47. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapCoordinateInfo.rb +51 -12
  48. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +46 -9
  49. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapLocalPlanar.rb +8 -2
  50. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapProjection.rb +4 -1
  51. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_metadataInfo.rb +10 -4
  52. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_methodology.rb +4 -1
  53. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_offlineOption.rb +16 -4
  54. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_onlineOption.rb +13 -4
  55. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_orderProcess.rb +9 -1
  56. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_pointVector.rb +21 -4
  57. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb +8 -1
  58. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_publication.rb +8 -2
  59. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_quality.rb +14 -3
  60. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_range.rb +8 -2
  61. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_raster.rb +12 -3
  62. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_security.rb +12 -3
  63. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_series.rb +8 -2
  64. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_source.rb +20 -5
  65. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialDomain.rb +32 -8
  66. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonClass.rb +8 -2
  67. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +20 -5
  68. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonomy.rb +8 -2
  69. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_transferInfo.rb +4 -1
  70. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +12 -3
  71. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +9 -0
  72. data/lib/adiwg/mdtranslator/readers/fgdc/version.rb +2 -1
  73. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +10 -10
  74. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +13 -16
  75. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_additionalDocumentation.rb +55 -55
  76. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb +85 -85
  77. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +8 -8
  78. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_associatedResource.rb +91 -92
  79. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +212 -212
  80. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attributeGroup.rb +43 -43
  81. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +8 -8
  82. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb +11 -11
  83. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +17 -17
  84. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +26 -13
  85. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +13 -12
  86. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +8 -5
  87. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageDescription.rb +77 -77
  88. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +9 -7
  89. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +54 -54
  90. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +35 -35
  91. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dimension.rb +70 -70
  92. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +15 -4
  93. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distributor.rb +53 -53
  94. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +5 -5
  95. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +5 -5
  96. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_duration.rb +92 -91
  97. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +10 -10
  98. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +28 -18
  99. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityForeignKey.rb +58 -59
  100. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityIndex.rb +52 -53
  101. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_extent.rb +70 -56
  102. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_featureCollection.rb +64 -63
  103. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_format.rb +6 -6
  104. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb +9 -6
  105. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geoJson.rb +47 -47
  106. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +7 -7
  107. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb +12 -7
  108. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +6 -5
  109. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb +6 -6
  110. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryCollection.rb +63 -63
  111. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryFeature.rb +84 -84
  112. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryObject.rb +50 -49
  113. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb +57 -57
  114. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +115 -100
  115. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +85 -82
  116. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +46 -46
  117. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_graphic.rb +78 -78
  118. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +61 -56
  119. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_identifier.rb +72 -72
  120. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_imageDescription.rb +106 -107
  121. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +4 -4
  122. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keywordObject.rb +46 -46
  123. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_legalConstraint.rb +55 -51
  124. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_lineage.rb +87 -83
  125. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_locale.rb +46 -46
  126. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_maintenance.rb +73 -74
  127. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +11 -5
  128. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_measure.rb +56 -55
  129. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_medium.rb +88 -88
  130. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +106 -105
  131. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +4 -3
  132. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb +4 -4
  133. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +7 -4
  134. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +60 -61
  135. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_orderProcess.rb +47 -47
  136. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +57 -57
  137. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_phone.rb +49 -51
  138. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +6 -6
  139. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +31 -30
  140. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +16 -2
  141. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_releasability.rb +53 -47
  142. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +15 -13
  143. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb +46 -46
  144. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceUsage.rb +95 -95
  145. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_responsibleParty.rb +67 -67
  146. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb +47 -46
  147. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scope.rb +47 -47
  148. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scopeDescription.rb +68 -63
  149. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_securityConstraint.rb +50 -50
  150. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb +38 -38
  151. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +8 -8
  152. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +6 -5
  153. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialRepresentation.rb +77 -75
  154. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +8 -14
  155. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +71 -72
  156. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb +46 -45
  157. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +118 -116
  158. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_temporalExtent.rb +48 -46
  159. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInstant.rb +8 -8
  160. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInterval.rb +50 -50
  161. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +21 -14
  162. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +86 -75
  163. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +4 -4
  164. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb +45 -45
  165. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +45 -33
  166. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +28 -6
  167. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalExtent.rb +59 -59
  168. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_voucher.rb +43 -43
  169. data/lib/adiwg/mdtranslator/readers/mdReaders.rb +6 -2
  170. data/lib/adiwg/mdtranslator/version.rb +9 -1
  171. data/lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb +3 -3
  172. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureConstraint.rb +50 -46
  173. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_multiplicity.rb +53 -43
  174. data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +3 -1
  175. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entityAttribute.rb +1 -1
  176. data/lib/adiwg/mdtranslator/writers/mdWriters.rb +58 -58
  177. data/lib/adiwg/mdtranslator.rb +177 -165
  178. data/lib/adiwg/mdtranslator_cli.rb +8 -3
  179. metadata +2 -2
@@ -2,6 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-02-19 refactored error and warning messaging
5
6
  # Stan Smith 2017-10-23 original script
6
7
 
7
8
  require_relative 'module_identifier'
@@ -18,8 +19,8 @@ module ADIWG
18
19
 
19
20
  # return nil object if input is empty
20
21
  if hProjection.empty?
21
- responseObj[:readerExecutionMessages] << 'Reference System Projection Parameters object is empty'
22
- responseObj[:readerExecutionPass] = false
22
+ responseObj[:readerExecutionMessages] <<
23
+ 'WARNING: mdJson reader: reference system projection parameters object is empty'
23
24
  return nil
24
25
  end
25
26
 
@@ -39,14 +40,14 @@ module ADIWG
39
40
 
40
41
  # projection parameters - grid system
41
42
  if hProjection.has_key?('gridSystem')
42
- if hProjection['gridSystem'] != ''
43
+ unless hProjection['gridSystem'] == ''
43
44
  intProjection[:gridSystem] = hProjection['gridSystem']
44
45
  end
45
46
  end
46
47
 
47
48
  # projection parameters - grid system name
48
49
  if hProjection.has_key?('gridSystemName')
49
- if hProjection['gridSystemName'] != ''
50
+ unless hProjection['gridSystemName'] == ''
50
51
  intProjection[:gridSystemName] = hProjection['gridSystemName']
51
52
  end
52
53
  end
@@ -56,140 +57,140 @@ module ADIWG
56
57
  intProjection[:projection] = hProjection['projection']
57
58
  end
58
59
  if intProjection[:projection].nil? || intProjection[:projection] == ''
59
- responseObj[:readerExecutionMessages] << 'Spatial Reference Projection is missing'
60
+ responseObj[:readerExecutionMessages] << 'spatial reference projection is missing'
60
61
  responseObj[:readerExecutionPass] = false
61
62
  return nil
62
63
  end
63
64
 
64
65
  # projection parameters - projection name
65
66
  if hProjection.has_key?('projectionName')
66
- if hProjection['projectionName'] != ''
67
+ unless hProjection['projectionName'] == ''
67
68
  intProjection[:projectionName] = hProjection['projectionName']
68
69
  end
69
70
  end
70
71
 
71
72
  # projection parameters - zone
72
73
  if hProjection.has_key?('gridZone')
73
- if hProjection['gridZone'] != ''
74
+ unless hProjection['gridZone'] == ''
74
75
  intProjection[:gridZone] = hProjection['gridZone']
75
76
  end
76
77
  end
77
78
 
78
79
  # projection parameters - standard parallel 1
79
80
  if hProjection.has_key?('standardParallel1')
80
- if hProjection['standardParallel1'] != ''
81
+ unless hProjection['standardParallel1'] == ''
81
82
  intProjection[:standardParallel1] = hProjection['standardParallel1']
82
83
  end
83
84
  end
84
85
 
85
86
  # projection parameters - standard parallel 2
86
87
  if hProjection.has_key?('standardParallel2')
87
- if hProjection['standardParallel2'] != ''
88
+ unless hProjection['standardParallel2'] == ''
88
89
  intProjection[:standardParallel2] = hProjection['standardParallel2']
89
90
  end
90
91
  end
91
92
 
92
93
  # projection parameters - longitude of central meridian
93
94
  if hProjection.has_key?('longitudeOfCentralMeridian')
94
- if hProjection['longitudeOfCentralMeridian'] != ''
95
+ unless hProjection['longitudeOfCentralMeridian'] == ''
95
96
  intProjection[:longitudeOfCentralMeridian] = hProjection['longitudeOfCentralMeridian']
96
97
  end
97
98
  end
98
99
 
99
100
  # projection parameters - latitude of projection origin
100
101
  if hProjection.has_key?('latitudeOfProjectionOrigin')
101
- if hProjection['latitudeOfProjectionOrigin'] != ''
102
+ unless hProjection['latitudeOfProjectionOrigin'] == ''
102
103
  intProjection[:latitudeOfProjectionOrigin] = hProjection['latitudeOfProjectionOrigin']
103
104
  end
104
105
  end
105
106
 
106
107
  # projection parameters - false easting
107
108
  if hProjection.has_key?('falseEasting')
108
- if hProjection['falseEasting'] != ''
109
+ unless hProjection['falseEasting'] == ''
109
110
  intProjection[:falseEasting] = hProjection['falseEasting']
110
111
  end
111
112
  end
112
113
 
113
114
  # projection parameters - false northing
114
115
  if hProjection.has_key?('falseNorthing')
115
- if hProjection['falseNorthing'] != ''
116
+ unless hProjection['falseNorthing'] == ''
116
117
  intProjection[:falseNorthing] = hProjection['falseNorthing']
117
118
  end
118
119
  end
119
120
 
120
121
  # projection parameters - false easting northing units
121
122
  if hProjection.has_key?('falseEastingNorthingUnits')
122
- if hProjection['falseEastingNorthingUnits'] != ''
123
+ unless hProjection['falseEastingNorthingUnits'] == ''
123
124
  intProjection[:falseEastingNorthingUnits] = hProjection['falseEastingNorthingUnits']
124
125
  end
125
126
  end
126
127
 
127
128
  # projection parameters - scale factor at equator
128
129
  if hProjection.has_key?('scaleFactorAtEquator')
129
- if hProjection['scaleFactorAtEquator'] != ''
130
+ unless hProjection['scaleFactorAtEquator'] == ''
130
131
  intProjection[:scaleFactorAtEquator] = hProjection['scaleFactorAtEquator']
131
132
  end
132
133
  end
133
134
 
134
135
  # projection parameters - height of prospective point above surface
135
136
  if hProjection.has_key?('heightOfProspectivePointAboveSurface')
136
- if hProjection['heightOfProspectivePointAboveSurface'] != ''
137
+ unless hProjection['heightOfProspectivePointAboveSurface'] == ''
137
138
  intProjection[:heightOfProspectivePointAboveSurface] = hProjection['heightOfProspectivePointAboveSurface'].to_f
138
139
  end
139
140
  end
140
141
 
141
142
  # projection parameters - longitude of projection center
142
143
  if hProjection.has_key?('longitudeOfProjectionCenter')
143
- if hProjection['longitudeOfProjectionCenter'] != ''
144
+ unless hProjection['longitudeOfProjectionCenter'] == ''
144
145
  intProjection[:longitudeOfProjectionCenter] = hProjection['longitudeOfProjectionCenter']
145
146
  end
146
147
  end
147
148
 
148
149
  # projection parameters - latitude of projection center
149
150
  if hProjection.has_key?('latitudeOfProjectionCenter')
150
- if hProjection['latitudeOfProjectionCenter'] != ''
151
+ unless hProjection['latitudeOfProjectionCenter'] == ''
151
152
  intProjection[:latitudeOfProjectionCenter] = hProjection['latitudeOfProjectionCenter']
152
153
  end
153
154
  end
154
155
 
155
156
  # projection parameters - scale factor at center line
156
157
  if hProjection.has_key?('scaleFactorAtCenterLine')
157
- if hProjection['scaleFactorAtCenterLine'] != ''
158
+ unless hProjection['scaleFactorAtCenterLine'] == ''
158
159
  intProjection[:scaleFactorAtCenterLine] = hProjection['scaleFactorAtCenterLine']
159
160
  end
160
161
  end
161
162
 
162
163
  # projection parameters - scale factor at meridian
163
164
  if hProjection.has_key?('scaleFactorAtCentralMeridian')
164
- if hProjection['scaleFactorAtCentralMeridian'] != ''
165
+ unless hProjection['scaleFactorAtCentralMeridian'] == ''
165
166
  intProjection[:scaleFactorAtCentralMeridian] = hProjection['scaleFactorAtCentralMeridian']
166
167
  end
167
168
  end
168
169
 
169
170
  # projection parameters - straight vertical longitude from pole
170
171
  if hProjection.has_key?('straightVerticalLongitudeFromPole')
171
- if hProjection['straightVerticalLongitudeFromPole'] != ''
172
+ unless hProjection['straightVerticalLongitudeFromPole'] == ''
172
173
  intProjection[:straightVerticalLongitudeFromPole] = hProjection['straightVerticalLongitudeFromPole']
173
174
  end
174
175
  end
175
176
 
176
177
  # projection parameters - scale factor at projection origin
177
178
  if hProjection.has_key?('scaleFactorAtProjectionOrigin')
178
- if hProjection['scaleFactorAtProjectionOrigin'] != ''
179
+ unless hProjection['scaleFactorAtProjectionOrigin'] == ''
179
180
  intProjection[:scaleFactorAtProjectionOrigin] = hProjection['scaleFactorAtProjectionOrigin']
180
181
  end
181
182
  end
182
183
 
183
184
  # projection parameters - azimuth angle
184
185
  if hProjection.has_key?('azimuthAngle')
185
- if hProjection['azimuthAngle'] != ''
186
+ unless hProjection['azimuthAngle'] == ''
186
187
  intProjection[:azimuthAngle] = hProjection['azimuthAngle']
187
188
  end
188
189
  end
189
190
 
190
191
  # projection parameters - azimuth measure point longitude
191
192
  if hProjection.has_key?('azimuthMeasurePointLongitude')
192
- if hProjection['azimuthMeasurePointLongitude'] != ''
193
+ unless hProjection['azimuthMeasurePointLongitude'] == ''
193
194
  intProjection[:azimuthMeasurePointLongitude] = hProjection['azimuthMeasurePointLongitude']
194
195
  end
195
196
  end
@@ -207,42 +208,42 @@ module ADIWG
207
208
 
208
209
  # projection parameters - landsat number
209
210
  if hProjection.has_key?('landsatNumber')
210
- if hProjection['landsatNumber'] != ''
211
+ unless hProjection['landsatNumber'] == ''
211
212
  intProjection[:landsatNumber] = hProjection['landsatNumber']
212
213
  end
213
214
  end
214
215
 
215
216
  # projection parameters - landsat path
216
217
  if hProjection.has_key?('landsatPath')
217
- if hProjection['landsatPath'] != ''
218
+ unless hProjection['landsatPath'] == ''
218
219
  intProjection[:landsatPath] = hProjection['landsatPath']
219
220
  end
220
221
  end
221
222
 
222
223
  # projection parameters - local planar description
223
224
  if hProjection.has_key?('localPlanarDescription')
224
- if hProjection['localPlanarDescription'] != ''
225
+ unless hProjection['localPlanarDescription'] == ''
225
226
  intProjection[:localPlanarDescription] = hProjection['localPlanarDescription']
226
227
  end
227
228
  end
228
229
 
229
230
  # projection parameters - local planar georeference
230
231
  if hProjection.has_key?('localPlanarGeoreference')
231
- if hProjection['localPlanarGeoreference'] != ''
232
+ unless hProjection['localPlanarGeoreference'] == ''
232
233
  intProjection[:localPlanarGeoreference] = hProjection['localPlanarGeoreference']
233
234
  end
234
235
  end
235
236
 
236
237
  # projection parameters - other projection description
237
238
  if hProjection.has_key?('otherProjectionDescription')
238
- if hProjection['otherProjectionDescription'] != ''
239
+ unless hProjection['otherProjectionDescription'] == ''
239
240
  intProjection[:otherProjectionDescription] = hProjection['otherProjectionDescription']
240
241
  end
241
242
  end
242
243
 
243
244
  # projection parameters - other grid description
244
245
  if hProjection.has_key?('otherGridDescription')
245
- if hProjection['otherGridDescription'] != ''
246
+ unless hProjection['otherGridDescription'] == ''
246
247
  intProjection[:otherGridDescription] = hProjection['otherGridDescription']
247
248
  end
248
249
  end
@@ -2,6 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-02-19 refactored error and warning messaging
5
6
  # Stan Smith 2017-10-23 original script
6
7
 
7
8
  require_relative 'module_projectionParameters'
@@ -19,8 +20,8 @@ module ADIWG
19
20
 
20
21
  # return nil object if input is empty
21
22
  if hParams.empty?
22
- responseObj[:readerExecutionMessages] << 'Spatial Reference System Parameters object is empty'
23
- responseObj[:readerExecutionPass] = false
23
+ responseObj[:readerExecutionMessages] <<
24
+ 'WARNING: mdJson reader: spatial reference system parameters object is empty'
24
25
  return nil
25
26
  end
26
27
 
@@ -28,12 +29,15 @@ module ADIWG
28
29
  intMetadataClass = InternalMetadata.new
29
30
  intParamSet = intMetadataClass.newReferenceSystemParameterSet
30
31
 
32
+ haveParams = false
33
+
31
34
  # reference system parameters - projection parameters
32
35
  if hParams.has_key?('projection')
33
36
  unless hParams['projection'].empty?
34
37
  hReturn = ProjectionParameters.unpack(hParams['projection'], responseObj)
35
38
  unless hReturn.nil?
36
39
  intParamSet[:projection] = hReturn
40
+ haveParams = true
37
41
  end
38
42
  end
39
43
  end
@@ -44,6 +48,7 @@ module ADIWG
44
48
  hReturn = Geodetic.unpack(hParams['geodetic'], responseObj)
45
49
  unless hReturn.nil?
46
50
  intParamSet[:geodetic] = hReturn
51
+ haveParams = true
47
52
  end
48
53
  end
49
54
  end
@@ -54,10 +59,19 @@ module ADIWG
54
59
  hReturn = VerticalDatum.unpack(hParams['verticalDatum'], responseObj)
55
60
  unless hReturn.nil?
56
61
  intParamSet[:verticalDatum] = hReturn
62
+ haveParams = true
57
63
  end
58
64
  end
59
65
  end
60
66
 
67
+ # error messages
68
+ unless haveParams
69
+ responseObj[:readerExecutionMessages] <<
70
+ 'WARNING: mdJson reader: spatial reference system parameters must have at least one projection, geodetic, or vertical datum'
71
+ responseObj[:readerExecutionPass] = false
72
+ return nil
73
+ end
74
+
61
75
  return intParamSet
62
76
  end
63
77
 
@@ -2,70 +2,76 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-02-19 refactored error and warning messaging
5
6
  # Stan Smith 2016-10-15 original script
6
7
 
7
8
  require_relative 'module_responsibleParty'
8
9
 
9
10
  module ADIWG
10
- module Mdtranslator
11
- module Readers
12
- module MdJson
11
+ module Mdtranslator
12
+ module Readers
13
+ module MdJson
13
14
 
14
- module Releasability
15
+ module Releasability
15
16
 
16
- def self.unpack(hRelease, responseObj)
17
+ def self.unpack(hRelease, responseObj)
17
18
 
18
- # return nil object if input is empty
19
- if hRelease.empty?
20
- responseObj[:readerExecutionMessages] << 'Releasability object is empty'
21
- responseObj[:readerExecutionPass] = false
22
- return nil
23
- end
19
+ # return nil object if input is empty
20
+ if hRelease.empty?
21
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: releasability object is empty'
22
+ return nil
23
+ end
24
24
 
25
- # instance classes needed in script
26
- intMetadataClass = InternalMetadata.new
27
- intRelease = intMetadataClass.newRelease
28
-
29
- # releasability - addressee [responsibleParty]
30
- if hRelease.has_key?('addressee')
31
- aRParty = hRelease['addressee']
32
- aRParty.each do |item|
33
- hParty = ResponsibleParty.unpack(item, responseObj)
34
- unless hParty.nil?
35
- intRelease[:addressee] << hParty
36
- end
37
- end
38
- end
25
+ # instance classes needed in script
26
+ intMetadataClass = InternalMetadata.new
27
+ intRelease = intMetadataClass.newRelease
39
28
 
40
- # releasability - statement
41
- if hRelease.has_key?('statement')
42
- if hRelease['statement'] != ''
43
- intRelease[:statement] = hRelease['statement']
44
- end
45
- end
29
+ haveRelease = false
46
30
 
47
- # releasability - dissemination constraint []
48
- if hRelease.has_key?('disseminationConstraint')
49
- hRelease['disseminationConstraint'].each do |item|
50
- if item != ''
51
- intRelease[:disseminationConstraint] << item
52
- end
53
- end
31
+ # releasability - addressee [responsibleParty]
32
+ if hRelease.has_key?('addressee')
33
+ aRParty = hRelease['addressee']
34
+ aRParty.each do |item|
35
+ hParty = ResponsibleParty.unpack(item, responseObj)
36
+ unless hParty.nil?
37
+ intRelease[:addressee] << hParty
38
+ haveRelease = true
54
39
  end
40
+ end
41
+ end
55
42
 
56
- if intRelease[:addressee].empty? && intRelease[:statement].nil?
57
- responseObj[:readerExecutionMessages] << 'Releasability must have at least one addressee or statement'
58
- responseObj[:readerExecutionPass] = false
59
- return nil
43
+ # releasability - statement
44
+ if hRelease.has_key?('statement')
45
+ unless hRelease['statement'] == ''
46
+ intRelease[:statement] = hRelease['statement']
47
+ haveRelease = true
48
+ end
49
+ end
50
+
51
+ # releasability - dissemination constraint []
52
+ if hRelease.has_key?('disseminationConstraint')
53
+ hRelease['disseminationConstraint'].each do |item|
54
+ if item != ''
55
+ intRelease[:disseminationConstraint] << item
60
56
  end
57
+ end
58
+ end
61
59
 
62
- return intRelease
60
+ # error messages
61
+ unless haveRelease
62
+ responseObj[:readerExecutionMessages] <<
63
+ 'ERROR: mdJson reader: releasability must have at least one addressee or statement'
64
+ responseObj[:readerExecutionPass] = false
65
+ return nil
66
+ end
63
67
 
64
- end
68
+ return intRelease
65
69
 
66
- end
70
+ end
67
71
 
68
72
  end
69
- end
70
- end
73
+
74
+ end
75
+ end
76
+ end
71
77
  end
@@ -2,6 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-02-19 refactored error and warning messaging
5
6
  # Stan Smith 2017-05-16 deprecated topic category
6
7
  # ... topic category is now handled as keyword list
7
8
  # Stan Smith 2016-11-01 original script
@@ -37,7 +38,7 @@ module ADIWG
37
38
 
38
39
  # return nil object if input is empty
39
40
  if hResInfo.empty?
40
- responseObj[:readerExecutionMessages] << 'ResourceInfo object is empty'
41
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info object is empty'
41
42
  responseObj[:readerExecutionPass] = false
42
43
  return nil
43
44
  end
@@ -58,7 +59,7 @@ module ADIWG
58
59
  end
59
60
  end
60
61
  if intResInfo[:resourceTypes].empty?
61
- responseObj[:readerExecutionMessages] << 'ResourceInfo is missing resourceType'
62
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info resource type is missing'
62
63
  responseObj[:readerExecutionPass] = false
63
64
  return nil
64
65
  end
@@ -74,7 +75,7 @@ module ADIWG
74
75
  end
75
76
  end
76
77
  if intResInfo[:citation].empty?
77
- responseObj[:readerExecutionMessages] << 'ResourceInfo is missing citation'
78
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info citation is missing'
78
79
  responseObj[:readerExecutionPass] = false
79
80
  return nil
80
81
  end
@@ -84,21 +85,21 @@ module ADIWG
84
85
  intResInfo[:abstract] = hResInfo['abstract']
85
86
  end
86
87
  if intResInfo[:abstract].nil? || intResInfo[:abstract] == ''
87
- responseObj[:readerExecutionMessages] << 'ResourceInfo is missing abstract'
88
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info abstract is missing'
88
89
  responseObj[:readerExecutionPass] = false
89
90
  return nil
90
91
  end
91
92
 
92
93
  # resource information - short abstract
93
94
  if hResInfo.has_key?('shortAbstract')
94
- if hResInfo['shortAbstract'] != ''
95
+ unless hResInfo['shortAbstract'] == ''
95
96
  intResInfo[:shortAbstract] = hResInfo['shortAbstract']
96
97
  end
97
98
  end
98
99
 
99
100
  # resource information - purpose
100
101
  if hResInfo.has_key?('purpose')
101
- if hResInfo['purpose'] != ''
102
+ unless hResInfo['purpose'] == ''
102
103
  intResInfo[:purpose] = hResInfo['purpose']
103
104
  end
104
105
  end
@@ -106,7 +107,7 @@ module ADIWG
106
107
  # resource information - credits []
107
108
  if hResInfo.has_key?('credit')
108
109
  hResInfo['credit'].each do |item|
109
- if item != ''
110
+ unless item == ''
110
111
  intResInfo[:credits] << item
111
112
  end
112
113
  end
@@ -126,13 +127,13 @@ module ADIWG
126
127
  # resource information - status [] (required)
127
128
  if hResInfo.has_key?('status')
128
129
  hResInfo['status'].each do |item|
129
- if item != ''
130
+ unless item == ''
130
131
  intResInfo[:status] << item
131
132
  end
132
133
  end
133
134
  end
134
135
  if intResInfo[:status].empty?
135
- responseObj[:readerExecutionMessages] << 'ResourceInfo is missing status'
136
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info status is missing'
136
137
  responseObj[:readerExecutionPass] = false
137
138
  return nil
138
139
  end
@@ -153,7 +154,8 @@ module ADIWG
153
154
  unless hReturn.nil?
154
155
  intResInfo[:keywords] << hReturn[0]
155
156
  end
156
- responseObj[:readerExecutionMessages] << 'TopicCategory is deprecated, use keyword type isoTopicCategory instead'
157
+ responseObj[:readerExecutionMessages] <<
158
+ 'WARNING: mdJson reader: TopicCategory is deprecated, items were moved to keywords "isoTopicCategory"'
157
159
  end
158
160
  end
159
161
 
@@ -168,7 +170,7 @@ module ADIWG
168
170
  end
169
171
  end
170
172
  if intResInfo[:pointOfContacts].empty?
171
- responseObj[:readerExecutionMessages] << 'ResourceInfo object is missing pointOfContact'
173
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info point-of-contact is missing'
172
174
  responseObj[:readerExecutionPass] = false
173
175
  return nil
174
176
  end
@@ -187,7 +189,7 @@ module ADIWG
187
189
  # resource information - spatial representation type []
188
190
  if hResInfo.has_key?('spatialRepresentationType')
189
191
  hResInfo['spatialRepresentationType'].each do |item|
190
- if item != ''
192
+ unless item == ''
191
193
  intResInfo[:spatialRepresentationTypes] << item
192
194
  end
193
195
  end
@@ -325,7 +327,7 @@ module ADIWG
325
327
  end
326
328
  end
327
329
  if intResInfo[:defaultResourceLocale].empty?
328
- responseObj[:readerExecutionMessages] << 'ResourceInfo object is missing defaultResourceLocale'
330
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info default locale is missing'
329
331
  responseObj[:readerExecutionPass] = false
330
332
  return nil
331
333
  end
@@ -2,54 +2,54 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2017-02-15 original script
5
+ # Stan Smith 2018-02-19 refactored error and warning messaging
6
+ # Stan Smith 2017-02-15 original script
6
7
 
7
8
  module ADIWG
8
- module Mdtranslator
9
- module Readers
10
- module MdJson
11
-
12
- module ResourceType
13
-
14
- def self.unpack(hType, responseObj)
15
-
16
- # return nil object if input is empty
17
- if hType.empty?
18
- responseObj[:readerExecutionMessages] << 'Resource Type object is empty'
19
- responseObj[:readerExecutionPass] = false
20
- return nil
21
- end
22
-
23
- # instance classes needed in script
24
- intMetadataClass = InternalMetadata.new
25
- intType = intMetadataClass.newResourceType
26
-
27
- # resource type - type (required) {MD_ScopeCode}
28
- if hType.has_key?('type')
29
- if hType['type'] != ''
30
- intType[:type] = hType['type']
31
- end
32
- end
33
- if intType[:type].nil?
34
- responseObj[:readerExecutionMessages] << 'Resource Type object is missing type'
35
- responseObj[:readerExecutionPass] = false
36
- return nil
37
- end
38
-
39
- # resource type - name
40
- if hType.has_key?('name')
41
- if hType['name'] != ''
42
- intType[:name] = hType['name']
43
- end
44
- end
45
-
46
- return intType
47
-
48
- end
49
-
50
- end
9
+ module Mdtranslator
10
+ module Readers
11
+ module MdJson
12
+
13
+ module ResourceType
14
+
15
+ def self.unpack(hType, responseObj)
16
+
17
+ # return nil object if input is empty
18
+ if hType.empty?
19
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: resource type object is empty'
20
+ return nil
21
+ end
22
+
23
+ # instance classes needed in script
24
+ intMetadataClass = InternalMetadata.new
25
+ intType = intMetadataClass.newResourceType
26
+
27
+ # resource type - type (required) {MD_ScopeCode}
28
+ if hType.has_key?('type')
29
+ unless hType['type'] == ''
30
+ intType[:type] = hType['type']
31
+ end
32
+ end
33
+ if intType[:type].nil?
34
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource type is missing'
35
+ responseObj[:readerExecutionPass] = false
36
+ return nil
37
+ end
38
+
39
+ # resource type - name
40
+ if hType.has_key?('name')
41
+ unless hType['name'] == ''
42
+ intType[:name] = hType['name']
43
+ end
44
+ end
45
+
46
+ return intType
47
+
48
+ end
51
49
 
52
50
  end
53
- end
54
- end
51
+
52
+ end
53
+ end
54
+ end
55
55
  end