Transport-for-the-North / NorMITs-Demand

GNU General Public License v3.0
5 stars 10 forks source link

Create 24hr OD for HB #147

Closed github-actions[bot] closed 4 years ago

github-actions[bot] commented 4 years ago

Create 24hr OD for HB

https://github.com/Transport-for-the-North/NorMITs-Demand/blob/7af08581086a0c9b8867d185555ec7281c217ef8/external_forecast_system.py#L1221

                echo=echo)
            print('HB OD matrices compiled!\n')
            # TODO: Create 24hr OD for HB

    def run_nhb(self,
                base_year: int = consts.BASE_YEAR,
                future_years: List[int] = consts.NHB_FUTURE_YEARS,
                modes_needed: List[int] = consts.MODES_NEEDED,
                hb_purposes_needed: List[int] = consts.PURPOSES_NEEDED,
                hb_soc_needed: List[int] = consts.SOC_NEEDED,
                hb_ns_needed: List[int] = consts.NS_NEEDED,
                hb_ca_needed: List[int] = consts.CA_NEEDED,
                nhb_purposes_needed: List[int] = consts.NHB_PURPOSES_NEEDED,
                output_location: str = 'E:/',
                iter_num: int = 0,
                overwrite_nhb_productions: bool = True,
                overwrite_nhb_od: bool = True,
                overwrite_nhb_tp_od: bool = True,
                ):
        """
        Generates NHB distributions based from the time-period split
        HB distributions

        Performs the following actions:
            - Generates NHB productions using NHB factors and HB distributions
            - Furnesses NHB productions Synthesiser distributions as a seed

        Parameters
        ----------
        base_year:
            The base year used to produce the HB distributions.

        future_years:
            The future years used to produce NHB distributions for.

        modes_needed:
            The mode to generate a NHB distributions for.

        hb_purposes_needed:
            The home based purposes to use when generating NHB productions.

        hb_soc_needed:
            The home based soc_ids to use when generating NHB productions.

        hb_ns_needed:
            The home based ns_ids to use when generating NHB productions.

        hb_ca_needed:
            The car availability ids to use when generating NHB productions.

        nhb_purposes_needed:
            Which NHB purposes to generate NHb distributions for.

        output_location:
            The directory to create the new output directory in - a dir named
            self._out_dir (NorMITs Demand) should exist here. Usually
            a drive name e.g. Y:/

        iter_num:
            The number of the iteration being run.

        # TODO: Update docs once correct functionality exists
        overwrite_nhb_productions:
            Whether to generate nhb productions or not.

        overwrite_nhb_od
            Whether to generate nhb OD matrices or not.

        overwrite_nhb_tp_od
            Whether to generate nhb tp split OD matrices or not.

        Returns
        -------
        None
        """
        # Init
        all_years = [str(x) for x in [base_year] + future_years]
        iter_name = 'iter' + str(iter_num)
        model_name = du.get_model_name(modes_needed[0])

        if iter_num == 0:
            Warning("iter_num is set to 0. This is should only be the case"
                    "during testing.")

        if len(modes_needed) > 1:
            raise ValueError("Was given more than one mode. EFS cannot run "
                             "using more than one mode at a time due to "
                             "different zoning systems for NoHAM and NoRMS "
                             "etc.")

        # Generate paths
        imports, exports = self.generate_output_paths(
            output_location=output_location,
            model_name=model_name,
            iter_name=iter_name
        )

        # TODO: Add time print outs
        # TODO: Change import paths to accept specific dir

        # TODO: Check if nhb productions exist first
        if overwrite_nhb_productions:

b6c14662b71b3380fe9af75dfa58084071ea09ed

github-actions[bot] commented 4 years ago

Closed in ad29aad1617804f8c43d8fd46b44777153fd1c74