urbanopt-geojson 0.6.6 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +32 -0
- data/Gemfile +1 -1
- data/LICENSE.md +1 -1
- data/doc_templates/LICENSE.md +1 -1
- data/doc_templates/copyright_erb.txt +1 -1
- data/doc_templates/copyright_js.txt +2 -2
- data/doc_templates/copyright_ruby.txt +1 -1
- data/docs/package-lock.json +15961 -1719
- data/lib/measures/urban_geometry_creation/measure.rb +1 -1
- data/lib/measures/urban_geometry_creation_zoning/measure.rb +1 -1
- data/lib/urbanopt/geojson/building.rb +1 -1
- data/lib/urbanopt/geojson/derived_extension.rb +1 -1
- data/lib/urbanopt/geojson/district_system.rb +1 -1
- data/lib/urbanopt/geojson/feature.rb +2 -2
- data/lib/urbanopt/geojson/geo_file.rb +42 -3
- data/lib/urbanopt/geojson/helper.rb +1 -1
- data/lib/urbanopt/geojson/logging.rb +1 -1
- data/lib/urbanopt/geojson/mapper_classes.rb +1 -1
- data/lib/urbanopt/geojson/model.rb +1 -1
- data/lib/urbanopt/geojson/region.rb +1 -1
- data/lib/urbanopt/geojson/scale_area.rb +1 -1
- data/lib/urbanopt/geojson/schema/breaker_properties.json +33 -0
- data/lib/urbanopt/geojson/schema/building_properties.json +517 -592
- data/lib/urbanopt/geojson/schema/capacitor_properties.json +38 -0
- data/lib/urbanopt/geojson/schema/consumer_properties.json +58 -0
- data/lib/urbanopt/geojson/schema/distribution_generator.json +45 -0
- data/lib/urbanopt/geojson/schema/distribution_transformer.json +54 -0
- data/lib/urbanopt/geojson/schema/district_system_properties.json +10 -15
- data/lib/urbanopt/geojson/schema/dummy_node_properties.json +21 -0
- data/lib/urbanopt/geojson/schema/electrical_connector_properties.json +6 -135
- data/lib/urbanopt/geojson/schema/hvmv_substation_properties.json +54 -0
- data/lib/urbanopt/geojson/schema/line_properties.json +69 -0
- data/lib/urbanopt/geojson/schema/region_properties.json +1 -1
- data/lib/urbanopt/geojson/schema/site_properties.json +217 -97
- data/lib/urbanopt/geojson/schema/switch_properties.json +33 -0
- data/lib/urbanopt/geojson/update_areas.rb +1 -1
- data/lib/urbanopt/geojson/validate_geojson.rb +1 -1
- data/lib/urbanopt/geojson/version.rb +2 -2
- data/lib/urbanopt/geojson/zoning.rb +1 -1
- data/lib/urbanopt/geojson.rb +1 -1
- data/lib/urbanopt-geojson.rb +1 -1
- data/urbanopt-geojson-gem.gemspec +2 -2
- metadata +18 -9
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# *********************************************************************************
|
4
|
-
# URBANopt™, Copyright (c) 2019-
|
4
|
+
# URBANopt™, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other
|
5
5
|
# contributors. All rights reserved.
|
6
6
|
|
7
7
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# *********************************************************************************
|
4
|
-
# URBANopt™, Copyright (c) 2019-
|
4
|
+
# URBANopt™, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other
|
5
5
|
# contributors. All rights reserved.
|
6
6
|
|
7
7
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt™, Copyright (c) 2019-
|
2
|
+
# URBANopt™, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt™, Copyright (c) 2019-
|
2
|
+
# URBANopt™, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt™, Copyright (c) 2019-
|
2
|
+
# URBANopt™, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt™, Copyright (c) 2019-
|
2
|
+
# URBANopt™, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -318,7 +318,7 @@ module URBANopt
|
|
318
318
|
return false
|
319
319
|
end
|
320
320
|
|
321
|
-
unless feature[:properties][:detailed_model_filename]
|
321
|
+
unless feature[:properties][:detailed_model_filename] || feature[:properties][:hpxml_directory]
|
322
322
|
errors = JSON::Validator.fully_validate(schema, feature[:properties])
|
323
323
|
if !errors.empty?
|
324
324
|
raise("Invalid properties for '#{feature[:properties][:name]}'\n #{errors.join('\n ')}")
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt™, Copyright (c) 2019-
|
2
|
+
# URBANopt™, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -82,6 +82,7 @@ module URBANopt
|
|
82
82
|
symbolize_names: true
|
83
83
|
)
|
84
84
|
|
85
|
+
|
85
86
|
# validate geojson file against schema
|
86
87
|
geojson_errors = validate(@@geojson_schema, geojson_file)
|
87
88
|
unless geojson_errors.empty?
|
@@ -91,6 +92,15 @@ module URBANopt
|
|
91
92
|
# initialize @@logger
|
92
93
|
@@logger ||= URBANopt::GeoJSON.logger
|
93
94
|
|
95
|
+
# validate project section first
|
96
|
+
if geojson_file.key?(:project)
|
97
|
+
errors = validate(@@site_schema, geojson_file[:project])
|
98
|
+
|
99
|
+
unless errors.empty?
|
100
|
+
raise "Project section does not adhere to schema: \n #{errors.join('\n ')}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
94
104
|
# validate each feature against schema
|
95
105
|
geojson_file[:features].each do |feature|
|
96
106
|
properties = feature[:properties]
|
@@ -100,7 +110,7 @@ module URBANopt
|
|
100
110
|
|
101
111
|
case type
|
102
112
|
when 'Building'
|
103
|
-
#
|
113
|
+
# In case detailed_model_filename present check for fewer properties
|
104
114
|
if feature[:properties][:detailed_model_filename]
|
105
115
|
if feature[:properties][:id].nil?
|
106
116
|
raise('No id found for Building Feature')
|
@@ -112,6 +122,14 @@ module URBANopt
|
|
112
122
|
@@logger.warn("Number of stories is required to calculate shading using the UrbanGeometryCreation measure...ignoring #{feature[:properties][:id]} in shading calculations")
|
113
123
|
end
|
114
124
|
feature[:additionalProperties] = true
|
125
|
+
# In case hpxml_directory present check for fewer properties
|
126
|
+
elsif feature[:properties][:hpxml_directory]
|
127
|
+
if feature[:properties][:id].nil?
|
128
|
+
raise('No id found for Building Feature')
|
129
|
+
end
|
130
|
+
if feature[:properties][:name].nil?
|
131
|
+
raise('No name found for Building Feature')
|
132
|
+
end
|
115
133
|
# Else validate for all required properties in the schema
|
116
134
|
else
|
117
135
|
errors = validate(@@building_schema, properties)
|
@@ -203,7 +221,14 @@ module URBANopt
|
|
203
221
|
{ site: :climate_zone, feature: :climate_zone },
|
204
222
|
{ site: :default_template, feature: :template },
|
205
223
|
{ site: :weather_filename, feature: :weather_filename },
|
206
|
-
{ site: :tariff_filename, feature: :tariff_filename }
|
224
|
+
{ site: :tariff_filename, feature: :tariff_filename },
|
225
|
+
{ site: :emissions, feature: :emissions },
|
226
|
+
{ site: :electricity_emissions_future_subregion, feature: :electricity_emissions_future_subregion },
|
227
|
+
{ site: :electricity_emissions_hourly_historical_subregion, feature: :electricity_emissions_hourly_historical_subregion },
|
228
|
+
{ site: :electricity_emissions_annual_historical_subregion, feature: :electricity_emissions_annual_historical_subregion },
|
229
|
+
{ site: :electricity_emissions_future_year, feature: :electricity_emissions_future_year },
|
230
|
+
{ site: :electricity_emissions_hourly_historical_year, feature: :electricity_emissions_hourly_historical_year },
|
231
|
+
{ site: :electricity_emissions_annual_historical_year, feature: :electricity_emissions_annual_historical_year }
|
207
232
|
]
|
208
233
|
|
209
234
|
add_props.each do |prop|
|
@@ -280,6 +305,19 @@ module URBANopt
|
|
280
305
|
return result
|
281
306
|
end
|
282
307
|
|
308
|
+
def self.get_site_schema(strict)
|
309
|
+
result = nil
|
310
|
+
File.open(File.dirname(__FILE__) + '/schema/site_properties.json') do |f|
|
311
|
+
result = JSON.parse(f.read)
|
312
|
+
end
|
313
|
+
if strict
|
314
|
+
result['additionalProperties'] = true
|
315
|
+
else
|
316
|
+
result['additionalProperties'] = false
|
317
|
+
end
|
318
|
+
return result
|
319
|
+
end
|
320
|
+
|
283
321
|
def self.get_electrical_connector_schema(strict)
|
284
322
|
result = nil
|
285
323
|
File.open(File.dirname(__FILE__) + '/schema/electrical_connector_properties.json') do |f|
|
@@ -341,6 +379,7 @@ module URBANopt
|
|
341
379
|
@@electrical_junction_schema = get_electrical_junction_schema(strict)
|
342
380
|
@@thermal_connector_schema = get_thermal_connector_schema(strict)
|
343
381
|
@@thermal_junction_schema = get_thermal_junction_schema(strict)
|
382
|
+
@@site_schema = get_site_schema(strict)
|
344
383
|
end
|
345
384
|
end
|
346
385
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt™, Copyright (c) 2019-
|
2
|
+
# URBANopt™, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt™, Copyright (c) 2019-
|
2
|
+
# URBANopt™, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt™, Copyright (c) 2019-
|
2
|
+
# URBANopt™, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt™, Copyright (c) 2019-
|
2
|
+
# URBANopt™, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt™, Copyright (c) 2019-
|
2
|
+
# URBANopt™, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt™, Copyright (c) 2019-
|
2
|
+
# URBANopt™, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -0,0 +1,33 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
3
|
+
"id": "http://json-schema.org/openstudio-urban-modeling/breaker_properties.json#",
|
4
|
+
"title": "URBANopt Breaker",
|
5
|
+
"description": "Schema for an URBANopt RNM Breaker object",
|
6
|
+
"type": "object",
|
7
|
+
"properties": {
|
8
|
+
"Code": {
|
9
|
+
"description": "Unique name/ID of the feature in the RNM analysis.",
|
10
|
+
"type": "string"
|
11
|
+
},
|
12
|
+
"NodeA": {
|
13
|
+
"description": "Name/ID of the RNM 'From' Node it is associated with.",
|
14
|
+
"type": "string"
|
15
|
+
},
|
16
|
+
"NodeB": {
|
17
|
+
"description": "Name/ID of the RNM 'To' Node it is associated with.",
|
18
|
+
"type": "string"
|
19
|
+
},
|
20
|
+
"NomV_kV": {
|
21
|
+
"description": "Nominal Voltage in kV.",
|
22
|
+
"type": "string"
|
23
|
+
},
|
24
|
+
"Subest": {
|
25
|
+
"description": "Substation the breaker is connected to.",
|
26
|
+
"type": "string"
|
27
|
+
},
|
28
|
+
"Feeder": {
|
29
|
+
"description": "Feeder the breaker is connected to.",
|
30
|
+
"type": "string"
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|