Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(visualize): Revise Wind Rose input descriptions to be clearer #274

Merged
merged 2 commits into from Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file modified ladybug_grasshopper/icon/LB Download Weather.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions ladybug_grasshopper/json/LB_Download_Weather.json
@@ -1,5 +1,5 @@
{
"version": "1.3.2",
"version": "1.3.3",
"nickname": "DownloadEPW",
"outputs": [
[
Expand Down Expand Up @@ -43,7 +43,7 @@
}
],
"subcategory": "0 :: Import",
"code": "\ntry:\n from ladybug.futil import unzip_file\n from ladybug.config import folders\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.download import download_file\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, give_warning\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\nimport os\n\n\nif all_required_inputs(ghenv.Component):\n # process the URL and check if it is outdated\n _weather_URL = _weather_URL.strip()\n if _weather_URL.lower().endswith('.zip'): # onebuilding URL type\n _folder_name = _weather_URL.split('/')[-1][:-4]\n else: # dept of energy URL type\n _folder_name = _weather_URL.split('/')[-2]\n if _weather_URL.endswith('/all'):\n repl_section = '{0}/all'.format(_folder_name)\n new_section = '{0}/{0}.zip'.format(_folder_name)\n _weather_URL = _weather_URL.replace(repl_section, new_section)\n _weather_URL = _weather_URL.replace(\n 'www.energyplus.net/weather-download',\n 'energyplus-weather.s3.amazonaws.com')\n _weather_URL = _weather_URL.replace(\n 'energyplus.net/weather-download',\n 'energyplus-weather.s3.amazonaws.com')\n _weather_URL = _weather_URL[:8] + _weather_URL[8:].replace('//', '/')\n msg = 'The weather file URL is out of date.\\nThis component ' \\\n 'is automatically updating it to the newer version:'\n print(msg)\n print(_weather_URL)\n give_warning(ghenv.Component, msg)\n give_warning(ghenv.Component, _weather_URL)\n\n # create default working_dir\n if _folder_ is None:\n _folder_ = folders.default_epw_folder\n try:\n _folder_.decode('ascii')\n except UnicodeDecodeError:\n raise UnicodeDecodeError(\n '\\nYour download folder \"{}\" contains non-ASCII characters\\n'\n '\\nUse the _folder_ input to this component to download EPW files'\n ' to a valid location.'.format(_folder_))\n else:\n print 'Files will be downloaded to: {}'.format(_folder_)\n\n # default file names\n epw = os.path.join(_folder_, _folder_name, _folder_name + '.epw')\n stat = os.path.join(_folder_, _folder_name, _folder_name + '.stat')\n ddy = os.path.join(_folder_, _folder_name, _folder_name + '.ddy')\n\n # download and unzip the files if they do not exist\n if not os.path.isfile(epw) or not os.path.isfile(stat) or not os.path.isfile(ddy):\n zip_file_path = os.path.join(_folder_, _folder_name, _folder_name + '.zip')\n download_file(_weather_URL, zip_file_path, True)\n unzip_file(zip_file_path)\n\n # set output\n epw_file, stat_file, ddy_file = epw, stat, ddy",
"code": "\ntry:\n from ladybug.futil import unzip_file\n from ladybug.config import folders\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.download import download_file\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, give_warning\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\nimport os\n\n\nif all_required_inputs(ghenv.Component):\n # process the URL and check if it is outdated\n _weather_URL = _weather_URL.strip()\n if _weather_URL.lower().endswith('.zip'): # onebuilding URL type\n _folder_name = _weather_URL.split('/')[-1][:-4]\n else: # dept of energy URL type\n _folder_name = _weather_URL.split('/')[-2]\n if _weather_URL.endswith('/all'):\n repl_section = '{0}/all'.format(_folder_name)\n new_section = '{0}/{0}.zip'.format(_folder_name)\n _weather_URL = _weather_URL.replace(repl_section, new_section)\n _weather_URL = _weather_URL.replace(\n 'www.energyplus.net/weather-download',\n 'energyplus-weather.s3.amazonaws.com')\n _weather_URL = _weather_URL.replace(\n 'energyplus.net/weather-download',\n 'energyplus-weather.s3.amazonaws.com')\n _weather_URL = _weather_URL[:8] + _weather_URL[8:].replace('//', '/')\n msg = 'The weather file URL is out of date.\\nThis component ' \\\n 'is automatically updating it to the newer version:'\n print(msg)\n print(_weather_URL)\n give_warning(ghenv.Component, msg)\n give_warning(ghenv.Component, _weather_URL)\n\n # create default working_dir\n if _folder_ is None:\n _folder_ = folders.default_epw_folder\n try:\n _folder_.decode('ascii')\n except UnicodeDecodeError:\n raise ValueError(\n '\\nYour download folder \"{}\" contains non-ASCII characters\\n'\n 'Use the _folder_ input of this component to download files'\n ' to a location with acceptable characters.'.format(_folder_))\n else:\n print 'Files will be downloaded to: {}'.format(_folder_)\n\n # default file names\n epw = os.path.join(_folder_, _folder_name, _folder_name + '.epw')\n stat = os.path.join(_folder_, _folder_name, _folder_name + '.stat')\n ddy = os.path.join(_folder_, _folder_name, _folder_name + '.ddy')\n\n # download and unzip the files if they do not exist\n if not os.path.isfile(epw) or not os.path.isfile(stat) or not os.path.isfile(ddy):\n zip_file_path = os.path.join(_folder_, _folder_name, _folder_name + '.zip')\n download_file(_weather_URL, zip_file_path, True)\n unzip_file(zip_file_path)\n\n # set output\n epw_file, stat_file, ddy_file = epw, stat, ddy",
"category": "Ladybug",
"name": "LB Download Weather",
"description": "Automatically download a .zip file from a URL where climate data resides,\nunzip the file, and open .epw, .stat, and ddy weather files.\n-"
Expand Down
14 changes: 7 additions & 7 deletions ladybug_grasshopper/json/LB_Wind_Rose.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions ladybug_grasshopper/src/LB Download Weather.py
Expand Up @@ -29,7 +29,7 @@

ghenv.Component.Name = 'LB Download Weather'
ghenv.Component.NickName = 'DownloadEPW'
ghenv.Component.Message = '1.3.2'
ghenv.Component.Message = '1.3.3'
ghenv.Component.Category = 'Ladybug'
ghenv.Component.SubCategory = '0 :: Import'
ghenv.Component.AdditionalHelpFromDocStrings = '1'
Expand Down Expand Up @@ -80,10 +80,10 @@
try:
_folder_.decode('ascii')
except UnicodeDecodeError:
raise UnicodeDecodeError(
raise ValueError(
'\nYour download folder "{}" contains non-ASCII characters\n'
'\nUse the _folder_ input to this component to download EPW files'
' to a valid location.'.format(_folder_))
'Use the _folder_ input of this component to download files'
' to a location with acceptable characters.'.format(_folder_))
else:
print 'Files will be downloaded to: {}'.format(_folder_)

Expand Down
37 changes: 17 additions & 20 deletions ladybug_grasshopper/src/LB Wind Rose.py
Expand Up @@ -29,22 +29,19 @@
the wind rose (Default: 36).
_center_pt_: Point3D to be used as a starting point to generate the geometry of
the plot (Default: (0, 0, 0)).
_show_calmrose_: A boolean to indicate if the wind rose displays a calm rose. The
calm rose is a radial plot in the center of the wind rose with a radius
corresponding to the total zero values divided by the number of
directions. This allows the wind rose to represent zero values
from _data even though such values don't have any direction
associated with them. (Default: False).
_show_freq_: A boolean to show the frequency of _data data values in the
wind direction bins. The frequency lines represent constant intervals
in time while the color illustrates the average _data data values
associated with each interval. The number of frequency lines with
similar colors therefore indicate a higher frequency of that
value. (Default: True)
show_calm_: A boolean to indicate if the wind rose should display the fraction of
time with zero wind speed using a circle in the center of the plot.
The radius of this circle corresponds to the total amount of time
with zero values divided by the number of directions. This means that
the time period representing zero values is evenly distrobuted
across all directions. (Default: False).
show_avg_: A boolean to note whether the average value in each wind direction bin
should be displayed instead of the complete frequency of _data
values. (Default: False).
_freq_dist_: The distance for the frequency interval in model units. If
_show_calmrose is True, then the initial frequency interval corresponds
show_calm_ is True, then the initial frequency interval corresponds
to the number of calm hours in the data collection, which may not
align with this _freq_dist (Default: 5 meters)
align with this freq_dist_ (Default: 5 meters)
_freq_hours_: The number of hours in each frequency interval (Default: 50).
_max_freq_lines_: A number representing the maximum frequency intervals in
the rose, which determines the maximum amount of hours represented by the
Expand Down Expand Up @@ -103,7 +100,7 @@

ghenv.Component.Name = 'LB Wind Rose'
ghenv.Component.NickName = 'WindRose'
ghenv.Component.Message = '1.3.0'
ghenv.Component.Message = '1.3.1'
ghenv.Component.Category = 'Ladybug'
ghenv.Component.SubCategory = '2 :: Visualize Data'
ghenv.Component.AdditionalHelpFromDocStrings = '2'
Expand Down Expand Up @@ -197,9 +194,9 @@ def title_text(data_col):
if _freq_dist_ is None:
_freq_dist_ = 5.0 / conversion_to_meters()

# set default show_freq and _show_calmrose_
_show_calmrose_ = False if _show_calmrose_ is None else _show_calmrose_
_show_freq_ = True if _show_freq_ is None else _show_freq_
# set default show_freq and show_calm_
show_calm_ = False if show_calm_ is None else show_calm_
show_freq_ = True if show_avg_ is None else not show_avg_

# set up empty lists of objects to be filled
all_windrose_lines = []
Expand Down Expand Up @@ -244,11 +241,11 @@ def title_text(data_col):
windrose.frequency_intervals_compass = _max_freq_lines_
windrose.frequency_spacing_distance = _freq_dist_
windrose.north = north_
windrose.show_freq = _show_freq_
windrose.show_freq = show_freq_

calm_text = ''
if isinstance(speed_data.header.data_type, Speed):
windrose.show_zeros = _show_calmrose_
windrose.show_zeros = show_calm_
calm_text = '\nCalm for {}% of the time = {} hours.'.format(
round(windrose._zero_count /
len(windrose.analysis_values) * 100.0, 2),
Expand Down
Binary file modified ladybug_grasshopper/user_objects/LB Download Weather.ghuser
Binary file not shown.
Binary file modified ladybug_grasshopper/user_objects/LB Wind Rose.ghuser
Binary file not shown.
Binary file modified samples/windrose_plot.gh
Binary file not shown.