dwind.model#
Provides the primary Agent and Model classes for loading, preparing, and analyzing
parcel data.
Classes
|
Reponsible for reading in the agent data and storing it for the |
|
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
Modelclass.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.ResourcePotentialfor more information.
- prepare()[source]#
Prepares the agent data so that it has the necessary columns required for modeling.
Steps:
Extract state_fips from the fips_code column.
- If census_tract_id is missing, load and merge the 2020 census tracts based on the
pgid column.
Convert the 2012 rev ID to the 2018 rev id in rev_index_wind.
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_