urbanopt-geojson 0.11.0 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2547449dedf14b525ac23dd243c71a7b4e139ddce51ba4e84472cbec330fbc68
4
- data.tar.gz: cc2971734955eb04ce013a1d7a12ecdb9cbe249bb8466ba1edc6131b44c468da
3
+ metadata.gz: 566987c365d84a289682ac42258d4feddbb68bfc24525179cb963ace27a71017
4
+ data.tar.gz: a647418e27a8a0a92813646811e79183dcbe6d2ef24384dde7d2ab00ddf557a7
5
5
  SHA512:
6
- metadata.gz: 88eb991e3efff0a5ec2396ad86a0c93db9d3993783dfd99d3496106118561b24396848a10df5592ac79837c7f35bebaed2d2facba670cdfc2e544cbfdf378ccb
7
- data.tar.gz: 22bbfdebc96a575126c6f178209acb67d2a65bc776401c32f5ccc4e8d2fe4151f0a6d74b8470b3dd7b40bc41fe8076403d7f805ddc892875d6f032586fff8fb2
6
+ metadata.gz: 01f0c79e94c2fb950319e44d2a68d3b23124bc5007c7748957ded2744a46361dbafc52fb9ce81b4ec19061734fae6c5626ffabbc60633a2a876e431549737717
7
+ data.tar.gz: 48bcaf433af03988fde0448c70ee707e572ab008f1c4bf5608c6e29c8d2795a65b5a204b7b32495abcec63e510e35f55d2c88738ad34d3e7e7fd04b8bed9ea86
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # URBANopt GeoJSON Gem
2
2
 
3
+ ## Version 0.11.2
4
+ * Allow null for some optional fields by @vtnate in https://github.com/urbanopt/urbanopt-geojson-gem/pull/273
5
+ * Added UO-ResStock connection variable to the site properties schema by @rawadelkontar in https://github.com/urbanopt/urbanopt-geojson-gem/pull/270
6
+
7
+
8
+ **Full Changelog**: https://github.com/urbanopt/urbanopt-geojson-gem/compare/v0.11.1...v0.11.2
9
+
10
+ ## Version 0.11.1
11
+ Date Range: 01/09/24
12
+
13
+ * downgrade json-schema to 2.7 by @vtnate in https://github.com/urbanopt/urbanopt-geojson-gem/pull/267
14
+
15
+ **Full Changelog**: https://github.com/urbanopt/urbanopt-geojson-gem/compare/v0.11.0...v0.11.1
16
+
3
17
  ## Version 0.11.0
4
18
  Date Range: 7/19/23 - 01/09/24
5
19
 
@@ -10,7 +24,6 @@ Date Range: 7/19/23 - 01/09/24
10
24
  * this fixes a test that didn't get merged properly in the tests PR by @vtnate in https://github.com/urbanopt/urbanopt-geojson-gem/pull/264
11
25
  * Support OpenStudio 3.7 by @vtnate in https://github.com/urbanopt/urbanopt-geojson-gem/pull/265
12
26
 
13
-
14
27
  **Full Changelog**: https://github.com/urbanopt/urbanopt-geojson-gem/compare/v0.10.0...v0.11.0
15
28
 
16
29
  ## Version 0.10.0
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- URBANopt (tm), Copyright (c) 2019-2023, Alliance for Sustainable Energy, LLC, and other
1
+ URBANopt (tm), Copyright (c) 2019-2024, Alliance for Sustainable Energy, LLC, and other
2
2
  contributors. All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification,
@@ -1,4 +1,4 @@
1
- URBANopt (tm), Copyright (c) 2019-2023, Alliance for Sustainable Energy, LLC, and other
1
+ URBANopt (tm), Copyright (c) 2019-2024, Alliance for Sustainable Energy, LLC, and other
2
2
  contributors. All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification,
@@ -121,7 +121,7 @@ class UrbanGeometryCreation < OpenStudio::Measure::ModelMeasure
121
121
  if scale_footprint_area_by_floor_area
122
122
  building_hash = feature.to_hash
123
123
  if building_hash[:number_of_stories] && building_hash[:floor_area]
124
- scaled_footprint_area = building_hash[:floor_area].to_f / building_hash[:number_of_stories].to_f
124
+ scaled_footprint_area = building_hash[:floor_area].to_f / building_hash[:number_of_stories]
125
125
  @runner.registerInfo("Desired footprint area in ft2: #{scaled_footprint_area}")
126
126
  end
127
127
  end
@@ -3,8 +3,8 @@
3
3
  <schema_version>3.1</schema_version>
4
4
  <name>urban_geometry_creation</name>
5
5
  <uid>5ab85d6b-c9af-4361-8ab9-613ee99a5666</uid>
6
- <version_id>583499fb-4275-4787-9168-e3383dca0fc6</version_id>
7
- <version_modified>2023-11-20T17:10:01Z</version_modified>
6
+ <version_id>114e5a3f-0e66-47f2-aa96-299f71b4ef0f</version_id>
7
+ <version_modified>2024-06-25T21:15:26Z</version_modified>
8
8
  <xml_checksum>D254E772</xml_checksum>
9
9
  <class_name>UrbanGeometryCreation</class_name>
10
10
  <display_name>UrbanGeometryCreation</display_name>
@@ -108,7 +108,7 @@
108
108
  <filename>LICENSE.md</filename>
109
109
  <filetype>md</filetype>
110
110
  <usage_type>license</usage_type>
111
- <checksum>9A4578CE</checksum>
111
+ <checksum>3C275955</checksum>
112
112
  </file>
113
113
  <file>
114
114
  <filename>README.md</filename>
@@ -1,4 +1,4 @@
1
- URBANopt (tm), Copyright (c) 2019-2023, Alliance for Sustainable Energy, LLC, and other
1
+ URBANopt (tm), Copyright (c) 2019-2024, Alliance for Sustainable Energy, LLC, and other
2
2
  contributors. All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification,
@@ -110,7 +110,8 @@ class UrbanGeometryCreationZoning < OpenStudio::Measure::ModelMeasure
110
110
  @runner.registerWarning("Surface elevation not set for building '#{name}'")
111
111
  end
112
112
 
113
- if feature.type == 'Building'
113
+ case feature.type
114
+ when 'Building'
114
115
  # make requested building, zoning is set to true
115
116
  spaces = feature.create_building(:spaces_per_floor, model, @origin_lat_lon, @runner, true)
116
117
  if spaces.nil? || spaces.empty?
@@ -157,7 +158,7 @@ class UrbanGeometryCreationZoning < OpenStudio::Measure::ModelMeasure
157
158
  URBANopt::GeoJSON::Helper.convert_to_shading_surface_group(space)
158
159
  end
159
160
 
160
- elsif feature.type == 'District System'
161
+ when 'District System'
161
162
  district_system_type = feature[:properties][:district_system_type]
162
163
  if district_system_type == 'Community Photovoltaic'
163
164
  shading_surfaces = URBANopt::GeoJSON::Helper.create_photovoltaics(feature, 0, model, @origin_lat_lon, @runner)
@@ -3,8 +3,8 @@
3
3
  <schema_version>3.1</schema_version>
4
4
  <name>urban_geometry_creation_zoning</name>
5
5
  <uid>96ea1317-76ac-4670-b51d-71ee3f4fdd65</uid>
6
- <version_id>4d47bb3f-6e49-4309-a4e0-5f2c3748b947</version_id>
7
- <version_modified>2023-11-20T17:10:01Z</version_modified>
6
+ <version_id>8b2f1d05-725a-4f06-bcac-1fb685f12f89</version_id>
7
+ <version_modified>2024-06-25T21:15:28Z</version_modified>
8
8
  <xml_checksum>D254E772</xml_checksum>
9
9
  <class_name>UrbanGeometryCreationZoning</class_name>
10
10
  <display_name>UrbanGeometryCreationZoning</display_name>
@@ -89,7 +89,7 @@
89
89
  <filename>LICENSE.md</filename>
90
90
  <filetype>md</filetype>
91
91
  <usage_type>license</usage_type>
92
- <checksum>9A4578CE</checksum>
92
+ <checksum>3C275955</checksum>
93
93
  </file>
94
94
  <file>
95
95
  <filename>README.md</filename>
@@ -103,12 +103,13 @@ module URBANopt
103
103
  end
104
104
 
105
105
  spaces = []
106
- if create_method == :space_per_floor || create_method == :spaces_per_floor
106
+ case create_method
107
+ when :space_per_floor, :spaces_per_floor
107
108
  (-number_of_stories_below_ground + 1..number_of_stories_above_ground).each do |story_number|
108
109
  new_spaces = create_space_per_floor(story_number, floor_to_floor_height, model, origin_lat_lon, runner, zoning, scaled_footprint_area)
109
110
  spaces.concat(new_spaces)
110
111
  end
111
- elsif create_method == :space_per_building
112
+ when :space_per_building
112
113
  spaces = create_space_per_building(-number_of_stories_below_ground * floor_to_floor_height, number_of_stories_above_ground * floor_to_floor_height, model, origin_lat_lon, runner, zoning, other_building)
113
114
  end
114
115
  return spaces
@@ -417,10 +418,8 @@ module URBANopt
417
418
  space = space.get
418
419
  space.setName("Building Story #{story_number} Space")
419
420
  space.surfaces.each do |surface|
420
- if surface.surfaceType == 'Wall'
421
- if story_number < 1
422
- surface.setOutsideBoundaryCondition('Ground')
423
- end
421
+ if surface.surfaceType == 'Wall' && (story_number < 1)
422
+ surface.setOutsideBoundaryCondition('Ground')
424
423
  end
425
424
  end
426
425
  spaces << space
@@ -8,10 +8,6 @@ require 'urbanopt/geojson/feature'
8
8
  module URBANopt
9
9
  module GeoJSON # :nodoc: all
10
10
  class DistrictSystem < Feature
11
- def initialize(feature)
12
- super(feature)
13
- end
14
-
15
11
  ##
16
12
  # Used to describe the feature type using the base method from the Feature class.
17
13
  def feature_type
@@ -19,9 +19,7 @@ module URBANopt
19
19
  @feature_json = validate_feat(feature)
20
20
  end
21
21
 
22
- # rubocop:disable Style/MethodMissing
23
22
  def method_missing(name, *args, &blk)
24
- # rubocop:enable Style/MethodMissing
25
23
  if @feature_json[:properties].keys.map(&:to_sym).include? name.to_sym
26
24
 
27
25
  return @feature_json[:properties][name.to_sym]
@@ -196,10 +194,11 @@ module URBANopt
196
194
  def get_multi_polygons(json = @feature_json)
197
195
  geometry_type = json[:geometry][:type]
198
196
  multi_polygons = []
199
- if geometry_type == 'Polygon'
197
+ case geometry_type
198
+ when 'Polygon'
200
199
  polygons = json[:geometry][:coordinates]
201
200
  multi_polygons = [polygons]
202
- elsif geometry_type == 'MultiPolygon'
201
+ when 'MultiPolygon'
203
202
  multi_polygons = json[:geometry][:coordinates]
204
203
  end
205
204
  return multi_polygons
@@ -256,8 +255,7 @@ module URBANopt
256
255
  central_latitude = Math.atan2(z, central_square_root)
257
256
 
258
257
  [central_longitude * 180 / Math::PI,
259
- central_latitude * 180 / Math::PI]
260
-
258
+ central_latitude * 180 / Math::PI]
261
259
  end
262
260
 
263
261
  private
@@ -292,8 +290,9 @@ module URBANopt
292
290
  end
293
291
 
294
292
  geometry_type = feature[:geometry][:type]
295
- if geometry_type == 'Polygon'
296
- elsif geometry_type == 'MultiPolygon'
293
+ case geometry_type
294
+ when 'Polygon'
295
+ when 'MultiPolygon'
297
296
  else
298
297
  raise("Unknown geometry type '#{geometry_type}'")
299
298
  return false
@@ -47,7 +47,6 @@ module URBANopt
47
47
  symbolize_names: true
48
48
  )
49
49
 
50
-
51
50
  # validate geojson file against schema
52
51
  geojson_errors = validate(@@geojson_schema, geojson_file)
53
52
  unless geojson_errors.empty?
@@ -83,6 +82,7 @@ module URBANopt
83
82
  if feature[:properties][:name].nil?
84
83
  raise('No name found for Building Feature')
85
84
  end
85
+
86
86
  if feature[:properties][:number_of_stories].nil?
87
87
  @@logger.warn("Number of stories is required to calculate shading using the UrbanGeometryCreation measure.\n" \
88
88
  "Not validating #{feature[:properties][:id]} against schema and ignoring in shading calculations")
@@ -96,6 +96,7 @@ module URBANopt
96
96
  if feature[:properties][:name].nil?
97
97
  raise('No name found for Building Feature')
98
98
  end
99
+
99
100
  @@logger.warn("OS-HPXML files may not conform to schema, which is usually ok.\n" \
100
101
  "Not validating #{feature[:properties][:id]} against schema")
101
102
  # Else validate for all required properties in the schema
@@ -196,16 +197,17 @@ module URBANopt
196
197
  { site: :electricity_emissions_annual_historical_subregion, feature: :electricity_emissions_annual_historical_subregion },
197
198
  { site: :electricity_emissions_future_year, feature: :electricity_emissions_future_year },
198
199
  { site: :electricity_emissions_hourly_historical_year, feature: :electricity_emissions_hourly_historical_year },
199
- { site: :electricity_emissions_annual_historical_year, feature: :electricity_emissions_annual_historical_year }
200
+ { site: :electricity_emissions_annual_historical_year, feature: :electricity_emissions_annual_historical_year },
201
+ { site: :characterize_residential_buildings_from_buildstock_csv, feature: :characterize_residential_buildings_from_buildstock_csv },
202
+ { site: :resstock_buildstock_csv_path, feature: :resstock_buildstock_csv_path },
203
+ { site: :uo_buildstock_mapping_csv_path, feature: :uo_buildstock_mapping_csv_path }
200
204
  ]
201
205
 
202
206
  add_props.each do |prop|
203
- if project.key?(prop[:site]) && project[prop[:site]]
204
- # property exists in site
205
- if !feature[:properties].key?(prop[:feature]) || feature[:properties][prop[:feature]].nil? || feature[:properties][prop[:feature]].to_s.empty?
206
- # property does not exist in feature or is nil: add site property (don't overwrite)
207
- feature[:properties][prop[:feature]] = project[prop[:site]]
208
- end
207
+ # property exists in site
208
+ if project.key?(prop[:site]) && project[prop[:site]] && (!feature[:properties].key?(prop[:feature]) || feature[:properties][prop[:feature]].nil? || feature[:properties][prop[:feature]].to_s.empty?)
209
+ # property does not exist in feature or is nil: add site property (don't overwrite)
210
+ feature[:properties][prop[:feature]] = project[prop[:site]]
209
211
  end
210
212
  end
211
213
 
@@ -226,7 +228,7 @@ module URBANopt
226
228
  result = nil
227
229
  if @@geojson_schema.nil?
228
230
  @@schema_file_lock.synchronize do
229
- File.open(File.dirname(__FILE__) + '/schema/geojson_schema.json') do |f|
231
+ File.open("#{File.dirname(__FILE__)}/schema/geojson_schema.json") do |f|
230
232
  result = JSON.parse(f.read, symbolize_names: true)
231
233
  end
232
234
  end
@@ -236,7 +238,7 @@ module URBANopt
236
238
 
237
239
  def self.get_building_schema(strict)
238
240
  result = nil
239
- File.open(File.dirname(__FILE__) + '/schema/building_properties.json') do |f|
241
+ File.open("#{File.dirname(__FILE__)}/schema/building_properties.json") do |f|
240
242
  result = JSON.parse(f.read)
241
243
  end
242
244
  if strict
@@ -249,7 +251,7 @@ module URBANopt
249
251
 
250
252
  def self.get_district_system_schema(strict)
251
253
  result = nil
252
- File.open(File.dirname(__FILE__) + '/schema/district_system_properties.json') do |f|
254
+ File.open("#{File.dirname(__FILE__)}/schema/district_system_properties.json") do |f|
253
255
  result = JSON.parse(f.read)
254
256
  end
255
257
  if strict
@@ -262,7 +264,7 @@ module URBANopt
262
264
 
263
265
  def self.get_region_schema(strict)
264
266
  result = nil
265
- File.open(File.dirname(__FILE__) + '/schema/region_properties.json') do |f|
267
+ File.open("#{File.dirname(__FILE__)}/schema/region_properties.json") do |f|
266
268
  result = JSON.parse(f.read)
267
269
  end
268
270
  if strict
@@ -275,7 +277,7 @@ module URBANopt
275
277
 
276
278
  def self.get_site_schema(strict)
277
279
  result = nil
278
- File.open(File.dirname(__FILE__) + '/schema/site_properties.json') do |f|
280
+ File.open("#{File.dirname(__FILE__)}/schema/site_properties.json") do |f|
279
281
  result = JSON.parse(f.read)
280
282
  end
281
283
  if strict
@@ -288,7 +290,7 @@ module URBANopt
288
290
 
289
291
  def self.get_electrical_connector_schema(strict)
290
292
  result = nil
291
- File.open(File.dirname(__FILE__) + '/schema/electrical_connector_properties.json') do |f|
293
+ File.open("#{File.dirname(__FILE__)}/schema/electrical_connector_properties.json") do |f|
292
294
  result = JSON.parse(f.read)
293
295
  end
294
296
  if strict
@@ -301,7 +303,7 @@ module URBANopt
301
303
 
302
304
  def self.get_electrical_junction_schema(strict)
303
305
  result = nil
304
- File.open(File.dirname(__FILE__) + '/schema/electrical_junction_properties.json') do |f|
306
+ File.open("#{File.dirname(__FILE__)}/schema/electrical_junction_properties.json") do |f|
305
307
  result = JSON.parse(f.read)
306
308
  end
307
309
  if strict
@@ -314,7 +316,7 @@ module URBANopt
314
316
 
315
317
  def self.get_thermal_connector_schema(strict)
316
318
  result = nil
317
- File.open(File.dirname(__FILE__) + '/schema/thermal_connector_properties.json') do |f|
319
+ File.open("#{File.dirname(__FILE__)}/schema/thermal_connector_properties.json") do |f|
318
320
  result = JSON.parse(f.read)
319
321
  end
320
322
  if strict
@@ -327,7 +329,7 @@ module URBANopt
327
329
 
328
330
  def self.get_thermal_junction_schema(strict)
329
331
  result = nil
330
- File.open(File.dirname(__FILE__) + '/schema/thermal_junction_properties.json') do |f|
332
+ File.open("#{File.dirname(__FILE__)}/schema/thermal_junction_properties.json") do |f|
331
333
  result = JSON.parse(f.read)
332
334
  end
333
335
  if strict
@@ -242,6 +242,7 @@ module URBANopt
242
242
  other_buildings[:features].each do |other_building|
243
243
  other_id = other_building[:properties][:id]
244
244
  next if other_id == building.id
245
+
245
246
  # Consider building, if other building type is ShadingOnly and other id is not equal to building id
246
247
  if other_building_type == 'ShadingOnly' && other_id != building.id
247
248
  # Checks if any building point is shaded by any other building point.
@@ -277,6 +278,7 @@ module URBANopt
277
278
  runner.registerInfo("Feature #{other_building[:properties][:id]} is acting as shading object for #{building.id}")
278
279
  end
279
280
  next unless shadowed
281
+
280
282
  new_building = building.create_other_building(:space_per_building, model, origin_lat_lon, runner, zoning, 0, other_building)
281
283
  if new_building.nil? || new_building.empty?
282
284
  runner.registerWarning("Failed to create spaces for other building '#{name}'")
@@ -321,6 +323,7 @@ module URBANopt
321
323
  if is_shaded(min_pair[:building_point], min_pair[:other_building_point], origin_lat_lon)
322
324
  return true
323
325
  end
326
+
324
327
  return false
325
328
  end
326
329
 
@@ -339,7 +342,8 @@ module URBANopt
339
342
  if distance < 1
340
343
  return true
341
344
  end
342
- elevation_angle = 2.5 #not sure of best value maybe allow as project level argument
345
+
346
+ elevation_angle = 2.5 # not sure of best value maybe allow as project level argument
343
347
  height = vector.z
344
348
  apparent_angle_rad = Math.atan2(height, distance)
345
349
  apparent_angle = OpenStudio.radToDeg(apparent_angle_rad)
@@ -351,9 +355,9 @@ module URBANopt
351
355
  return result
352
356
  end
353
357
 
354
- class << self
355
- private :is_shaded
356
- end
357
- end
358
- end
358
+ class << self
359
+ private :is_shaded
359
360
  end
361
+ end
362
+ end
363
+ end
@@ -7,7 +7,7 @@ require 'logger'
7
7
 
8
8
  module URBANopt
9
9
  module GeoJSON
10
- @@logger = Logger.new(STDERR)
10
+ @@logger = Logger.new($stderr)
11
11
  @@logger.progname = 'URBANopt::GeoJSON'
12
12
 
13
13
  def self.logger
@@ -46,15 +46,16 @@ module URBANopt
46
46
  feature_file = scenario.feature_file
47
47
  feature = feature_file.get_feature_by_id(feature_id)
48
48
  raise "Cannot find feature '#{feature_id}' in '#{scenario.geometry_file}'" if feature.nil?
49
+
49
50
  # deep clone of @@osw before we configure it #:nodoc:
50
51
  osw = Marshal.load(Marshal.dump(@@osw))
51
52
  osw[:name] = feature_name
52
53
  osw[:description] = feature_name
53
- end
54
+ end
54
55
  # rubocop:disable Lint/ReturnInVoidContext
55
56
  return osw
56
- # rubocop:enable Lint/ReturnInVoidContext
57
- end
57
+ # rubocop:enable Lint/ReturnInVoidContext
58
+ end
58
59
  end
59
60
  end
60
61
  end
@@ -75,6 +75,7 @@ module URBANopt
75
75
  stories.each_index do |i|
76
76
  space_type = space_types[i]
77
77
  next if space_type.nil?
78
+
78
79
  stories[i].spaces.each do |space|
79
80
  space.setSpaceType(space_type)
80
81
  end
@@ -10,9 +10,6 @@ module URBANopt
10
10
  class Region < Feature
11
11
  ##
12
12
  # Used to initialize the feature. This method is inherited from the Feature class.
13
- def initialize(feature)
14
- super(feature)
15
- end
16
13
 
17
14
  ##
18
15
  # Used to describe the Region feature type using the base method from the Feature class.
@@ -30,6 +30,7 @@ module URBANopt
30
30
  @vertices = vertices
31
31
  @centroid = OpenStudio.getCentroid(vertices)
32
32
  raise "Cannot compute centroid for '#{vertices}'" if @centroid.empty?
33
+
33
34
  @centroid = @centroid.get
34
35
  @desired_area = desired_area
35
36
  @new_vertices = vertices
@@ -41,15 +42,7 @@ module URBANopt
41
42
  @eps = eps
42
43
  end
43
44
 
44
- attr_reader :zero
45
-
46
- attr_reader :one
47
-
48
- attr_reader :two
49
-
50
- attr_reader :ten
51
-
52
- attr_reader :eps
45
+ attr_reader :zero, :one, :two, :ten, :eps, :new_vertices
53
46
 
54
47
  ##
55
48
  # Used to determine new scaled vertices, by iteratively passing in the perimeter distance to
@@ -59,12 +52,11 @@ module URBANopt
59
52
  @new_vertices = URBANopt::GeoJSON::Zoning.divide_floor_print(@vertices, x[0].to_f, @runner, scale = true)
60
53
  new_area = OpenStudio.getArea(@new_vertices)
61
54
  raise "Cannot compute area for '#{@new_vertices}'" if new_area.empty?
55
+
62
56
  new_area = new_area.get
63
57
 
64
58
  return [new_area - @desired_area]
65
59
  end
66
-
67
- attr_reader :new_vertices
68
- end # ScaleArea
69
- end # GeoJSON
70
- end # URBANopt
60
+ end
61
+ end
62
+ end
@@ -283,6 +283,18 @@
283
283
  "ev_curtailment_frac": {
284
284
  "description": "Fraction between 0 and 1 that denotes curtailment of EV charging load to better align EV charging with expected energy production from a solar PV system",
285
285
  "type": "number"
286
+ },
287
+ "characterize_residential_buildings_from_buildstock_csv":{
288
+ "description" : "Enable UO and ResStock connection to characterize residential buildings by matching them (and their properties) with building from the BuildStock CSV. Optional for residential buildings.",
289
+ "type": "boolean"
290
+ },
291
+ "resstock_buildstock_csv_path":{
292
+ "description" : "Path to the buildstock CSV that the users want to sample from to find the closest match to their UO residential buildings features. Optional for residential buildings.",
293
+ "type": "string"
294
+ },
295
+ "uo_buildstock_mapping_csv_path":{
296
+ "description" : "Path to the uo_buildstock mapping CSV. IN this CSV users can set a match of the UO features with a buildstock building and its characteristics and the feature will run with the assigned buildstock characteristics. Optional for residential buildings.",
297
+ "type": "string"
286
298
  }
287
299
  },
288
300
  "required": [
@@ -515,4 +527,4 @@
515
527
  ]
516
528
  }
517
529
  }
518
- }
530
+ }
@@ -77,15 +77,15 @@
77
77
  },
78
78
  "underground_cables_ratio": {
79
79
  "description": "Ratio of overall cables that are underground vs. overhead for RNM analysis.",
80
- "type": "number"
80
+ "type": ["number", "null"]
81
81
  },
82
82
  "only_lv_consumers": {
83
83
  "description": "If true, only low voltage consumers will be considered in the RNM analysis.",
84
- "type": "boolean"
84
+ "type": ["boolean", "null"]
85
85
  },
86
86
  "max_number_of_lv_nodes_per_building": {
87
87
  "description": "Maximum number of low voltage nodes to represent a single building.",
88
- "type": "number"
88
+ "type": ["number", "null"]
89
89
  },
90
90
  "emissions": {
91
91
  "description": "Should be set to true to calculate electricity emissions for the associated building.",
@@ -211,9 +211,21 @@
211
211
  "2018",
212
212
  "2019"
213
213
  ]
214
+ },
215
+ "characterize_residential_buildings_from_buildstock_csv":{
216
+ "description" : "Enable UO and ResStock connection to characterize residential buildings by matching them (and their properties) with building from the BuildStock CSV.",
217
+ "type": "boolean"
218
+ },
219
+ "resstock_buildstock_csv_path":{
220
+ "description" : "Path to the buildstock CSV that the users want to sample from to find the closest match to their UO residential buildings features.",
221
+ "type": "string"
222
+ },
223
+ "uo_buildstock_mapping_csv_path":{
224
+ "description" : "Path to the uo_buildstock mapping CSV. IN this CSV users can set a match of the UO features with a buildstock building and its characteristics and the feature will run with the assigned buildstock characteristics",
225
+ "type": "string"
214
226
  }
215
227
  },
216
228
  "required": [
217
229
  ],
218
230
  "additionalProperties": false
219
- }
231
+ }
@@ -25,10 +25,11 @@ geojson[:features].each do |feature|
25
25
  # end
26
26
 
27
27
  multi_polygons = nil
28
- if geometry[:type] == 'Polygon'
28
+ case geometry[:type]
29
+ when 'Polygon'
29
30
  polygons = geometry[:coordinates]
30
31
  multi_polygons = [polygons]
31
- elsif geometry[:type] == 'MultiPolygon'
32
+ when 'MultiPolygon'
32
33
  multi_polygons = geometry[:coordinates]
33
34
  end
34
35
 
@@ -8,7 +8,7 @@ require 'json-schema'
8
8
 
9
9
  def get_building_schema(strict)
10
10
  result = nil
11
- File.open(File.dirname(__FILE__) + '/../schema/building_properties.json') do |f|
11
+ File.open("#{File.dirname(__FILE__)}/../schema/building_properties.json") do |f|
12
12
  result = JSON.parse(f.read)
13
13
  end
14
14
  if strict
@@ -21,7 +21,7 @@ end
21
21
 
22
22
  def get_taxlot_schema(strict)
23
23
  result = nil
24
- File.open(File.dirname(__FILE__) + '/../schema/taxlot_properties.json') do |f|
24
+ File.open("#{File.dirname(__FILE__)}/../schema/taxlot_properties.json") do |f|
25
25
  result = JSON.parse(f.read)
26
26
  end
27
27
  if strict
@@ -34,7 +34,7 @@ end
34
34
 
35
35
  def get_district_system_schema(strict)
36
36
  result = nil
37
- File.open(File.dirname(__FILE__) + '/../schema/district_system_properties.json') do |f|
37
+ File.open("#{File.dirname(__FILE__)}/../schema/district_system_properties.json") do |f|
38
38
  result = JSON.parse(f.read)
39
39
  end
40
40
  if strict
@@ -47,7 +47,7 @@ end
47
47
 
48
48
  def get_region_schema(strict)
49
49
  result = nil
50
- File.open(File.dirname(__FILE__) + '/../schema/region_properties.json') do |f|
50
+ File.open("#{File.dirname(__FILE__)}/../schema/region_properties.json") do |f|
51
51
  result = JSON.parse(f.read)
52
52
  end
53
53
  if strict
@@ -95,13 +95,14 @@ Dir.glob('denver_district*.geojson').each do |p|
95
95
  type = data['type']
96
96
  errors = []
97
97
 
98
- if /building/i.match(type)
98
+ case type
99
+ when /building/i
99
100
  errors = validate(building_schema, data)
100
- elsif /district system/i.match(type)
101
+ when /district system/i
101
102
  errors = validate(district_system_schema, data)
102
- elsif /taxlot/i.match(type)
103
+ when /taxlot/i
103
104
  errors = validate(taxlot_schema, data)
104
- elsif /region/i.match(type)
105
+ when /region/i
105
106
  errors = validate(region_schema, data)
106
107
  else
107
108
  raise("Unknown type: '#{type}'")
@@ -5,6 +5,6 @@
5
5
 
6
6
  module URBANopt
7
7
  module GeoJSON
8
- VERSION = '0.11.0'.freeze
8
+ VERSION = '0.11.2'.freeze
9
9
  end
10
10
  end
@@ -28,11 +28,12 @@ module URBANopt
28
28
  vertex_1 = nil
29
29
  vertex_2 = nil
30
30
  vertex_3 = nil
31
- if i == 0
31
+ case i
32
+ when 0
32
33
  vertex_1 = vertices[n - 1]
33
34
  vertex_2 = vertices[i]
34
35
  vertex_3 = vertices[i + 1]
35
- elsif i == (n - 1)
36
+ when n - 1
36
37
  vertex_1 = vertices[i - 1]
37
38
  vertex_2 = vertices[i]
38
39
  vertex_3 = vertices[0]
@@ -30,6 +30,6 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'simplecov', '~> 0.18.2'
31
31
  spec.add_development_dependency 'simplecov-lcov', '~> 0.8.0'
32
32
 
33
- spec.add_runtime_dependency 'json-schema', '~> 2.8'
33
+ spec.add_runtime_dependency 'json-schema', '~> 2.7'
34
34
  spec.add_runtime_dependency 'urbanopt-core', '~> 0.11.0'
35
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urbanopt-geojson
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanushree Charan
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2024-01-09 00:00:00.000000000 Z
13
+ date: 2024-06-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -88,14 +88,14 @@ dependencies:
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: '2.8'
91
+ version: '2.7'
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: '2.8'
98
+ version: '2.7'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: urbanopt-core
101
101
  requirement: !ruby/object:Gem::Requirement