

# energy_community

`data.energy_community`

Module for loading and processing energy community data.

## Functions

| Name | Description |
|----|----|
| [format_fips](#nova_ec.data.energy_community.format_fips) | Format FIPS code columns to have a standard number of digits. |
| [load_and_prepare_all_ec_data](#nova_ec.data.energy_community.load_and_prepare_all_ec_data) | Load and prepare all energy community data for 2023 and 2024. |
| [load_energy_community_data](#nova_ec.data.energy_community.load_energy_community_data) | Load energy community data for a specific year. |
| [prepare_coal_closure_data](#nova_ec.data.energy_community.prepare_coal_closure_data) | Prepare coal closure data by combining shapefile with appendix data. |
| [prepare_statistical_area_data](#nova_ec.data.energy_community.prepare_statistical_area_data) | Prepare statistical area data by combining shapefile with appendix data. |
| [rename_columns](#nova_ec.data.energy_community.rename_columns) | Rename DataFrame columns according to the mapping. |

### format_fips

``` python
data.energy_community.format_fips(df, columns, digits)
```

Format FIPS code columns to have a standard number of digits.

Args: df: DataFrame containing FIPS codes columns: List of column names to format digits: Number of digits for the FIPS codes

Returns: DataFrame with formatted FIPS codes

### load_and_prepare_all_ec_data

``` python
data.energy_community.load_and_prepare_all_ec_data(
    base_path,
    config=None,
    skip_missing=True,
)
```

Load and prepare all energy community data for 2023 and 2024.

Args: base_path: Base path for data files config: Configuration dictionary skip_missing: If True, continue with available data even if some files are missing

Returns: Tuple of (CCEC_2023, CCEC_2024, FFSAEC_2023, FFSAEC_2024)

### load_energy_community_data

``` python
data.energy_community.load_energy_community_data(
    base_path,
    year,
    config=None,
    skip_missing=True,
)
```

Load energy community data for a specific year.

Args: base_path: Base path for data files year: Year for which to load data (2023 or 2024) config: Configuration dictionary (optional) skip_missing: If True, continue with empty data when files are missing

Returns: Tuple of (coal closure shapefile, statistical area shapefile, coal closure appendix, statistical area appendix)

### prepare_coal_closure_data

``` python
data.energy_community.prepare_coal_closure_data(ccec, apdx_ccec, year)
```

Prepare coal closure data by combining shapefile with appendix data.

Args: ccec: Coal closure shapefile data apdx_ccec: Coal closure appendix data year: Year of the data

Returns: Combined GeoDataFrame

### prepare_statistical_area_data

``` python
data.energy_community.prepare_statistical_area_data(ffsa, apdx_ffsa, year)
```

Prepare statistical area data by combining shapefile with appendix data.

Args: ffsa: Statistical area shapefile data apdx_ffsa: Statistical area appendix data year: Year of the data

Returns: Combined GeoDataFrame

### rename_columns

``` python
data.energy_community.rename_columns(df, column_mapping)
```

Rename DataFrame columns according to the mapping.

Args: df: DataFrame to rename columns for column_mapping: Dictionary mapping old column names to new ones

Returns: DataFrame with renamed columns
