Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
kflemin committed Jun 27, 2022
2 parents d61c128 + 3345753 commit 1a40d0b
Show file tree
Hide file tree
Showing 8 changed files with 968 additions and 176 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# URBANopt GeoJSON Gem

## Version 0.8.1
Date Range: 05/11/22 - 06/27/22

- Fixed [#233]( https://github.com//urbanopt/urbanopt-geojson-gem/pull/233 ), Emissions workflow enhancements

## Version 0.8.0
Date Range: 11/23/21 - 05/10/21
Date Range: 11/23/21 - 05/10/22
- Fixed [#205]( https://github.com/urbanopt/urbanopt-geojson-gem/pull/205 ), adding RNM result fields
- Fixed [#206]( https://github.com/urbanopt/urbanopt-geojson-gem/pull/206 ), Bump follow-redirects from 1.13.3 to 1.14.7 in /docs
- Fixed [#207]( https://github.com/urbanopt/urbanopt-geojson-gem/pull/207 ), Bump follow-redirects from 1.13.3 to 1.14.8 in /docs
Expand Down
36 changes: 30 additions & 6 deletions lib/urbanopt/geojson/geo_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def self.from_file(path)
symbolize_names: true
)


# validate geojson file against schema
geojson_errors = validate(@@geojson_schema, geojson_file)
unless geojson_errors.empty?
Expand All @@ -91,6 +92,15 @@ def self.from_file(path)
# initialize @@logger
@@logger ||= URBANopt::GeoJSON.logger

# validate project section first
if geojson_file.key?(:project)
errors = validate(@@site_schema, geojson_file[:project])

unless errors.empty?
raise "Project section does not adhere to schema: \n #{errors.join('\n ')}"
end
end

# validate each feature against schema
geojson_file[:features].each do |feature|
properties = feature[:properties]
Expand Down Expand Up @@ -213,12 +223,12 @@ def merge_site_properties(feature)
{ site: :weather_filename, feature: :weather_filename },
{ site: :tariff_filename, feature: :tariff_filename },
{ site: :emissions, feature: :emissions },
{ site: :emissions_future_subregion, feature: :emissions_future_subregion },
{ site: :emissions_hourly_historical_subregion, feature: :emissions_hourly_historical_subregion },
{ site: :emissions_annual_historical_subregion, feature: :emissions_annual_historical_subregion },
{ site: :emissions_future_year, feature: :emissions_future_year },
{ site: :emissions_hourly_historical_year, feature: :emissions_hourly_historical_year },
{ site: :emissions_annual_historical_year, feature: :emissions_annual_historical_year }
{ site: :electricity_emissions_future_subregion, feature: :electricity_emissions_future_subregion },
{ site: :electricity_emissions_hourly_historical_subregion, feature: :electricity_emissions_hourly_historical_subregion },
{ site: :electricity_emissions_annual_historical_subregion, feature: :electricity_emissions_annual_historical_subregion },
{ site: :electricity_emissions_future_year, feature: :electricity_emissions_future_year },
{ site: :electricity_emissions_hourly_historical_year, feature: :electricity_emissions_hourly_historical_year },
{ site: :electricity_emissions_annual_historical_year, feature: :electricity_emissions_annual_historical_year }
]

add_props.each do |prop|
Expand Down Expand Up @@ -295,6 +305,19 @@ def self.get_region_schema(strict)
return result
end

def self.get_site_schema(strict)
result = nil
File.open(File.dirname(__FILE__) + '/schema/site_properties.json') do |f|
result = JSON.parse(f.read)
end
if strict
result['additionalProperties'] = true
else
result['additionalProperties'] = false
end
return result
end

def self.get_electrical_connector_schema(strict)
result = nil
File.open(File.dirname(__FILE__) + '/schema/electrical_connector_properties.json') do |f|
Expand Down Expand Up @@ -356,6 +379,7 @@ def self.get_thermal_junction_schema(strict)
@@electrical_junction_schema = get_electrical_junction_schema(strict)
@@thermal_connector_schema = get_thermal_connector_schema(strict)
@@thermal_junction_schema = get_thermal_junction_schema(strict)
@@site_schema = get_site_schema(strict)
end
end
end
137 changes: 6 additions & 131 deletions lib/urbanopt/geojson/schema/building_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,141 +283,16 @@
"ev_curtailment_frac": {
"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",
"type": "number"
},
"emissions": {
"description": "Should be set to true to calculate emissions for the associated building.",
"type": "boolean"
},
"emissions_future_subregion": {
"description": "Future subregion. Options: AZNMc, CAMXc, ERCTc, FRCCc, MROEc, MROWc, NEWEc, NWPPc, NYSTc, RFCEc, RFCMc, RFCWc, RMPAc, SPNOc, SPSOc, SRMVc, SRMWc, SRSOc, SRTVc, and SRVCc",
"type": "string",
"enum": [
"AZNMc",
"CAMXc",
"ERCTc",
"FRCCc",
"MROEc",
"MROWc",
"NEWEc",
"NWPPc",
"NYSTc",
"RFCEc",
"RFCMc",
"RFCWc",
"RMPAc",
"SPNOc",
"SPSOc",
"SRMVc",
"SRMWc",
"SRSOc",
"SRTVc",
"SRVCc"
]
},
"emissions_hourly_historical_subregion": {
"description": "Historical hourly subregion. Options: California, Carolinas, Central, Florida, Mid-Atlantic, Midwest, New England, New York, Northwest, Rocky Mountains, Southeast, Southwest, Tennessee, and Texas",
"type": "string",
"enum": [
"California",
"Carolinas",
"Central",
"Florida",
"Mid-Atlantic",
"Midwest",
"New England",
"New York",
"Northwest",
"Rocky Mountains",
"Southeast",
"Southwest",
"Tennessee",
"Texas"
]
},
"emissions_annual_historical_subregion": {
"description": "Historical annual subregion. Options: AKGD, AKMS, AZNM, CAMX, ERCT, FRCC, HIMS, HIOA, MROE, MROW, NEWE, NWPP, NYCW, NYLI, NYUP, RFCE, RFCM, RFCW, RMPA, SPNO, SPSO, SRMV, SRMW, SRSO, SRTV, and SRVC",
"type": "string",
"enum": [
"AKGD",
"AKMS",
"AZNM",
"CAMX",
"ERCT",
"FRCC",
"HIMS",
"HIOA",
"MROE",
"MROW",
"NEWE",
"NWPP",
"NYCW",
"NYLI",
"NYUP",
"RFCE",
"RFCM",
"RFCW",
"RMPA",
"SPNO",
"SPSO",
"SRMV",
"SRMW",
"SRSO",
"SRTV",
"SRVC"
]
},
"emissions_future_year": {
"description": "Future Year. Options: 2020 to 2050 in two year increments",
"type": "string",
"enum": [
"2020",
"2022",
"2024",
"2026",
"2028",
"2030",
"2032",
"2034",
"2036",
"2038",
"2040",
"2042",
"2044",
"2046",
"2048",
"2050"
]
},
"emissions_hourly_historical_year": {
"description": "Hourly Historical Year. Options: 2019.",
"type": "string",
"enum": [
"2019"
]
},
"emissions_annual_historical_year": {
"description": "Annual Historical Year. Options: 2007, 2009, 2010, 2012, 2014, 2016, 2018, and 2019.",
"type": "string",
"enum": [
"2007",
"2009",
"2010",
"2012",
"2014",
"2016",
"2018",
"2019"
]
}
},
"required": [
"building_type",
"floor_area",
"footprint_area",
"required": [
"id",
"type",
"name",
"floor_area",
"number_of_stories",
"type"
"footprint_area",
"building_type"
],
"definitions": {
"buildingType": {
Expand Down Expand Up @@ -640,4 +515,4 @@
]
}
}
}
}
Loading

0 comments on commit 1a40d0b

Please sign in to comment.