Skip to content

Commit

Permalink
updated for release
Browse files Browse the repository at this point in the history
  • Loading branch information
ocni-dtu committed Sep 15, 2018
1 parent 06fc064 commit 0a64fbc
Show file tree
Hide file tree
Showing 63 changed files with 33 additions and 5,507 deletions.
Binary file added grasshopper/examples/Geometry Load and Save.gh
Binary file not shown.
Binary file modified grasshopper/examples/Hill Slope Run-Off.gh
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed release/Examples/CMF Compute Slope Run-off.gh
Binary file not shown.
Binary file removed release/Examples/CMF Process Slope Run-off.gh
Binary file not shown.
Binary file modified release/Examples/Geometry Load and Save.gh
Binary file not shown.
Binary file added release/Examples/Hill Slope Run-Off.gh
Binary file not shown.
Binary file modified release/Grasshopper User Objects/Livestock CMF Ground.ghuser
Binary file not shown.
Binary file modified release/Grasshopper User Objects/Livestock CMF Outputs.ghuser
Binary file not shown.
Binary file modified release/Grasshopper User Objects/Livestock CMF Results.ghuser
Binary file not shown.
Binary file modified release/Grasshopper User Objects/Livestock CMF Solve.ghuser
Binary file not shown.
Binary file not shown.
Binary file modified release/Grasshopper User Objects/Livestock Load Mesh.ghuser
Binary file not shown.
Binary file not shown.
Binary file modified release/Grasshopper User Objects/Livestock Save Mesh.ghuser
Binary file not shown.
49 changes: 24 additions & 25 deletions release/Python Rhino Script/components/comp_cmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from shutil import copyfile
import pprint
import json
import datetime
from System.Diagnostics import Process
import shutil
import tempfile
Expand Down Expand Up @@ -140,7 +141,8 @@ def outputs():
self.surface_water = None
self.et_number = None
self.surface_run_off_method = None
self.ground_dict = None
self.ground_dict = {'mesh': None, 'layers': None, 'ground_type': None, 'surface_water': None,
'et_method': None, 'runoff_method': None}

def check_inputs(self):
"""
Expand Down Expand Up @@ -1285,18 +1287,14 @@ def outputs():
# Additional Parameters
self.case_path = None
self.mesh = None
self.py_exe = gh_misc.get_python_exe()
self.py_exe = self.get_cpython()
self.written = False

def check_inputs(self):
"""Checks inputs and raises a warning if an input is not
the correct type."""

if self.ground:
self.checks = True
else:
warning = 'Temperature should be a float'
self.add_warning(warning)
self.checks = True

def config(self):
"""Generates the Grasshopper component."""
Expand Down Expand Up @@ -1689,11 +1687,7 @@ def check_inputs(self):
Checks inputs and raises a warning if an input is not the correct type.
"""

if self.path:
self.checks = True
else:
warning = 'Temperature should be a float'
self.add_warning(warning)
self.checks = True

def config(self):
"""Generates the Grasshopper component."""
Expand All @@ -1711,8 +1705,11 @@ def run_checks(self, path, fetch_result, run):
"""

# Gather data
self.path = os.path.join(path, 'results.json')
self.fetch_result = int(self.add_default_value(fetch_result, 1))
if path:
self.path = os.path.join(path, 'results.json')
else:
self.path = None
self.fetch_result = self.add_default_value(fetch_result, 1)
self.run_component = self.add_default_value(run, 3)

# Run checks
Expand Down Expand Up @@ -2140,7 +2137,7 @@ def inputs():
'all start from 1.\n'
'Default is 01-01-[current year]',
'access': 'list',
'default_value': None},
'default_value': [1, 1, datetime.datetime.now().year]},

4: {'name': 'SolverTolerance',
'description': 'Solver tolerance\nDefault is 1e-8',
Expand Down Expand Up @@ -2208,19 +2205,21 @@ def run_checks(self, length, time_step, start_time, tolerance):

def modified_settings(self):

if len(self.length) == 1:
self.length[0] = int(self.length[0])
self.length.append('h')
if self.length:
if len(self.length) == 1:
self.length[0] = int(self.length[0])
self.length.append('h')

elif len(self.length) == 2:
self.length[0] = int(self.length[0])
elif len(self.length) == 2:
self.length[0] = int(self.length[0])

if len(self.time_step) == 1:
self.time_step[0] = int(self.time_step[0])
self.time_step.append('h')
if self.time_step:
if len(self.time_step) == 1:
self.time_step[0] = int(self.time_step[0])
self.time_step.append('h')

elif len(self.time_step) == 2:
self.time_step[0] = int(self.time_step[0])
elif len(self.time_step) == 2:
self.time_step[0] = int(self.time_step[0])

self.start_time = {'day': int(self.start_time[0]),
'month': int(self.start_time[1]),
Expand Down
9 changes: 9 additions & 0 deletions release/Python Rhino Script/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os

# Livestock imports
from livestock.lib import misc

# Grasshopper imports
import Grasshopper.Kernel as gh
Expand Down Expand Up @@ -116,6 +117,14 @@ def add_default_value(self, parameter, param_number):
else:
return parameter

def get_cpython(self):

try:
return misc.get_python_exe()
except KeyError:
self.add_warning('Python Executor was not found. Please drop a Livestock Python Executor component onto '
'the canvas and connect a valid python.exe path to it.')

def component_data(n):
"""Function that reads the grasshopper component list and returns the component data"""

Expand Down
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

176 changes: 0 additions & 176 deletions release/Python Rhino Script/config_livestock/archive/TestCMF.py

This file was deleted.

This file was deleted.

This file was deleted.

Empty file.
Empty file.
Loading

0 comments on commit 0a64fbc

Please sign in to comment.