Skip to main content

AEMO Monthly Data Archive Tool

PyPI version Continuous Integration and Deployment codecov pre-commit.ci status Code style: black

A CLI utility to find and obtain data made available through AEMO's MMS Monthly Data Archive.

Note

This package and its CLI have some overlap with NEMOSIS and NEMSEER. However:

  • NEMOSIS does not provide access to the monthly data archive, and does not allow a user to download certain tables such as bid data tables (BIDPEROFFER).
  • NEMSEER only handles PASA and pre-dispatch tables available in the monthly data archive, though it provides a lot of useful utilities for handling these tables

Installation

Recommended that you use pipx to install the CLI as it prevents dependency conflicts.

pipx install mms-monthly-cli

However, you can still install via pip if you are only using the Python package:

pip install mms-monthly-cli

Usage

You can use this package as a module (source code functions within mms_monthly.py) or as a CLI tool to:

  1. Inspect what data is available
  2. Download and unzip a table CSV for a particular period (i.e. a month within a year)

Python module

Simply import mms_monthly_cli as follows:

import mms_monthly_cli.mms_monthly as mms_monthly

This will expose the functions listed below (accessed using mms_monthly.<func_name>).

[!NOTE] The data_dir argument requires you to specify which folder within MMSDM_YYYY_MM you are interested in. Most users will be interested in tables within DATA (i.e. data_dir="DATA").

You can also access PREDISP_ALL_DATA (pre-dispatch data) and P5MIN_ALL_DATA (5-minute pre-dispatch data). Data tables in the PREDISP_ALL_DATA folders contain all forecasts for an interval of interest, whereas PREDISPATCH data tables in the DATA folder only contain the latest interval (refer to this part of the NEMSEER docs for more detail). It is unclear if the same is true for P5MIN_ALL_DATA; P5MIN data tables in DATA appear have the same data with some minor differences (e.g. one column name is different in the constraint files).

If you are accessing pre-dispatch data, consider using NEMSEER.


get_years_and_months() -> Dict[int, List[int]]
Years and months with data on NEMWeb MMSDM Historical Data Archive
Returns:
    Months mapped to each year. Data is available for each of these months.

get_available_tables(year: int, month: int, data_dir: str) -> List[str]
Tables that can be requested from MMSDM Historical Data Archive for a
   particular month and year.
Args:
    year: Year
    month: Month
    data_dir: Directory within monthly archives

Returns:
    List of tables associated with that forecast type for that period

get_table_names_and_sizes(year: int, month: int, data_dir: str) -> Dict
Returns table names and sizes from MMSDM Historical Data Archive page

For a year and month in the MMSDM Historical Data Archive, returns a list of
tuples each consisting of:
- A table name (obtained via captured regex group)
- The size of the associated zip file

Args:
    year: Year
    month: Month
    data_dir: Directory within monthly archives
Returns:
    Tuple of table names and file sizes

get_and_unzip_table_csv(year: int, month: int, data_dir: str, table: str, cache: pathlib.Path) -> None
Unzipped (single) csv file downloaded from `url` to `cache`

This function:

1. Downloads zip file in chunks to limit memory use and enable progress bar
2. Validates that the zip contains a single file that has the same name as the zip

Args:
    year: Year
    month: Month
    data_dir: Directory within monthly archives
    table: Table name
    cache: Path to save zip.
Returns:
    None. Extracts csv to `cache`

CLI tool

The CLI tool uses Typer.

CLI usage GIF produced using asciinema and agg

Usage is documented within the tool:

mms-monthly-cli --help

...which returns:

Usage: mms-monthly-cli [OPTIONS] COMMAND [ARGS]...

 A CLI utility to find and obtain data made available through AEMO's MMS Monthly Data
 Archive: http://www.nemweb.com.au/Data_Archive/Wholesale_Electricity/MMSDM/

╭─ Options ───────────────────────────────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the current shell.                 │
│ --show-completion             Show completion for the current shell, to copy it or      │
│                               customize the installation.                               │
│ --help                        Show this message and exit.                               │
╰─────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────────────────────────────────────────╮
│ available-periods  Displays years and the months within them for which data is          │
│                    available                                                            │
│ available-tables   Displays available tables for a period (i.e. supplied month and      │
│                    year)                                                                │
│ get-table          Download and unzip monthly data zip file to get data table CSV in    │
│                    cache. To see available periods, use the `available_periods` command │
│                    To see available tables for a given period, use the                  │
│                    `available_tables` command                                           │
╰─────────────────────────────────────────────────────────────────────────────────────────╯

License

This tool and associated source code (reused from nemseer, which is licensed under GNU GPL-3.0-or-later) was created by Abhijith Prakash with contributions from Matthew Davis.

This tool and its source code is licensed under the terms of GNU GPL-3.0-or-later licences.

Release files for mms-monthly-cli 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mms-monthly-cli 1.1.0
File Size Uploaded
mms_monthly_cli-1.1.0.tar.gz 21.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mms-monthly-cli 1.1.0
File Interpreter ABI Platform
mms_monthly_cli-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.7 kB

Release files / mms_monthly_cli-1.1.0.tar.gz

Download URL mms_monthly_cli-1.1.0.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
51df588ee0d099980ab8528f1918ab6a454fc8d1af391eb53806123f55a9dd8c
BLAKE2b-256 checksum
How to use checksums
4710ed77401136d96490b35784a36cd26396b6e4a8576b8843a11cb0510d3259
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.0 Linux/6.5.0-1021-azure

Release files / mms_monthly_cli-1.1.0-py3-none-any.whl

Download URL mms_monthly_cli-1.1.0-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44e4a0136f4e59deed382f5917d8ddab43ba911fa4bfff0aef4ae594e0ed676d
BLAKE2b-256 checksum
How to use checksums
226cf0c5d4f514491a69007e049f93cb030be0e0546578e8a2fd4ce6b6b30358
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.0 Linux/6.5.0-1021-azure

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page