A Python package for reformatting and accessing demand, solar generation and wind generation time series data used by the Australian Energy Market Operator (AEMO) in their Integrated System Plan (ISP) modelling study.
Important
Currently, isp-trace-parser only supports trace data in the format of the 2024 ISP.
Warning
Version 2.0 breaking change: Version 2.0 of isp-trace-parser stores and reads parsed data in a new hive-partitioned storage format. Data originally parsed with version 1.x is not compatible with version 2.0.
While the original API itself remains largely the same, upgrading from version 1.x requires either re-parsing your raw AEMO trace data or downloading pre-processed data.
- Install
- How the package works
- Accessing raw trace data
- Key terminology
- Examples
- Contributing
- License
pip install isp-trace-parser-
Parse raw AEMO trace data using the functions
parse_wind_traces,parse_solar_traces, andparse_demand_traces.- These functions reformat and restructure the data to a specified directory.
- Reformatting puts the data in a standard time series format (i.e. with a
datetimecolumn andvaluecolumn). - The data is restructured into Parquet files, which significantly improves the speed at which data can be read from disk.
- Reformatting puts the data in a standard time series format (i.e. with a
- To access the full documentation for these functions, you can run
helpin the Python console, e.g.help(parse_wind_traces).
- These functions reformat and restructure the data to a specified directory.
-
Query the parsed data using the naming conventions for generators, renewable energy zones (REZs), and subregions established in the AEMO Inputs and Assumptions workbook (see
isp-workbook-parser) using theget_datafunctions- Refer to the Querying parsed trace data example.
- To access the full documentation for these functions, you can run
helpin the Python console, e.g.help(get_data.solar_project_trace_single_reference_year).
Currently, AEMO trace data needs to be downloaded from the AEMO website and unzipped manually before the trace parser can be used.
The zipped data is also archived in publicly accessible object storage (data.openisp.au). This can be downloaded by:
from isp_trace_parser.remote import fetch_trace_data
fetch_trace_data("full", dataset_src="isp_2024", save_directory="data/archive", data_format="archive")This will download all the archived zip files into the provided directory with the following structure:
archive/
└── isp_2024/
├── solar/
├── wind/
└── demand/Trace data that has been processed into the hive-partitioned format is also available for download from the object store. Both "full" and "example" datasets are available (the example dataset contains only data for the 2018 reference year):
from isp_trace_parser.remote import fetch_trace_data
# Download example dataset (2018 reference year only)
fetch_trace_data("example", dataset_src="isp_2024", save_directory="data/trace_data", data_format="processed")This will download the processed parquet files with the following structure:
trace_data/
├── project/
│ └── reference_year=<year>/
├── zone/
│ └── reference_year=<year>/
└── demand/
└── scenario=<scenario_name>/
└── reference_year=<year>/- Project: Traces for a specific solar/wind project
- Zone: Traces for a zone, e.g. a renewable energy zone
- Reference year: A historical weather year that is used to produce the generation trace.
- Modelled years are mapped to reference years, e.g. generation data for one or multiple years can be mapped to a single reference year, or generation data for each year can be mapped to different reference years (refer to the Querying parsed trace data example).
- Resource type : This is used to categorise types of resource data:
- Solar:
- FFP: fixed flat plate
- SAT: single-axis tracking.
- CST: concentrated solar thermal
- Wind:
- WH: onshore wind (high)
- WL: onshore wind (low)
- WFX: offshore wind (fixed)
- WFL: offshore wind (floating)
- WIND: (existing project)
- Solar:
- Reference year: A historical weather year that is used to produce the demand trace.
- Modelled years are mapped to reference years, e.g. demand data for one or multiple years can be mapped to a single reference year, or demand data for each year can be mapped to different reference years (refer to the Querying parsed trace data example).
- Subregion: ISP subregion (refer to the ISP methodology)
- Scenario: ISP scenario (refer to the ISP methodology)
- POE: Probability of exceedance (refer to AEMO Demand Terms documentation). Generally either POE10 or POE50.
- Demand type:
OPSO_MODELLING,OPSO_MODELLING_PVLITEorPV_TOT. Refer to this ESOO document for a description of each.
If AEMO trace data is downloaded onto a local machine, it can be reformatted using isp_trace_parser.
To perform the reformatting and restructuring, the solar, wind and demand data should each be stored in separate directories (though no exact directory structure within the solar, wind and demand subdirectories needs to be followed).
The following code can then be used to parse out the project, zone or demand data, by making use of appropriate filters.
from isp_trace_parser import (
parse_solar_traces,
SolarMetadataFilter,
parse_wind_traces,
WindMetadataFilter,
parse_demand_traces,
DemandMetadataFilter
)
# Note: to not filter on a component of the metadata it can be excluded from the filter definition.
filters = SolarMetadataFilter(file_type=["project"])
parse_solar_traces(
input_directory='<path/to/aemo/solar/traces>',
parsed_directory='<path/to/store/project>',
filters = filters,
)
filters = WindMetadataFilter(file_type=["project"])
parse_wind_traces(
input_directory='<path/to/aemo/wind/traces>',
parsed_directory='<path/to/store/project>',
filters = filters,
)
filters = SolarMetadataFilter(file_type=["zone"])
parse_solar_traces(
input_directory='<path/to/aemo/solar/traces>',
parsed_directory='<path/to/store/zone>',
filters = filters,
)
filters = WindMetadataFilter(file_type=["zone"])
parse_wind_traces(
input_directory='<path/to/aemo/wind/traces>',
parsed_directory='<path/to/store/zone>',
filters = filters,
)
parse_demand_traces(
input_directory='<path/to/aemo/demand/traces>',
parsed_directory='<path/to/store/demand>',
)The following code illustrates how the parsed parquet files can be consolidated and optimised with optimise_parquet.py
Note
There may be an issue with this step on some architectures (see issue #23).
from isp_trace_parser import optimise_parquet
# For optimising `zone` and `project`, suggest partitioning on reference year
optimise_parquet.partition_traces_by_columns(input_directory="<path/to/store/zone|project>",
output_directory="<path/to/store/optimised_zone|optimised_project>",
partition_cols=["reference_year"])
# For optimising `demand`, suggest partitioning on scenario and reference year
optimise_parquet.partition_traces_by_columns(input_directory="<path/to/store/demand>",
output_directory="<path/to/store/optimised_demand>",
partition_cols=["scenario", "reference_year"])Often modelling or analysis will require a set of traces. For example, all the existing solar generators traces, all the wind REZ traces, or all the subregion demand traces. To query a set of traces the names of generators, REZ IDs, or subregion IDs can be retrieved from the IASR workbook using the isp-workbook-parser. Using isp-workbook-parser the workbook data can be exported to CSVs, and then required names, REZ IDs, or subregion IDs extracted, as shown below:
Wind and solar project traces
from pathlib import Path
import pandas as pd
from isp_trace_parser import get_data
# Define location of parsed data.
parsed_workbook_data = Path(
"/path/to/parsed/workbook/data"
)
parsed_solar_data = Path('path/to/parsed/solar/traces')
# Wind and solar generator names are stored across four IASR workbook tables
existing_generators = pd.read_csv(
parsed_workbook_data / Path("existing_generator_summary.csv")
)
committed_generators = pd.read_csv(
parsed_workbook_data / Path("committed_generator_summary.csv")
)
anticipated_generators = pd.read_csv(
parsed_workbook_data / Path("anticipated_projects_summary.csv")
)
additional_generators = pd.read_csv(
parsed_workbook_data / Path("additional_projects_summary.csv")
)
# Before combining the data tables we need to standardise the generator name column
generator_tables = [
existing_generators,
committed_generators,
anticipated_generators,
additional_generators
]
for table in generator_tables:
table.rename(
columns={table.columns.values[0]: "Generator"},
inplace=True
)
generator_data = pd.concat(generator_tables)
# The names of solar and wind projects/generators can be retrieved by filtering
solar_generators = generator_data[generator_data['Technology type'] == 'Large scale Solar PV']
solar_generator_names = list(solar_generators['Generator'])
print(solar_generator_names)
# ['Avonlie Solar Farm', 'Beryl Solar Farm', 'Bomen Solar Farm', 'Broken Hill Solar Farm' . . .
wind_generators = generator_data[generator_data['Technology type'] == 'Wind']
wind_generator_names = list(wind_generators['Generator'])
print(wind_generator_names)
# ['Bango 973 Wind Farm', 'Bango 999 Wind Farm', 'Boco Rock Wind Farm', 'Bodangora Wind Farm' . . .
# The project names can be used to retrieves a dataframe containing all project traces, which can be filtered by project name using the 'project' column"
solar_traces = get_data.get_project_single_reference_year(
start_year=2025,
end_year=2030,
reference_year=2011,
project=solar_generator_names,
directory="parsed_project_data"
)Wind area traces
from pathlib import Path
import pandas as pd
from isp_trace_parser import get_data
# Define location of parsed data.
parsed_workbook_data = Path(
"/path/to/parsed/workbook/data"
)
parsed_wind_data = Path('path/to/parsed/wind/traces')
# ISP REZ IDs and wind resource types can be retrieved from the parsed workbook data
build_limits = pd.read_csv(
parsed_workbook_data / Path("initial_build_limits.csv")
)
# If a unit has a non-nan offshore floating build limit then it will have the wind
# resource qualities WFL and WFX (wind offshore floating and wind offshore fixed).
offshore_rezs = build_limits[~build_limits["Wind generation total limits (MW)_Offshore -floating"].isna()]
print(list(offshore_rezs['REZ ID']))
# ['N10', 'N11', 'V7', 'V8', 'S10', 'T4']
# If a unit has a nonzero high build limit then it will be an on shore REZ and have the wind
# resource qualities WH and WM (wind high and wind medium).
onshore_rezs = build_limits[build_limits["Wind generation total limits (MW)_High"] > 0.1]
print(list(onshore_rezs['REZ ID']))
# ['Q1', 'Q2', 'Q3', 'Q4', 'Q5', 'Q6', . . .
# These sets of onshore and offshore REZ IDs can the be used to retrieve a dataframes containing all relevant traces, which can be filtered by REZ name using the 'zone' column"
wind_offshore_rez_traces = get_data.get_zone_single_reference_year(
start_year=2025,
end_year=2026,
reference_year=2011,
zone=list(offshore_rezs['REZ ID']),
resource_type="WFL",
directory="parsed_zone_data"
)
wind_onshore_rez_traces = get_data.get_zone_single_reference_year(
start_year=2025,
end_year=2026,
reference_year=2011,
zone=list(onshore_rezs['REZ ID']),
resource_type="WH",
directory="parsed_zone_data"
)Solar area traces
from pathlib import Path
import pandas as pd
from isp_trace_parser import get_data
# Define location of parsed data.
parsed_workbook_data = Path(
"/path/to/parsed/workbook/data"
)
parsed_solar_data = Path('path/to/parsed/wind/traces')
# ISP REZ IDs and types can be retrieved from the parsed workbook data
build_limits = pd.read_csv(
parsed_workbook_data / Path("initial_build_limits.csv")
)
# If a unit has a nonzero high build limit then it will be an onshore REZ and have the
# solar traces for SAT (single axis tracking) and CST (concentrating solar thermal).
onshore_solar_rezs = build_limits[build_limits["Solar PV plus Solar thermal Limits (MW)_Solar"] > 0.1]
print(list(onshore_solar_rezs['REZ ID']))
# ['Q1', 'Q2', 'Q3', 'Q4', 'Q5', 'Q6', . . .
# The set of REZ IDs can be used to retrieves a dataframe containing all REZ traces, which can be filtered by REZ name using the 'zone' column"
single_axis_tracking_traces = get_data.get_zone_single_reference_year(
start_year=2025,
end_year=2026,
reference_year=2011,
zone=onshore_solar_rezs['REZ ID'],
resource_type="SAT",
directory="parsed_zone_data"
)Demand subregion traces
from pathlib import Path
import pandas as pd
from isp_trace_parser import get_data
# Define location of parsed data.
parsed_workbook_data = Path(
"/path/to/parsed/workbook/data"
)
parsed_demand_data = Path('path/to/parsed/demand/traces')
# ISP Subregion ID can be retrieved from renewable energy zones table
rez_definitions = pd.read_csv(
parsed_workbook_data / Path("renewable_energy_zones.csv")
)
subregions = list(set(rez_definitions["ISP Sub-region"]))
print(subregions)
# ['CSA', 'SESA', 'CQ', 'NQ', 'NNSW', 'CNSW', 'SNSW', 'SNW', 'TAS', 'VIC', 'SQ']
# "The list of subregion names retrieves a dataframe containing all subregion traces, which can be filtered or accessed by subregion name using the 'subregion' column"
demand_trace = get_demand_single_reference_year(
start_year=2025,
end_year=2026,
reference_year=2011,
scenario="Step Change",
subregion=subregions,
demand_type="OPSO_MODELLING",
poe="POE50",
directory="parsed_data/demand"
)Once trace data has been parsed it can also queried using legacy API functionality (based on around querying technologies, areas, rather for example).
Solar project traces from 2022 to 2024 (for a single reference year), and for 2022 and 2024 (multiple reference years)
from isp_trace_parser import get_data
solar_project_trace_single_reference_year = get_data.solar_project_single_reference_year(
start_year=2022,
end_year=2024,
reference_year=2011,
project='Adelaide Desalination Plant Solar Farm',
directory='example_project_data/'
)
solar_project_trace_many_reference_years = get_data.solar_project_multiple_reference_years(
reference_years={2022: 2011, 2024: 2012},
project='Adelaide Desalination Plant Solar Farm',
directory='example_project_data/'
)Solar area/REZ traces from 2022 to 2024 (for a single reference year), and for 2022 and 2024 (multiple reference years)
from isp_trace_parser import get_data
solar_rez_trace_single_reference_years = get_data.solar_area_single_reference_year(
start_year=2022,
end_year=2024,
reference_year=2011,
area='Q1',
technology='SAT',
directory='example_rez_data/'
)
solar_rez_trace_many_reference_years = get_data.solar_area_multiple_reference_years(
reference_years={2022: 2011, 2024: 2012},
area='Q1',
technology='SAT',
directory='example_rez_data/'
)Wind project traces from 2022 to 2024 (for a single reference year), and for 2022 and 2024 (multiple reference years)
from isp_trace_parser import get_data
wind_project_trace_single_reference_years = get_data.wind_project_single_reference_year(
start_year=2022,
end_year=2024,
reference_year=2011,
project='Bango 973 Wind Farm',
directory='parsed_project_data/'
)
wind_project_trace_many_reference_years = get_data.wind_project_multiple_reference_years(
reference_years={2022: 2011, 2024: 2012},
project='Bango 973 Wind Farm',
directory='parsed_project_data/'
)Wind area/REZ traces from 2022 to 2024 (for a single reference year), and for 2022 and 2024 (multiple reference years)
from isp_trace_parser import get_data
wind_rez_trace_single_reference_years = get_data.wind_area_single_reference_year(
start_year=2022,
end_year=2024,
reference_year=2011,
area='Q1',
resource_quality='WH',
directory='parsed_rez_data/'
)
wind_rez_trace_many_reference_years = get_data.wind_area_multiple_reference_years(
reference_years={2022: 2011, 2024: 2012},
area='Q1',
resource_quality='WH',
directory='parsed_rez_data/'
)OPSO_MODELLING POE10 traces from 2022 to 2024 (for a single reference year), and for 2024 (multiple reference years) from the "Green Energy Exports" scenario
from isp_trace_parser import get_data
demand_subregion_trace_single_reference_years = get_data.demand_single_reference_year(
start_year=2024,
end_year=2024,
reference_year=2011,
subregion='CNSW',
scenario='Green Energy Exports',
poe='POE10',
demand_type='OPSO_MODELLING',
directory='parsed_demand_data/'
)
demand_subregion_trace_many_reference_years = get_data.demand_multiple_reference_years(
reference_years={2024: 2011},
subregion='CNSW',
scenario='Green Energy Exports',
poe='POE10',
demand_type='OPSO_MODELLING',
directory='parsed_demand_data/'
)A helper function is provided to allow you to construct reference year mappings for use with the get_data multiple reference year functions.
The sequence of reference years specified is cycled from first to last and mapped to data years starting
from start_year and ending in end_year.
from isp_trace_parser import construct_reference_year_mapping
mapping = construct_reference_year_mapping(
start_year=2030,
end_year=2035,
reference_years=[2011, 2013, 2018],
)
print(mapping)
# {2030: 2011, 2031: 2013, 2032: 2018, 2033: 2011, 2034: 2013, 2035: 2018}isp-trace-parser also exposes functionality for transforming input trace data (in a Polars
DataFrame) in the AEMO format to a standard time series format (i.e. "datetime" and "value" columns). As shown
below, the data can be converted to polars from pandas before performing Dataframe trace parsing, and back to pandas
after the parsing is complete, the polars package provides functionality for converting to and from pandas.
import polars as pl
import pandas as pd
from isp_trace_parser import trace_formatter
aemo_format_data = pd.DataFrame({
'Year': [2024, 2024],
'Month': [6, 6],
'Day': [1, 2],
'01': [11.2, 15.3],
'02': [30.7, 20.4],
'48': [17.1, 18.9]
})
aemo_format_data_as_polars = pl.from_pandas(aemo_format_data)
trace_parser_format_data = trace_formatter(aemo_format_data_as_polars)
print(trace_parser_format_data.to_pandas())
# datetime value
# 0 2024-06-01 00:30:00 11.2
# 1 2024-06-01 01:00:00 30.7
# 2 2024-06-02 00:00:00 17.1
# 3 2024-06-02 00:30:00 15.3
# 4 2024-06-02 01:00:00 20.4
# 5 2024-06-03 00:00:00 18.9Interested in contributing to the source code? Check out the contributing instructions, which also includes steps to install isp-trace-parser for development.
Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
isp-trace-parser was created as a part of the OpenISP project. It is licensed under the terms of GNU GPL-3.0-or-later licences.