dwind.model#

Provides the primary Agent and Model classes for loading, preparing, and analyzing parcel data.

Classes

Agents(agent_file[, sector, model_config, ...])

Reponsible for reading in the agent data and storing it for the Model class.

Model(agents, location, sector, scenario, ...)

Primary dwind model that is responsible for gathering and connecting the various data points by parcel.

class dwind.model.Agents(agent_file, sector=None, model_config=None, *, resource_year=2018)[source]#

Reponsible for reading in the agent data and storing it for the Model class.

Agents are the modified parcels that have been truncated to the largest circle able to be contained in the parcel, and contain all of the relevant tax lot and geographic variables that would be found in a parcel.

classmethod load_agents(agent_file)[source]#

Load the agent data without making any additional modifications.

Parameters:

agent_file (str | Path) – The full file path of the agent parquet, pickle, or CSV data.

Returns:

The agent data.

Return type:

pd.DataFrame

classmethod load_and_prepare_agents(agent_file, sector, model_config, *, save_results=False, file_name=None)[source]#

Load and prepare the agent files to run through Model.

Parameters:
  • agent_file (str | Path) – The full file path of the agent parquet, CSV, or pickle data.

  • sector (str) – One of “fom” (front-of-meter) or “btm” (behind-the-meter).

  • model_config (str | Path, optional) – Full file path to the overall model configuration TOML file containing SQL connections, data locations, and etc.

  • save_results (bool, optional) – True to save any updates to the data. Defaults to False.

  • file_name (str | Path | None, optional) – The file path and name for where to save the prepared data, if not overwriting the existing agent data. Defaults to None.

Returns:

The prepared agent data.

Return type:

pd.DataFrame

merge_census_data()[source]#

Merges the census tract identifies based on the agent “gid” and census “pgid” identifier columns.

merge_generation()[source]#

Load and merge the resource potential data for the 2018 reV basis only. See dwind.resource.ResourcePotential for more information.

prepare()[source]#

Prepares the agent data so that it has the necessary columns required for modeling.

Steps:

  1. Extract state_fips from the fips_code column.

  2. If census_tract_id is missing, load and merge the 2020 census tracts based on the

    pgid column.

  3. Convert the 2012 rev ID to the 2018 rev id in rev_index_wind.

  4. Attach the universal resource generation data.

save_agents(file_name=None)[source]#

Save the prepared agent data to the path provided in file_name.

Parameters:

file_name (str | Path, optional) – Full file path and name for where to save the agent data. Must end in a valid pickle, parquet, or csv extension. Defaults to None.

Raises:

ValueError – _description_

update_rev_id()[source]#

Update 2012 rev index to 2018 index.

class dwind.model.Model(agents, location, sector, scenario, year, out_path, model_config, incentive_scenario='standard', chunk_ix=None)[source]#

Primary dwind model that is responsible for gathering and connecting the various data points by parcel.

prepare_agents()[source]#

Prepare the tech- and sector-specific agent data.

run()[source]#

Runs the whole model.

run_valuation()[source]#

Runs the valuation model to create the PySAM financial results.