def test_my_inputs(self):
     tester = VariableTester(__file__,
                             package_order=['urbansim'],
                             test_data={
                                 'gridcell': {
                                     'grid_id':
                                     array([1, 2, 3, 4]),
                                     'relative_x':
                                     array([1, 2, 1, 2]),
                                     'relative_y':
                                     array([1, 1, 2, 2]),
                                     'year_built':
                                     array([1995, 1799, 2006, 200],
                                           dtype="int32")
                                 },
                                 'urbansim_constant': {
                                     "walking_distance_circle_radius":
                                     array([150]),
                                     'cell_size':
                                     array([150]),
                                 }
                             })
     SimulationState().set_current_time(2005)
     should_be = array([8, 10, 2, 0])
     tester.test_is_equal_for_variable_defined_by_this_module(
         self, should_be)
Exemple #2
0
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=['urbansim_parcel', 'urbansim'],
            test_data={
                'building': {
                    'building_id':
                    array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
                    'building_type_id':
                    array([1, 1, 1, 1, 2, 2, 2, 3, 3, 3]),
                    'residential_units':
                    array([7, 2, 3, 0, 2, 3, 4, 1, 0, 0]),
                    'non_residential_sqft':
                    array([19, 2000, 310, 400, 0, 0, 0, 45, 79, 200]),
                    'sqft_per_unit':
                    array([0, 0, 0, 0, 10, 15, 50, 0, 0, 0])
                },
                "building_type": {
                    'building_type_id':
                    array([1, 2, 3]),
                    'unit_name':
                    array(
                        ['building_sqft', 'residential_units', 'parcel_sqft'])
                },
            })

        should_be = array(
            [19, 2000, 310, 400, 2 * 10, 3 * 15, 4 * 50, 45, 79, 200])

        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=['urbansim_parcel', 'urbansim'],
            test_data={
                'building': {
                    'building_id':
                    array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
                    'building_type_id':
                    array([1, 1, 1, 1, 2, 2, 2, 3, 3, 3]),
                    'building_sqft':
                    array([19, 2000, 310, 400, 0, 5000, 300, 45, 79, 200]),
                },
                "demolition_cost_per_sqft": {
                    'building_type_id': array([1, 2, 3]),
                    'demolition_cost_per_sqft': array([200, 100, 300])
                },
            })

        should_be = array([
            19 * 200, 2000 * 200, 310 * 200, 400 * 200, 0, 5000 * 100,
            300 * 100, 45 * 300, 79 * 300, 200 * 300
        ])

        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
Exemple #4
0
    def test_my_inputs(self):
        """Total number of residential units from single family buildings.
        """
        tester = VariableTester(
            __file__,
            package_order=['urbansim'],
            test_data={
                'gridcell':{
                    'grid_id':array([1,2,3]),
                    },
                'building': {
                    'building_id':   array([1,2,3,4,5,6]),
                    'building_type': array([1,2,1,2,1,1]),
                    'grid_id':       array([2,3,1,1,2,1]),
                    'residential_units': array([100, 350, 1000, 0, 430, 95])
                    },
                'building_type': {
                    'building_type_id':array([1,2]),
                    'name': array(['foo', 'single_family'])
                }
            }
        )

        should_be = array([1095, 530, 350])
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #5
0
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=['urbansim'],
            test_data={
                'gridcell': {
                    'grid_id':
                    array([1, 2, 3, 4]),
                    'relative_x':
                    array([1, 2, 1, 2]),
                    'relative_y':
                    array([1, 1, 2, 2]),
                    'developable_residential_units_capacity':
                    array([100, 500, 1000, 1500])
                },
                'urbansim_constant': {
                    "walking_distance_circle_radius": array([150]),
                    'cell_size': array([150]),
                    "acres": array([105.0]),
                }
            })

        should_be = array([1800.0, 3100.0, 4600.0, 6000.0])
        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
Exemple #6
0
    def test_my_inputs(self):
        """Total number of residential units from single family buildings.
        """
        tester = VariableTester(__file__,
                                package_order=['urbansim'],
                                test_data={
                                    'gridcell': {
                                        'grid_id': array([1, 2, 3]),
                                    },
                                    'building': {
                                        'building_id':
                                        array([1, 2, 3, 4, 5, 6]),
                                        'building_type':
                                        array([1, 2, 1, 2, 1, 1]),
                                        'grid_id':
                                        array([2, 3, 1, 1, 2, 1]),
                                        'residential_units':
                                        array([100, 350, 1000, 0, 430, 95])
                                    },
                                    'building_type': {
                                        'building_type_id': array([1, 2]),
                                        'name': array(['foo', 'single_family'])
                                    }
                                })

        should_be = array([1095, 530, 350])
        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
Exemple #7
0
    def test_my_inputs2(self):
        tester = VariableTester(
            __file__,
            package_order=['urbansim_parcel', 'urbansim'],
            test_data={
                'development_project_proposal': {
                    "proposal_id": array([1, 2, 3, 4, 5]),
                    "start_year": array([2005, 2007, 2005, 2006, 2006])
                },
                'development_project_proposal_component': {
                    "proposal_component_id":
                    arange(8) + 1,
                    "proposal_id":
                    array([3, 3, 5, 2, 5, 1, 3, 1]),
                    "component_id":
                    array([3, 1, 4, 2, 4, 1, 3, 4]),
                    "annual_construction_schedule":
                    array([
                        "[100]", "[50, 100]", "[50, 75, 100]", "[25, 50, 100]",
                        "[25, 50, 75, 100]", "[20, 40, 60, 80, 100]",
                        "[20, 40, 60, 80, 100]", "[20, 40, 60, 80, 100]"
                    ])
                },
                'development_template_component': {
                    "component_id": array([1, 2, 3, 4]),
                    "velocity_function_id": array([2, 1, 1, 3])
                },
            })
        SimulationState().set_current_time(2007)
        should_be = array([100, 100, 75, 25, 50, 60, 60, 60])

        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=['urbansim'],
            test_data={
                'gridcell': {
                    'grid_id':
                    array([1, 2, 3, 4]),
                    'relative_x':
                    array([1, 2, 1, 2]),
                    'relative_y':
                    array([1, 1, 2, 2]),
                    'number_of_developed_within_walking_distance':
                    array([3, 5, 1, 0]),
                },
                'urbansim_constant': {
                    "walking_distance_circle_radius": array([150]),
                    'cell_size': array([150]),
                }
            })

        should_be = 100 * array([3 / 5.0, 5 / 5.0, 1 / 5.0, 0 / 5.0])

        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
Exemple #9
0
    def test_my_inputs(self):
        tester = VariableTester(__file__,
                                package_order=['urbansim'],
                                test_data={
                                    'gridcell': {
                                        'grid_id':
                                        array([1, 2, 3, 4]),
                                        'relative_x':
                                        array([1, 2, 1, 2]),
                                        'relative_y':
                                        array([1, 1, 2, 2]),
                                        'number_of_industrial_jobs':
                                        array([20, 0, 100, 1]),
                                    },
                                    'urbansim_constant': {
                                        'walking_distance_circle_radius':
                                        array([150]),
                                        'cell_size':
                                        array([150]),
                                    }
                                })

        should_be = array([160, 21, 321, 103])
        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=['urbansim_parcel', 'urbansim'],
            test_data={
                'development_project_proposal_component': {
                    "proposal_component_id": arange(8) + 1,
                    "building_type_id": array([1, 1, 1, 1, 1, 1, 1, 1]),
                    "units_proposed": array([0, 1, 2, 3, 4, 5, 6, 8])
                },
                'velocity_function': {
                    "velocity_function_id":
                    arange(3) + 1,
                    "annual_construction_schedule":
                    array(["[100]", "[50, 100]", "[50, 75, 100]"]),
                    "building_type_id":
                    array([1, 1, 1]),
                    "minimum_units":
                    array([0, 3, 6]),
                    "maximum_units":
                    array([2, 5, 10])
                }
            })

        should_be = array([
            '[100]', '[100]', '[100]', '[50, 100]', '[50, 100]', '[50, 100]',
            '[50, 75, 100]', '[50, 75, 100]'
        ])
        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
Exemple #11
0
    def test_my_inputs(self):
        tester = VariableTester(__file__,
                                package_order=['urbansim'],
                                test_data={
                                    'gridcell': {
                                        'grid_id':
                                        array([1, 2, 3, 4]),
                                        'relative_x':
                                        array([1, 2, 1, 2]),
                                        'relative_y':
                                        array([1, 1, 2, 2]),
                                        'number_of_minority_households':
                                        array([100, 500, 1000, 1500]),
                                    },
                                    'urbansim_constant': {
                                        "walking_distance_circle_radius":
                                        array([150]),
                                        'cell_size':
                                        array([150]),
                                    }
                                })

        should_be = array([1800, 3100, 4600, 6000])
        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
Exemple #12
0
    def test_full_tree(self):
        tester = VariableTester(
            __file__,
            package_order=['urbansim'],
            test_data={
                'gridcell':{
                    'grid_id': array([1, 2, 3, 4]),
                    'relative_x': array([1,2,1,2]),
                    'relative_y': array([1,1,2,2]),
                    'total_improvement_value': array([100, 500, 1000, 1500]),
                    },
                'household':{
                    'household_id': array([1, 2, 3, 4, 5, 6]),
                    'grid_id': array([1, 2, 3, 4, 2, 2]),
                    'income': array([1000, 5000, 3000, 10000, 1000, 8000]),
                    },
                'urbansim_constant':{
                    "walking_distance_circle_radius": array([150]),
                    'cell_size': array([150]),
                    "low_income_fraction": array([.25]),
                    'mid_income_fraction': array([.3]),
                }
            }
        )

        should_be = array([1,1,0,0])
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #13
0
    def test_my_inputs_with_no_mask(self):
        tester = VariableTester(__file__,
                                package_order=['urbansim'],
                                test_data={
                                    'gridcell': {
                                        'grid_id':
                                        array([1, 2, 3, 4]),
                                        'relative_x':
                                        array([1, 2, 1, 2]),
                                        'relative_y':
                                        array([1, 1, 2, 2]),
                                        'year_built':
                                        array([1995, 1801, 2006, 2009])
                                    },
                                    'urbansim_constant': {
                                        'absolute_min_year':
                                        array([1800]),
                                        "walking_distance_circle_radius":
                                        array([150]),
                                        'cell_size':
                                        array([150]),
                                    }
                                })

        SimulationState().set_current_time(2009)
        should_be = array([14, 208, 3, 0])
        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
    def test_my_inputs(self):
        tester = VariableTester(__file__,
                                package_order=['urbansim'],
                                test_data={
                                    'gridcell': {
                                        'grid_id':
                                        array([1, 2, 3, 4]),
                                        'relative_x':
                                        array([1, 2, 1, 2]),
                                        'relative_y':
                                        array([1, 1, 2, 2]),
                                        'n_recent_transitions_to_developed':
                                        array([1, 0, 1, 1]),
                                    },
                                    'urbansim_constant': {
                                        "walking_distance_circle_radius":
                                        array([150]),
                                        'cell_size':
                                        array([150]),
                                    }
                                })

        should_be = array([4, 2, 5, 4])
        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
 def test_full_tree(self):
     tester = VariableTester(
         __file__,
         package_order=['urbansim'],
         test_data={
             'gridcell':{
                 'grid_id': array([1,2,3,4]),
                 'relative_x': array([1,2,1,2]),
                 'relative_y': array([1,1,2,2]),
                 'is_developed': array([1, 0, 1, 1]),
                 },
             'household':{
                 'household_id': array([1,2,3,4,5,6]),
                 'grid_id': array([1, 2, 3, 4, 2, 2]),
                 'income': array([1000, 5000, 3000, 10000, 1000, 8000]),
                 },
             'urbansim_constant':{
                 "low_income_fraction": array([.25]),
                 'mid_income_fraction': array([.3]),
             }
         }
     )
     
     should_be = array([0,1,0,1])
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=["psrc_parcel", "urbansim_parcel", "urbansim"],
            test_data={
                "district_commute": {
                    "commute_id": arange(1, 10),
                    "origin_district_id": array([1, 1, 1, 3, 3, 3, 4, 4, 4]),
                    "destination_district_id": array([1, 3, 4, 1, 3, 4, 1, 3, 4]),
                },
                "zone": {"zone_id": array([1, 2, 3, 4, 5, 6]), "district_id": array([1, 1, 3, 4, 4, 4])},
                "parcel": {"parcel_id": array([1, 2, 3, 4, 5, 6, 7, 8]), "zone_id": array([1, 2, 3, 3, 4, 1, 4, 4])},
                "building": {
                    "building_id": array([1, 2, 3, 4, 5, 6, 7, 8, 9]),
                    "parcel_id": array([1, 2, 2, 3, 4, 5, 7, 7, 8]),
                },
                "household": {
                    "household_id": array([1, 2, 3, 4, 5, 6, 7]),
                    "building_id": array([1, 1, 2, 3, 8, 4, 7]),
                },
                "job": {"job_id": array([1, 2, 3, 4, 5, 6]), "building_id": array([2, 8, 7, 3, 1, 2])},
                "person": {
                    "person_id": array([1, 2, 3, 4, 5, 6, 7, 8]),
                    "household_id": array([1, 1, 7, 3, 4, 4, 5, 6]),  # home_district_id: 1, 1, 4, 1, 1, 1, 4, 3
                    "job_id": array([-1, 2, -1, 3, 1, 4, -1, 5]),  # work_district_id:-1, 4,-1, 4, 1, 1,-1, 1
                },
            },
        )

        should_be = array([2, 0, 2, 1, 0, 0, 0, 0, 0])

        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #17
0
 def test_my_inputs(self):
     tester = VariableTester(
         __file__,
         package_order=['urbansim'],
         test_data={
             'gridcell':{
                 'grid_id': array([1,2,3,4]),
                 'relative_x': array([1,2,1,2]),
                 'relative_y': array([1,1,2,2]),
                 'total_residential_value': array([100, 500, 1000, 1500]),
                 'governmental_improvement_value': array([100, 500, 1000, 1500]),
                 # The four items below are 'throw-away' items to allow this Variable to test -
                 # they can be anything and not affect the outcome of this variable.
                 'commercial_improvement_value': array([0, 0, 0, 0]),
                 'industrial_improvement_value': array([0, 0, 0, 0]),
                 'residential_improvement_value': array([0, 0, 0, 0]),
                 'residential_units': array([0, 0, 0, 0]),
                 },
             'urbansim_constant':{
                 "walking_distance_circle_radius": array([150]),
                 'cell_size': array([150]),
             }
         }
     )
     
     should_be = array([1800, 3100, 4600, 6000])
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test_my_inputs(self):
        zone_id = array([2, 1, 3])
        faz_id = array([3,4, 5])

        tester = VariableTester(
            __file__,
            package_order=['urbansim'],
            test_data={
                "gridcell":{ 
                    "grid_id":array([1,2,3]),
                    "zone_id":zone_id
                    }, 
                "zone":{ 
                    "zone_id":array([1,2,3]),
                    "faz_id":faz_id
                    }, 
                "faz":{
                    "faz_id":array([1,2,3,4,5,6]),
                    "fazdistrict_id":array([1,1,1,2,2,2])
                }
            }
        )
        
        should_be = array([2,1,2])
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test_full_tree(self):
        tester = VariableTester(
            __file__,
            package_order=['urbansim'],
            test_data={
                'gridcell': {
                    'grid_id': array([1, 2, 3, 4]),
                    'relative_x': array([1, 2, 1, 2]),
                    'relative_y': array([1, 1, 2, 2]),
                    'total_improvement_value': array([100, 500, 1000, 1500]),
                },
                'household': {
                    'household_id': array([1, 2, 3, 4, 5, 6]),
                    'grid_id': array([1, 2, 3, 4, 2, 2]),
                    'income': array([1000, 5000, 3000, 10000, 1000, 8000]),
                },
                'urbansim_constant': {
                    "walking_distance_circle_radius": array([150]),
                    'cell_size': array([150]),
                    "low_income_fraction": array([.25]),
                    'mid_income_fraction': array([.3]),
                }
            })

        should_be = array([1, 1, 0, 0])
        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
    def test_my_inputs2(self):
        tester = VariableTester(
            __file__,
            package_order=['urbansim_parcel', 'urbansim'],
            test_data={
            'development_project_proposal':
            {
                "proposal_id":    array([1,  2,    3,  4, 5]),
                "start_year": array([2005, 2007, 2005, 2006, 2006])
            },
            'development_project_proposal_component':
            {
                "proposal_component_id": arange(8)+1,
                 "proposal_id":           array([3, 3, 5, 2, 5, 1, 3, 1]),
                 "component_id":          array([3, 1, 4, 2, 4, 1, 3, 4]),
                 "annual_construction_schedule": array(["[0, 50, 100]", "[100]", "[25, 50, 75, 100]", "[0, 50, 100]", "[0, 50, 100]", "[25, 50, 75, 100]", "[25, 50, 75, 100]", "[100]"])
             },
            'development_template_component':
            {
                "component_id":          array([1, 2, 3, 4]),
                "velocity_function_id":  array([2, 1, 1, 3])
             },            
        })
        SimulationState().set_current_time(2007)
        should_be = array([50, 0,  25,  0, 50, 25, 25, 0])

        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #21
0
    def test_my_inputs(self):
        zone_id = array([2, 1, 3])
        faz_id = array([3, 4, 5])

        tester = VariableTester(__file__,
                                package_order=['urbansim'],
                                test_data={
                                    "gridcell": {
                                        "grid_id": array([1, 2, 3]),
                                        "zone_id": zone_id
                                    },
                                    "zone": {
                                        "zone_id": array([1, 2, 3]),
                                        "faz_id": faz_id
                                    },
                                    "faz": {
                                        "faz_id": array([1, 2, 3, 4, 5, 6]),
                                        "fazdistrict_id":
                                        array([1, 1, 1, 2, 2, 2])
                                    }
                                })

        should_be = array([2, 1, 2])
        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
Exemple #22
0
 def test_my_inputs(self):
     tester = VariableTester(
         __file__,
         package_order=['urbansim'],
         test_data={
             'gridcell':{
                 'grid_id': array([1,2,3,4]),
                 'relative_x': array([1,2,1,2]),
                 'relative_y': array([1,1,2,2]),
                 'total_residential_value': array([100, 500, 1000, 1500]),
                 'governmental_improvement_value': array([100, 500, 1000, 1500]),
                 # The four items below are 'throw-away' items to allow this Variable to test -
                 # they can be anything and not affect the outcome of this variable.
                 'commercial_improvement_value': array([0, 0, 0, 0]),
                 'industrial_improvement_value': array([0, 0, 0, 0]),
                 'residential_improvement_value': array([0, 0, 0, 0]),
                 'residential_units': array([0, 0, 0, 0]),
                 },
             'urbansim_constant':{
                 "walking_distance_circle_radius": array([150]),
                 'cell_size': array([150]),
             }
         }
     )
     
     should_be = array([1800, 3100, 4600, 6000])
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
 def test(self):
     tester = VariableTester(__file__,
                             package_order=['opus_core'],
                             test_data={
                                 'test2': {
                                     'id': array([1, 2]),
                                     'attr1': array([1, 2]),
                                 },
                             })
     should_be = array([1 * 4, 2 * 4])
     tester.test_is_equal_for_variable_defined_by_this_module(
         self, should_be)
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=["urbansim"],
            test_data={
                "gridcell": {"grid_id": array([1, 2, 3]), "percent_floodplain": array([25, 50, 75])},
                "urbansim_constant": {"percent_coverage_threshold": array([50])},
            },
        )

        should_be = array([False, False, True])
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
 def test(self):
     tester = VariableTester(
         __file__,
         package_order=['opus_core'],
         test_data={
             'test2':{
                 'id': array([1, 2]),
                 'attr1': array([1, 2]),
             },
         }
     )
     should_be = array([1*4, 2*4])
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=["urbansim"],
            test_data={
                "gridcell": {"grid_id": array([1, 2, 3]), "average_income": array([150, 50, 250])},
                "household": {"household_id": array([1, 2, 3, 4]), "income": array([50, 100, 200, 300])},
                "urbansim_constant": {"low_income_fraction": array([0.25]), "mid_income_fraction": array([0.25])},
            },
        )

        should_be = array([0, 0, 1])
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test_my_inputs(self):
        tester = VariableTester(__file__,
                                package_order=['urbansim'],
                                test_data={
                                    "gridcell": {
                                        "grid_id": array([1, 2, 3]),
                                        "residential_units": array([1, 0, 5])
                                    }
                                })

        should_be = array([True, False, True])
        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
Exemple #28
0
 def test_my_inputs(self):
     tester = VariableTester(
         __file__,
         package_order=['urbansim'],
         test_data={
             "gridcell":{ 
                 "grid_id":array([1, 2, 3]),
                 "vacant_land_sqft_within_walking_distance":array([1, 0, 5])
             }
         }
     )
     
     should_be = array([True, False, True])
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #29
0
 def test_my_inputs(self):
     tester = VariableTester(
         __file__,
         package_order=['urbansim'],
         test_data={
             "gridcell":{ 
                 "grid_id":array([1, 2, 3]),
                 "residential_units":array([1, 0, 5])
             }
         } 
     )
     
     should_be = array([True, False, True])
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
 def test_my_inputs(self):
     tester = VariableTester(
         __file__,
         package_order=['urbansim'],
         test_data={
             "gridcell":{ 
                 "grid_id":array([1, 2, 3]),
                 "vacant_land_sqft_within_walking_distance":array([1, 0, 5])
             }
         }
     )
     
     should_be = array([True, False, True])
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test(self):
        tester = VariableTester(__file__,
                                package_order=['opus_core'],
                                test_data={
                                    'test_location': {
                                        'id': array([1, 2]),
                                        'cost': array([25, 40]),
                                    },
                                })

        should_be = array([75, 120])

        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
 def test(self):
     tester = VariableTester(
         __file__,
         package_order=['opus_core'],
         test_data={
             'test_agent':{
                 'id': array([1, 2]),
                 'income': array([10, 20]),
                 },
         }
     )
     
     should_be = array([10*2, 20*2])
     
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test(self):
        tester = VariableTester(
            os.path.join('anything_you_want_here', 'opus_core', 'test', 'attr1_times_2.py'),
            package_order=['opus_core'],
            test_data={
                'test':{
                    'id': array([1, 2]),
                    'attr1': array([1, 2]),
                    },
            }
        )

        should_be = array([1*2, 2*2])

        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test(self):
        tester = VariableTester(
            os.path.join('anything_you_want_here', 'opus_core', 'test', 'attr1_times_2.py'),
            package_order=['opus_core'],
            test_data={
                'test':{
                    'id': array([1, 2]),
                    'attr1': array([1, 2]),
                    },
            }
        )

        should_be = array([1*2, 2*2])

        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #35
0
    def test_my_inputs(self):
        travel_time_to_cbd = array([0.0, 30.0, 60.0])
        locations_in_zoneid = array([1, 1, 3, 2, 2])

        tester = VariableTester(
            __file__,
            package_order=["urbansim"],
            test_data={
                "zone": {"zone_id": array([1, 2, 3]), "travel_time_to_cbd": travel_time_to_cbd},
                "gridcell": {"grid_id": array([1, 2, 3, 4, 5]), "zone_id": locations_in_zoneid},
            },
        )

        should_be = array([0.0, 0.0, 60.0, 30.0, 30.0])
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #36
0
    def test_my_inputs(self):
        nob = array([1, 1, 0, 0])

        tester = VariableTester(__file__,
                                package_order=['urbansim'],
                                test_data={
                                    "gridcell": {
                                        "grid_id": array([1, 2, 3, 4]),
                                        "number_of_buildings": nob,
                                    }
                                })

        should_be = array([True, True, False, False])
        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
Exemple #37
0
 def test_my_inputs(self):
     tester = VariableTester(
         __file__,
         package_order=['urbansim'],
         test_data={
             "gridcell":{
                 "grid_id":array([1, 2, 3, 4]),             
                 "avg_val_per_unit_vacant_land":array([5, 17, 5, 0]), 
                 "vacant_land_sqft":array([2, 1, 0, 10])        
             }
         }
     )
     
     should_be = array([10, 17, 0, 0])
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #38
0
 def test_my_inputs(self):
     tester = VariableTester(
     __file__,
     package_order=['parcel','urbansim'],
     test_data={
         'zone': {
             "zone_id":array([1,3,4,7,15]),
             "travel_time_hbw_am_drive_alone_to_3": array([2, 1, 5, 20, 10]),
             "travel_time_hbw_am_drive_alone_to_15": array([1, 6, 10, 3, 0]),
             "bellevue_cbd": array([0, 1, 0, 0, 1])
         }
         }
     )
     should_be = array([1,0,5,3,0])
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
 def test(self):
     tester = VariableTester(
         __file__,
         package_order=['opus_core'],
         test_data={
             'test_location':{
                 'id': array([1, 2]),
                 'cost': array([25, 40]),
                 },
         }
     )
     
     should_be = array([75, 120])
     
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=["urbansim_parcel", "urbansim"],
            test_data={
                "development_template": {
                    "template_id": array([1, 2, 3, 4]),
                    "density_type": array(["units_per_acre", "far", "units_per_acre", "far"]),
                }
            },
        )

        should_be = array([False, True, False, True])

        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test_my_inputs(self):
        wtt_tw = array([0.0, 0.250, 1])
        locations_in_zoneid = array([1, 1, 3, 2, 2])

        tester = VariableTester(
            __file__,
            package_order=["urbansim"],
            test_data={
                "zone": {"zone_id": array([1, 2, 3]), "trip_weighted_travel_time_for_transit_walk": wtt_tw},
                "gridcell": {"grid_id": array([1, 2, 3, 4, 5]), "zone_id": locations_in_zoneid},
            },
        )

        should_be = array([0.0, 0.0, 1, 0.250, 0.250])
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #42
0
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=['psrc_parcel','urbansim_parcel', 'urbansim'],
            test_data={
                'district_commute':
                    { 'commute_id':arange(1, 10),
                      'origin_district_id':     array([1, 1, 1, 3, 3, 3, 4, 4, 4]),
                      'destination_district_id':array([1, 3, 4, 1, 3, 4, 1, 3, 4])
                     },
                'zone':
                    {
                     'zone_id':     array([1, 2, 3, 4, 5, 6]),
                     'district_id': array([1, 1, 3, 4, 4, 4])
                     },
                'parcel':
                    {
                     'parcel_id': array([1, 2, 3, 4, 5, 6, 7, 8]),
                     'zone_id':   array([1, 2, 3, 3, 4, 1, 4, 4])
                     },
                'building':
                    {
                     'building_id': array([1, 2, 3, 4, 5, 6, 7, 8, 9]),
                     'parcel_id':   array([1, 2, 2, 3, 4, 5, 7, 7, 8])
                     },
                'household':
                    {
                     'household_id': array([1, 2, 3, 4, 5, 6, 7]),
                     'building_id':  array([1, 1, 2, 3, 8, 4, 7])
                     },
                'school':
                    {
                     'school_id': array([1, 2, 3, 4, 5, 6]),
                     'parcel_id': array([2, 8, 7, 3, 1, 2])
                     },
                'person':
                    {
                     'person_id':    array([1, 2, 3, 4, 5, 6, 7, 8]),
                     'household_id': array([1, 1, 7, 3, 4, 4, 5, 6]), #home_district_id:   1, 1, 4, 1, 1, 1, 4, 3 
                     'school_id':    array([-1,2,-1, 3, 1, 4,-1, 5])  #school_district_id:-1, 4,-1, 4, 1, 3,-1, 1 
                     },
                     
                    }
        )
        
        should_be = array([1, 1, 2, 1, 0, 0, 0, 0, 0])

        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #43
0
    def test_my_inputs(self):
        age = array([20, 2, 0, 3, 1, 30])
        grid_id = array([1, 1, 2, 3, 1, 2])

        tester = VariableTester(
            __file__,
            package_order=["urbansim"],
            test_data={
                "gridcell": {"grid_id": array([1, 2, 3])},
                "building": {"building_id": array([1, 2, 3, 4, 5, 6]), "grid_id": grid_id, "building_age": age},
                "urbansim_constant": {"recent_years": array([3])},
            },
        )

        should_be = array([2, 1, 1])
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #44
0
    def test_my_inputs(self):
        nob =     array([1,1,0,0])

        tester = VariableTester(
            __file__,
            package_order=['urbansim'],
            test_data={
                "gridcell":{ 
                    "grid_id":array([1,2,3,4]),
                    "number_of_buildings": nob, 
                }
            }
        )
        
        should_be = array([True, True, False, False])
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #45
0
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=['urbansim_parcel','urbansim'],
            test_data={            
            'development_template':
            {
                'template_id': array([1,2,3,4]),
                'density_type': array(['units_per_acre', 'far', 'units_per_acre', 'far']),
            },

            }
        )
        
        should_be = array([False, True, False, True])
        
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #46
0
    def test_my_inputs(self):
        tester = VariableTester(__file__,
                                package_order=['urbansim'],
                                test_data={
                                    'gridcell': {
                                        'grid_id': array([1, 2, 3]),
                                        'percent_slope': array([25, 50, 75]),
                                    },
                                    'urbansim_constant': {
                                        "percent_coverage_threshold":
                                        array([50]),
                                    }
                                })

        should_be = array([False, False, True])
        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
Exemple #47
0
 def test(self):
     tester = VariableTester(
         __file__,
         package_order=['urbansim'],
         test_data={
             "gridcell":{ 
                 "grid_id":array([1, 2, 3, 4])
                 }, 
             "household":{ 
                 "household_id":array([1, 2, 3, 4, 5, 6]),
                 "grid_id":array([1, 2, 3, 4, 2, 2])
             }
         } 
     )
     
     should_be = array([1,3,1,1])
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #48
0
 def test_my_inputs(self):
     tester = VariableTester(
         __file__,
         package_order=['urbansim'],
         test_data={
             'gridcell':{
                 'grid_id': array([1,2,3]),
                 'percent_slope': array([25, 50, 75]),
                 },
             'urbansim_constant':{
                 "percent_coverage_threshold": array([50]),
             }
         }
     )
     
     should_be = array([False, False, True])
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=["urbansim"],
            test_data={
                "gridcell": {
                    "grid_id": array([1, 2, 3, 4]),
                    "relative_x": array([1, 2, 1, 2]),
                    "relative_y": array([1, 1, 2, 2]),
                    "number_of_high_income_households": array([100, 500, 1000, 1500]),
                },
                "urbansim_constant": {"walking_distance_circle_radius": array([150]), "cell_size": array([150])},
            },
        )

        should_be = array([1800, 3100, 4600, 6000])
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test_my_inputs(self):
        tester = VariableTester(__file__,
                                package_order=['urbansim'],
                                test_data={
                                    "gridcell": {
                                        "grid_id":
                                        array([1, 2, 3, 4]),
                                        "avg_val_per_unit_vacant_land":
                                        array([5, 17, 5, 0]),
                                        "vacant_land_sqft":
                                        array([2, 1, 0, 10])
                                    }
                                })

        should_be = array([10, 17, 0, 0])
        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=['psrc_parcel', 'urbansim_parcel', 'urbansim'],
            test_data={
                'district_commute': {
                    'commute_id': arange(1, 10),
                    'origin_district_id': array([1, 1, 1, 3, 3, 3, 4, 4, 4]),
                    'destination_district_id':
                    array([1, 3, 4, 1, 3, 4, 1, 3, 4])
                },
                'zone': {
                    'zone_id': array([1, 2, 3, 4, 5, 6]),
                    'district_id': array([1, 1, 3, 4, 4, 4])
                },
                'parcel': {
                    'parcel_id': array([1, 2, 3, 4, 5, 6, 7, 8]),
                    'zone_id': array([1, 2, 3, 3, 4, 1, 4, 4])
                },
                'building': {
                    'building_id': array([1, 2, 3, 4, 5, 6, 7, 8, 9]),
                    'parcel_id': array([1, 2, 2, 3, 4, 5, 7, 7, 8])
                },
                'household': {
                    'household_id': array([1, 2, 3, 4, 5, 6, 7]),
                    'building_id': array([1, 1, 2, 3, 8, 4, 7])
                },
                'job': {
                    'job_id': array([1, 2, 3, 4, 5, 6]),
                    'building_id': array([2, 8, 7, 3, 1, 2])
                },
                'person': {
                    'person_id': array([1, 2, 3, 4, 5, 6, 7, 8]),
                    'household_id':
                    array([1, 1, 7, 3, 4, 4, 5,
                           6]),  #home_district_id: 1, 1, 4, 1, 1, 1, 4, 3 
                    'job_id':
                    array([-1, 2, -1, 3, 1, 4, -1,
                           5])  #work_district_id:-1, 4,-1, 4, 1, 1,-1, 1 
                },
            })

        should_be = array([2, 0, 2, 1, 0, 0, 0, 0, 0])

        tester.test_is_equal_for_variable_defined_by_this_module(
            self, should_be)
Exemple #52
0
 def test(self):
     tester = VariableTester(
         __file__,
         package_order=['urbansim'],
         test_data={
             "gridcell":{ 
                 "grid_id":array([1, 2, 3, 4])
                 }, 
             "household":{ 
                 "household_id":array([1, 2, 3, 4, 5, 6]),
                 "grid_id":array([1, 2, 3, 4, 2, 2])
             }
         } 
     )
     
     should_be = array([1,3,1,1])
     tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=['urbansim'],
            test_data={
                "gridcell": { 
                    "grid_id": array([1, 2, 3])
                    },
                "building": {
                    "building_id": array([1, 2, 3, 4, 5, 6, 7]),
                    "grid_id":     array([1, 1, 2, 3, 1, 2, 1]),
                }
            }
        )

        should_be = array([4, 2, 1]) 
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #54
0
    def test_my_inputs(self):
        tester = VariableTester(
            __file__,
            package_order=['urbansim_parcel','urbansim'],
            test_data={            
            'development_template':
            {
                'template_id': array([1,2,3,4]),
                'density_type': array(['units_per_acre', 'far', 'units_per_acre', 'far']),
            },

            }
        )
        
        should_be = array([False, True, False, True])
        
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
    def test_my_inputs(self):
        residential_improvement_value = array([200.5, 5, 200])
        residential_land_value = array([199, 205, 6])

        tester = VariableTester(
            __file__,
            package_order=['urbansim'],
            test_data={
                "gridcell":{ 
                    "grid_id":array([1,2,3]),
                    "residential_improvement_value":residential_improvement_value, 
                    "residential_land_value":residential_land_value
                }
            }
        )
        
        should_be = array([399.5, 210, 206])
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)
Exemple #56
0
    def test_my_inputs(self):
        total_nonresidential_value = array([200, 500, 1000])
        total_residential_value = array([100, 400, 900])

        tester = VariableTester(
            __file__,
            package_order=['urbansim'],
            test_data={
                "gridcell":{ 
                    "grid_id":array([1,2,3]),
                    "total_nonresidential_value":total_nonresidential_value, 
                    "total_residential_value":total_residential_value
                }
            }
        )
        
        should_be = array([300, 900, 1900])
        tester.test_is_equal_for_variable_defined_by_this_module(self, should_be)