urbanopt-geojson 0.2.0.pre1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +47 -0
- data/Gemfile +0 -3
- data/RDOC_MAIN.md +13 -7
- data/README.md +3 -3
- data/Rakefile +1 -1
- data/lib/measures/urban_geometry_creation/README.md +1 -1
- data/lib/measures/urban_geometry_creation/measure.rb +2 -0
- data/lib/measures/urban_geometry_creation/measure.xml +20 -18
- data/lib/measures/urban_geometry_creation_zoning/README.md +1 -1
- data/lib/measures/urban_geometry_creation_zoning/measure.rb +4 -3
- data/lib/measures/urban_geometry_creation_zoning/measure.xml +23 -21
- data/lib/urbanopt/geojson.rb +1 -1
- data/lib/urbanopt/geojson/building.rb +33 -28
- data/lib/urbanopt/geojson/{extension.rb → derived_extension.rb} +0 -0
- data/lib/urbanopt/geojson/feature.rb +6 -1
- data/lib/urbanopt/geojson/geo_file.rb +40 -39
- data/lib/urbanopt/geojson/helper.rb +5 -6
- data/lib/urbanopt/geojson/mapper_classes.rb +46 -46
- data/lib/urbanopt/geojson/model.rb +2 -3
- data/lib/urbanopt/geojson/schema/building_properties.json +241 -80
- data/lib/urbanopt/geojson/update_areas.rb +1 -1
- data/lib/urbanopt/geojson/validate_geojson.rb +2 -0
- data/lib/urbanopt/geojson/version.rb +1 -1
- data/lib/urbanopt/geojson/workflows/building.osw.out +4 -4
- data/urbanopt-geojson-gem.gemspec +9 -13
- metadata +22 -43
- data/lib/change_log.rb +0 -147
- data/lib/measures/urban_geometry_creation/tests/nrel_stm_footprints.geojson +0 -3238
- data/lib/measures/urban_geometry_creation/tests/shadowed_tests.rb +0 -80
- data/lib/measures/urban_geometry_creation/tests/urban_geometry_creation_test.rb +0 -139
- data/lib/measures/urban_geometry_creation_zoning/tests/nrel_stm_footprints.geojson +0 -3238
- data/lib/measures/urban_geometry_creation_zoning/tests/urban_geometry_creation_zoning_test.rb +0 -139
data/lib/measures/urban_geometry_creation_zoning/tests/urban_geometry_creation_zoning_test.rb
DELETED
@@ -1,139 +0,0 @@
|
|
1
|
-
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
|
-
# contributors. All rights reserved.
|
4
|
-
#
|
5
|
-
# Redistribution and use in source and binary forms, with or without modification,
|
6
|
-
# are permitted provided that the following conditions are met:
|
7
|
-
#
|
8
|
-
# Redistributions of source code must retain the above copyright notice, this list
|
9
|
-
# of conditions and the following disclaimer.
|
10
|
-
#
|
11
|
-
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
|
-
# list of conditions and the following disclaimer in the documentation and/or other
|
13
|
-
# materials provided with the distribution.
|
14
|
-
#
|
15
|
-
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
|
-
# used to endorse or promote products derived from this software without specific
|
17
|
-
# prior written permission.
|
18
|
-
#
|
19
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
|
-
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
|
-
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
22
|
-
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
23
|
-
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
24
|
-
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
26
|
-
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
27
|
-
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
28
|
-
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
-
# *********************************************************************************
|
30
|
-
|
31
|
-
require 'openstudio'
|
32
|
-
require 'openstudio/ruleset/ShowRunnerOutput'
|
33
|
-
require 'minitest/autorun'
|
34
|
-
require_relative '../measure.rb'
|
35
|
-
require 'fileutils'
|
36
|
-
|
37
|
-
class UrbanGeometryCreationZoningTest < MiniTest::Unit::TestCase
|
38
|
-
def test_one_building
|
39
|
-
# create an instance of the measure
|
40
|
-
measure = UrbanGeometryCreationZoning.new
|
41
|
-
|
42
|
-
# create an empty model
|
43
|
-
model = OpenStudio::Model::Model.new
|
44
|
-
|
45
|
-
# create an instance of a runner
|
46
|
-
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
|
47
|
-
|
48
|
-
geojson_file = File.absolute_path(File.join(File.dirname(__FILE__), 'nrel_stm_footprints.geojson'))
|
49
|
-
|
50
|
-
feature_id = '59a9ce2b42f7d007c059d2f0'
|
51
|
-
|
52
|
-
surrounding_buildings = 'None'
|
53
|
-
|
54
|
-
# get arguments
|
55
|
-
arguments = measure.arguments(model)
|
56
|
-
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
|
57
|
-
|
58
|
-
# create hash of argument values.
|
59
|
-
# If the argument has a default that you want to use, you don't need it in the hash
|
60
|
-
args_hash = {}
|
61
|
-
args_hash['geojson_file'] = geojson_file
|
62
|
-
args_hash['feature_id'] = feature_id
|
63
|
-
args_hash['surrounding_buildings'] = surrounding_buildings
|
64
|
-
|
65
|
-
# populate argument with specified hash value if specified
|
66
|
-
arguments.each do |arg|
|
67
|
-
temp_arg_var = arg.clone
|
68
|
-
if args_hash[arg.name]
|
69
|
-
assert(temp_arg_var.setValue(args_hash[arg.name]))
|
70
|
-
end
|
71
|
-
argument_map[arg.name] = temp_arg_var
|
72
|
-
end
|
73
|
-
|
74
|
-
# run the measure
|
75
|
-
measure.run(model, runner, argument_map)
|
76
|
-
result = runner.result
|
77
|
-
|
78
|
-
# save the model to test output directory
|
79
|
-
output_file_path = OpenStudio::Path.new(File.dirname(__FILE__) + "/output/#{feature_id}.osm")
|
80
|
-
model.save(output_file_path, true)
|
81
|
-
|
82
|
-
# show the output
|
83
|
-
show_output(result)
|
84
|
-
|
85
|
-
# assert that it ran correctly
|
86
|
-
assert_equal('Success', result.value.valueName)
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_one_building_w_surrounding_buildings
|
90
|
-
# create an instance of the measure
|
91
|
-
measure = UrbanGeometryCreationZoning.new
|
92
|
-
|
93
|
-
# create an empty model
|
94
|
-
model = OpenStudio::Model::Model.new
|
95
|
-
|
96
|
-
# create an instance of a runner
|
97
|
-
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
|
98
|
-
|
99
|
-
geojson_file = File.absolute_path(File.join(File.dirname(__FILE__), 'nrel_stm_footprints.geojson'))
|
100
|
-
|
101
|
-
feature_id = '59a9ce2b42f7d007c059d2ee'
|
102
|
-
|
103
|
-
surrounding_buildings = 'ShadingOnly'
|
104
|
-
|
105
|
-
# get arguments
|
106
|
-
arguments = measure.arguments(model)
|
107
|
-
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
|
108
|
-
|
109
|
-
# create hash of argument values.
|
110
|
-
# If the argument has a default that you want to use, you don't need it in the hash
|
111
|
-
args_hash = {}
|
112
|
-
args_hash['geojson_file'] = geojson_file
|
113
|
-
args_hash['feature_id'] = feature_id
|
114
|
-
args_hash['surrounding_buildings'] = surrounding_buildings
|
115
|
-
|
116
|
-
# populate argument with specified hash value if specified
|
117
|
-
arguments.each do |arg|
|
118
|
-
temp_arg_var = arg.clone
|
119
|
-
if args_hash[arg.name]
|
120
|
-
assert(temp_arg_var.setValue(args_hash[arg.name]))
|
121
|
-
end
|
122
|
-
argument_map[arg.name] = temp_arg_var
|
123
|
-
end
|
124
|
-
|
125
|
-
# run the measure
|
126
|
-
measure.run(model, runner, argument_map)
|
127
|
-
result = runner.result
|
128
|
-
|
129
|
-
# save the model to test output directory
|
130
|
-
output_file_path = OpenStudio::Path.new(File.dirname(__FILE__) + "/output/#{feature_id}.osm")
|
131
|
-
model.save(output_file_path, true)
|
132
|
-
|
133
|
-
# show the output
|
134
|
-
show_output(result)
|
135
|
-
|
136
|
-
# assert that it ran correctly
|
137
|
-
assert_equal('Success', result.value.valueName)
|
138
|
-
end
|
139
|
-
end
|