Skip to content

Commit

Permalink
Merge branch 'release-4.0' into 3568-fastapi
Browse files Browse the repository at this point in the history
  • Loading branch information
reyery committed Sep 6, 2024
2 parents 55e021f + c449530 commit 8f82fb2
Show file tree
Hide file tree
Showing 4 changed files with 13,736 additions and 14,659 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/setup_build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
name: Build CEA Setup

on:
workflow_dispatch
workflow_dispatch:
inputs:
gui-branch:
description: 'Branch of GUI repo to build with'
required: true
type: string
default: 'master'

jobs:
build_win_setup:
Expand Down Expand Up @@ -59,6 +65,8 @@ jobs:
with:
path: gui
repository: architecture-building-systems/CityEnergyAnalyst-GUI
ref: ${{ inputs.gui-branch }}
fetch-depth: 0

- uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -120,6 +128,8 @@ jobs:
with:
path: gui
repository: architecture-building-systems/CityEnergyAnalyst-GUI
ref: ${{ inputs.gui-branch }}
fetch-depth: 0

- name: Fetch micromamba
run: |
Expand Down
2 changes: 1 addition & 1 deletion cea/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.38.0"
__version__ = "4.0.0-alpha"


class ConfigError(Exception):
Expand Down
53 changes: 29 additions & 24 deletions cea/datamanagement/weather_helper/generate_weather_data_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,44 @@
fiona.drvsupport.supported_drivers['LIBKML'] = 'rw'

URL_LIST = [
"https://climate.onebuilding.org/WMO_Region_1_Africa/Region1_Africa_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_2_Asia/Region2_Asia_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_2_Asia/Region2_Region6_Russia_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_3_South_America/Region3_South_America_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_4_North_and_Central_America/Region4_Canada_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_4_North_and_Central_America/Region4_USA_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_4_North_and_Central_America/Region4_NA_CA_Caribbean_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_4_North_and_Central_America/Region4_CaliforniaClimateZones_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_4_North_and_Central_America/Region4_Canada_NRC_Future_TMY_Year_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_4_North_and_Central_America/Region4_Canada_NRC_Future_Extreme_Warm_Year_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_4_North_and_Central_America/Region4_Canada_NRC_Future_Extreme_Cold_Year_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_4_North_and_Central_America/Region4_Canada_NRC_Future_Avg_Year_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_5_Southwest_Pacific/Region5_Southwest_Pacific_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_6_Europe/Region6_Europe_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_6_Europe/Region2_Region6_Russia_EPW_Processing_locations.kml",
"https://climate.onebuilding.org/WMO_Region_7_Antarctica/Region7_Antarctica_EPW_Processing_locations.kml"
"https://climate.onebuilding.org/sources/Region1_Africa_TMYx_EPW_Processing_locations.xlsx",
"https://climate.onebuilding.org/sources/Region2_Asia_TMYx_EPW_Processing_locations.xlsx",
"https://climate.onebuilding.org/sources/Region2_Region6_Russia_TMYx_EPW_Processing_locations.xlsx",
"https://climate.onebuilding.org/sources/Region3_South_America_TMYx_EPW_Processing_locations.xlsx",
"https://climate.onebuilding.org/sources/Region4_USA_TMYx_EPW_Processing_locations.xlsx",
"https://climate.onebuilding.org/sources/Region4_Canada_TMYx_EPW_Processing_locations.xlsx",
"https://climate.onebuilding.org/sources/Region4_NA_CA_Caribbean_TMYx_EPW_Processing_locations.xlsx",
"https://climate.onebuilding.org/sources/Region5_Southwest_Pacific_TMYx_EPW_Processing_locations.xlsx",
"https://climate.onebuilding.org/sources/Region6_Europe_TMYx_EPW_Processing_locations.xlsx",
"https://climate.onebuilding.org/sources/Region7_Antarctica_TMYx_EPW_Processing_locations.xlsx",
]

WEATHER_DATA_LOCATION = os.path.join(os.path.realpath(os.path.dirname(__file__)), 'weather.geojson')


def main():
# Combine for global data
kmls = [gpd.read_file(url) for url in URL_LIST]
global_gdf = pd.concat(kmls)
excels = [pd.read_excel(url) for url in URL_LIST]
global_df = pd.concat(excels)

# Filter NA
global_gdf = global_gdf[global_gdf['description'].notna()]
# Filter for latest TMYx url
latest_tmyx = global_gdf[global_gdf["description"].str.contains("TMYx.2007-2021")]
latest_tmyx["url"] = latest_tmyx["description"].str.extract(r'https?://climate.onebuilding.org/([^ ]+\.zip)')

latest_tmyx[["url", "geometry"]].to_file(WEATHER_DATA_LOCATION)
latest_tmyx = global_df[global_df["URL"].str.contains("TMYx.2009-2023")].set_index("WMO")

# Get second latest TMYx
second_latest_tmyx = global_df[global_df["URL"].str.contains("TMYx.2007-2021")].set_index("WMO")
diff_tmyx = second_latest_tmyx.loc[second_latest_tmyx.index.difference(latest_tmyx.index)]

# Combine latest and diff TMYx
combined_tmyx = pd.concat([latest_tmyx, diff_tmyx])
combined_tmyx["url"] = combined_tmyx["URL"].str.extract(r'https?://climate.onebuilding.org/([^ ]+\.zip)')

# Write to geojson
gdf = gpd.GeoDataFrame(
combined_tmyx,
geometry=gpd.points_from_xy(combined_tmyx["Longitude (E+/W-)"], combined_tmyx["Latitude (N+/S-)"]),
crs="EPSG:4326"
)
gdf[["url", "geometry"]].to_file(WEATHER_DATA_LOCATION, index=False)


if __name__ == '__main__':
Expand Down
Loading

0 comments on commit 8f82fb2

Please sign in to comment.