urbanopt-geojson 0.2.0.pre2 → 0.2.0.pre3

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
  SHA1:
3
- metadata.gz: 1ad031bd7b8b2d22974781fa200d6fc6c233c7cf
4
- data.tar.gz: a6bab4394e0bf97c15e86bdc054c37420648c184
3
+ metadata.gz: 10a192e307d2e97310601a894c2eac28caba1061
4
+ data.tar.gz: 09a0ec17fbc7a1a5ee6101094dc6be6749d4fcee
5
5
  SHA512:
6
- metadata.gz: d07f450de4bc75b28452c6d18e5ab4207139fab076a3298ec10b36e13d5eab6ac4dbc002a78dc59adb0dca4770ed4d402deaf3247905df8ae926dc7fc64444d2
7
- data.tar.gz: 82905227028b1112170d0fe8f9d411af2ba5d275690178ce1d67178952752b13ede774242e115d39cf54260da7f6532e3a4cd23ab61e9b7ff447b9e351240272
6
+ metadata.gz: 9064d122b7786d2e3b0549f4d44015267dbbbde25935c13f5397a9b82758134df8b88659fd565ae45d9340bdf7ce473f055f7a3ed30bfc902f4677df4012b633
7
+ data.tar.gz: 7c4f7ffe616d5f33f22769ac9f8981db669e7b74afeb9d58a06fbd34bda8a5d47e3250c10a660a2c49e0a1ceceb04a01f8db34e8bd5cd5972a1ba1c922699bf8
@@ -178,33 +178,34 @@ module URBANopt
178
178
  # [Parameters]
179
179
  # +feature+ - _Type:Hash_ - feature object.
180
180
  def merge_site_properties(feature)
181
- site_origins = @geojson_file[:features].select {|f| f[:properties][:type] == 'Site Origin'}
182
- if site_origins.size > 0
183
- site_origin = site_origins[0]
184
- # site origin found, do some merging
185
- # this maps site properties to building/district system properties.
186
- add_props = [
187
- {site: :surface_elevation, feature: :surface_elevation},
188
- {site: :timesteps_per_hour, feature: :timesteps_per_hour},
189
- {site: :begin_date, feature: :begin_date},
190
- {site: :end_date, feature: :end_date},
191
- {site: :cec_climate_zone, feature: :cec_climate_zone},
192
- {site: :climate_zone, feature: :climate_zone},
193
- {site: :default_template, feature: :template},
194
- {site: :weather_filename, feature: :weather_filename},
195
- {site: :tariff_filename, feature: :tariff_filename}
196
- ]
181
+ project = {}
182
+ if @geojson_file.key?(:project)
183
+ project = @geojson_file[:project]
184
+ end
197
185
 
198
- add_props.each do |prop|
199
- if site_origin[:properties].key?(prop[:site]) and site_origin[:properties][prop[:site]]
200
- # property exists in site
201
- if !feature[:properties].key?(prop[:feature]) or feature[:properties][prop[:feature]].nil? or feature[:properties][prop[:feature]].empty?
202
- # property does not exist in feature or is nil: add site property (don't overwrite)
203
- feature[:properties][prop[:feature]] = site_origin[:properties][prop[:site]]
204
- end
186
+ # this maps site properties to building/district system properties.
187
+ add_props = [
188
+ {site: :surface_elevation, feature: :surface_elevation},
189
+ {site: :timesteps_per_hour, feature: :timesteps_per_hour},
190
+ {site: :begin_date, feature: :begin_date},
191
+ {site: :end_date, feature: :end_date},
192
+ {site: :cec_climate_zone, feature: :cec_climate_zone},
193
+ {site: :climate_zone, feature: :climate_zone},
194
+ {site: :default_template, feature: :template},
195
+ {site: :weather_filename, feature: :weather_filename},
196
+ {site: :tariff_filename, feature: :tariff_filename}
197
+ ]
198
+
199
+ add_props.each do |prop|
200
+ if project.key?(prop[:site]) and project[prop[:site]]
201
+ # property exists in site
202
+ if !feature[:properties].key?(prop[:feature]) or feature[:properties][prop[:feature]].nil? or feature[:properties][prop[:feature]].empty?
203
+ # property does not exist in feature or is nil: add site property (don't overwrite)
204
+ feature[:properties][prop[:feature]] = project[prop[:site]]
205
205
  end
206
206
  end
207
207
  end
208
+
208
209
  return feature
209
210
  end
210
211
 
@@ -30,6 +30,6 @@
30
30
 
31
31
  module URBANopt
32
32
  module GeoJSON
33
- VERSION = '0.2.0.pre2'.freeze
33
+ VERSION = '0.2.0.pre3'.freeze
34
34
  end
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.2.0.pre2
4
+ version: 0.2.0.pre3
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: 2020-03-15 00:00:00.000000000 Z
13
+ date: 2020-03-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler