urbanopt-geojson 0.3.0.pre1 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.github/pull_request_template.md +2 -2
  3. data/CHANGELOG.md +52 -6
  4. data/CONTRIBUTING.md +1 -1
  5. data/LICENSE.md +1 -1
  6. data/RDOC_MAIN.md +26 -22
  7. data/README.md +2 -2
  8. data/Rakefile +1 -1
  9. data/doc_templates/LICENSE.md +1 -1
  10. data/doc_templates/copyright_erb.txt +1 -1
  11. data/doc_templates/copyright_js.txt +1 -1
  12. data/doc_templates/copyright_ruby.txt +1 -1
  13. data/docs/.vuepress/components/InnerJsonSchema.vue +7 -11
  14. data/docs/.vuepress/config.js +11 -1
  15. data/docs/.vuepress/highlight.js +1 -1
  16. data/docs/.vuepress/json-schema-deref-loader.js +22 -0
  17. data/docs/README.md +3 -4
  18. data/docs/package-lock.json +5204 -6881
  19. data/docs/package.json +12 -9
  20. data/lib/measures/.rubocop.yml +1 -1
  21. data/lib/measures/urban_geometry_creation/LICENSE.md +1 -1
  22. data/lib/measures/urban_geometry_creation/README.md +8 -0
  23. data/lib/measures/urban_geometry_creation/measure.rb +21 -4
  24. data/lib/measures/urban_geometry_creation/measure.xml +34 -20
  25. data/lib/measures/urban_geometry_creation_zoning/LICENSE.md +1 -1
  26. data/lib/measures/urban_geometry_creation_zoning/measure.rb +3 -3
  27. data/lib/measures/urban_geometry_creation_zoning/measure.xml +8 -13
  28. data/lib/urbanopt-geojson.rb +1 -1
  29. data/lib/urbanopt/geojson.rb +2 -1
  30. data/lib/urbanopt/geojson/building.rb +61 -10
  31. data/lib/urbanopt/geojson/derived_extension.rb +1 -1
  32. data/lib/urbanopt/geojson/district_system.rb +1 -1
  33. data/lib/urbanopt/geojson/feature.rb +117 -3
  34. data/lib/urbanopt/geojson/geo_file.rb +3 -4
  35. data/lib/urbanopt/geojson/helper.rb +46 -3
  36. data/lib/urbanopt/geojson/logging.rb +1 -1
  37. data/lib/urbanopt/geojson/mapper_classes.rb +1 -1
  38. data/lib/urbanopt/geojson/model.rb +3 -4
  39. data/lib/urbanopt/geojson/region.rb +1 -1
  40. data/lib/urbanopt/geojson/scale_area.rb +95 -0
  41. data/lib/urbanopt/geojson/schema/building_properties.json +248 -80
  42. data/lib/urbanopt/geojson/schema/electrical_connector_properties.json +9 -9
  43. data/lib/urbanopt/geojson/schema/electrical_junction_properties.json +4 -5
  44. data/lib/urbanopt/geojson/schema/thermal_connector_properties.json +1 -1
  45. data/lib/urbanopt/geojson/schema/thermal_junction_properties.json +1 -1
  46. data/lib/urbanopt/geojson/update_areas.rb +1 -1
  47. data/lib/urbanopt/geojson/validate_geojson.rb +1 -1
  48. data/lib/urbanopt/geojson/version.rb +2 -2
  49. data/lib/urbanopt/geojson/workflows/building.osw.out +4 -4
  50. data/lib/urbanopt/geojson/zoning.rb +21 -16
  51. data/urbanopt-geojson-gem.gemspec +5 -12
  52. metadata +14 -30
  53. data/lib/measures/urban_geometry_creation/tests/nrel_stm_footprints.geojson +0 -3238
  54. data/lib/measures/urban_geometry_creation/tests/shadowed_tests.rb +0 -80
  55. data/lib/measures/urban_geometry_creation/tests/urban_geometry_creation_test.rb +0 -139
  56. data/lib/measures/urban_geometry_creation_zoning/tests/nrel_stm_footprints.geojson +0 -3238
  57. data/lib/measures/urban_geometry_creation_zoning/tests/urban_geometry_creation_zoning_test.rb +0 -139
@@ -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