Git Product home page Git Product logo

unsw-ceem / nemseer Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 3.0 45.17 MB

A package for downloading and handling forecasts for the National Electricity Market (NEM) from the Australian Energy Market Operator (AEMO).

Home Page: http://nemseer.readthedocs.io/

License: GNU General Public License v3.0

Python 100.00%
energy python aemo pasa forecast national-electricity-market nem pre-dispatch australia nemweb

nemseer's Introduction

nemseer

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

A package for downloading and handling historical National Electricity Market (NEM) forecast data produced by the Australian Energy Market Operator (AEMO).

Installation

pip install nemseer

Many nemseer use-cases require NEMOSIS, which can also be installed using pip:

pip install nemosis

Overview

nemseer allows you to access historical AEMO pre-dispatch and Projected Assessment of System Adequacy (PASA) forecast1 data available through the MMSDM Historical Data SQLLoader. nemseer can then compile this data into pandas DataFrames or xarray Datasets.

An overview of nemseer functionality and potential use-cases are provided in the JOSS paper for this package.

forecast_overview

Source: Reserve services in the National Electricity Market, AEMC, 2021

Whereas PASA processes are primarily used to assess resource adequacy based on technical inputs and assumptions for resources in the market (i.e. used to answer questions such as "can operational demand be met in the forecast horizon with a sufficient safety (reserve) margin?"), pre-dispatch processes incorporate the latest set of market participant offers and thus produce regional prices forecasts for energy and frequency control ancillary services (FCAS). Overviews of the various pre-dispatch and PASA processes can be found in the glossary.

nemseer enables you to download and work with data for the following forecast types. Where available, AEMO process and table descriptions are linked:

  1. 5-minute pre-dispatch (P5MIN: Table descriptions)
  2. Pre-dispatch (PREDISPATCH: Table descriptions)
  3. Pre-dispatch Projected Assessment of System Adequacy (PDPASA: Tables and Descriptions)
  4. Short Term Projected Assessment of System Adequacy (STPASA: Table descriptions)
  5. Medium Term Projected Assessment of System Adequacy (MTPASA: Table descriptions)

Another helpful reference for PASA information is AEMO's Reliability Standard Implementation Guidelines.

ST PASA Replacement Project

Note that the methodologies for PD PASA and ST PASA are being reviewed by AEMO. In particular, the ST PASA Replacement project will combine PD PASA and ST PASA into ST PASA. For more detail, refer to the final determination of the rule change and the AEMO ST PASA Replacement Project home page.

Usage

Glossary

The glossary contains overviews of the PASA and pre-dispatch processes, and descriptions of terminology used in nemseer.

Quick start

Check out the Quick start for guide on to use nemseer.

Examples

Some use case examples have been included in the Examples section of the documentation.

Support

If you are having an issue with this software that has not already been raised in the issues register, please raise a new issue.

Contributing

Interested in contributing? Check out the contributing guidelines, which also includes steps to install nemseer 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.

Citation

If you use nemseer, please cite the JOSS paper for this package

If you use code or analysis from any of the demand error and/or price convergence examples in the documentation, please also cite NEMOSIS via this conference paper

Licenses

nemseer was created by Abhijith Prakash. It is licensed under the terms of GNU GPL-3.0-or-later licences.

The content within the documentation for this project is licensed under a Creative Commons Attribution 4.0 International License.

Credits

nemseer was created with cookiecutter and the py-pkgs-cookiecutter template.

Development of nemseer was funded by the UNSW Digital Grid Futures Institute.

Contributor Acknowledgements

Thanks to:

  • Nicholas Gorman for reviewing nemseer code
  • Krisztina Katona for reviewing and improving the glossary
  • Dylan McConnell for assistance in interpreting PASA run types
  • Declan Heim for suggesting improvements to nemseer examples

Footnotes

  1. We use the term "forecast" loosely, especially given that these "forecasts" change once participants update offer information (e.g. through rebidding) or submit revised resource availabilities and energy constraints. Both of these are intended outcomes of these "ahead processes", which are run to provide system and market information to participants to inform their decision-making. However, to avoid confusion and to ensure consistency with the language used by AEMO, we use the terms "forecast" (or outputs) and "forecast types" (or ahead processes) in nemseer.

nemseer's People

Contributors

krasztana2 avatar prakaa avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nemseer's Issues

Switch date format

Switch date format to yyyy/mm/dd HH:MM for consistency with AEMO and NEMOSIS formats

  • Change validators and converters
  • Change README examples
  • Change docstrings

Thanks @nick-gorman and @dec-heim

Compile to xarray

  • Implement method
  • Write docstring
  • Options in compile_raw_data
  • Add example in quick start

PermissionError using download_raw_data

Running the example code below on a windows machine leads to a permission error.

Example:

import nemseer
nemseer.download_raw_data(
    forecast_start = "01/01/2020 00:00", 
    forecast_end = "02/01/2020 00:00",
    forecasted_start = "02/01/2020 00:00",
    forecasted_end = "02/01/2020 00:00",
    forecast_type = "P5MIN",
    tables = "REGIONSOLUTION",
    raw_cache = "/my/raw/cache/",
    keep_csv = False
)

Error:

INFO: Created directory at C:\cache
INFO: Downloading and unzipping REGIONSOLUTION for 1/2020
PUBLIC_DVD_P5MIN_REGIONSOLUTION_202001010000.zip: 100%|██████████| 32.9M/32.9M [00:09<00:00, 3.70MB/s]
Traceback (most recent call last):
  File "C:/Users/nick/PycharmProjects/nemseer_test/main.py", line 2, in <module>
    nemseer.download_raw_data(
  File "C:\Users\nick\PycharmProjects\nemseer_test\venv\lib\site-packages\nemseer\nemseer.py", line 46, in download_raw_data
    downloader.download_csv()
  File "C:\Users\nick\PycharmProjects\nemseer_test\venv\lib\site-packages\nemseer\downloader.py", line 362, in download_csv
    get_unzipped_csv(url, self.raw_cache)
  File "C:\Users\nick\PycharmProjects\nemseer_test\venv\lib\site-packages\nemseer\downloader.py", line 296, in get_unzipped_csv
    Path(file_path).unlink()
  File "C:\Users\nick\AppData\Local\Programs\Python\Python38\lib\pathlib.py", line 1324, in unlink
    self._accessor.unlink(self)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: '\\cache\\PUBLIC_DVD_P5MIN_REGIONSOLUTION_202001010000.zip'

Process finished with exit code 1

Integrate `processed_cache`

  • netCDF with metadata
  • parquet with metadata
  • Check processed cache before initiating download actions
  • Compile from processed cache
  • Change names and docstrings of core funcs - e.g. compile_raw_data to compile_data
  • Update quick start in docs

Handle MTPASA DUID Availability

This table is not in the MMS Data Historical SQL Loader.

  • Add new URL in data
  • Query will need to handle this request. Validation will need to be reconfigured
    • One solution is a wrapper function for validation
  • Downloader will need to handle this request
    • downloader module may need refactoring or additional functions

Testing for Windows

OS specific issues seems to be popping up on WIndows

Would be good to add testing on Windows to the GitHub Actions Workflow

Testing for larger zipfiles (enumerated, etc.)

Some downloadable files are not being tested because the download size is large and processing to parquet requires a lot of memory.

This can mean some key functionality is not being tested, e.g. handling enumerated PREDISP_ALL_DATA requests.

Potential solutions:

  1. Test download anyway, and make these tests optional
  2. Test up to request, and check that request has MB Content-Length

Handle datetimes with seconds

nemseer currently only accepts datetimes down to minutes.

It should be able to accept datetimes down to seconds, with seconds set as 0. This will improve usability with NEMOSIS

Create examples

  • Core functionality function docstrings should have, or be linked to examples

ST PASA Datetime validation bug

Forecasted end was previously assessed based on increment from forecasted_start.

Instead, it should be validated based on its on "latest forecast time"

Can't download October 2022 Predispatch forecast

I'm trying to download the predispatch price forecast data over the time range:

cache_start_time = "2021/01/01 00:00:00"
cache_end_time = "2023/10/31 00:00:00"

This range should be available, according to the output of:

nemseer.get_data_daterange()

However, when I run the download (see attached jupyter notebook), I get the following error message:

HTTPError: 404 Client Error: Not Found for url: http://www.nemweb.com.au/Data_Archive/Wholesale_Electricity/MMSDM/2022/MMSDM_2022_10/MMSDM_Historical_Data_SQLLoader/PREDISP_ALL_DATA/PUBLIC_DVD_PREDISPATCHPRICE_202210010000.zip

It's expecting a file with basename:

PUBLIC_DVD_PREDISPATCHPRICE_202210010000.zip

but the basename that actually exists in that directory is:

PUBLIC_DVD_PREDISPATCHCONSTRAINT1_202210010000.zip

Do you have any suggestions?

mkFeats_ERROR_REPRO_is_really_ipynb.txt

Smarter csv conversion

An issue arises where a user might cache nemseer data in the same dir as csvs (e.g. NEMOSIS csvs). `nemseer will then proceed to convert all csvs.

A more targeted/smarter conversion to csv is required

Thanks @dec-heim

Enumeration retained in data compilation dict

Enumerated tables mapped to returned data

Expected behaviour is to map to parent table - e.g. LOAD1 and LOAD2 should be mapped to LOAD - since this is how the user requests data.

Handle invalid/corrupted zips

  1. Catch exception and continue downloading other files in query
  2. Write faulty file to a hidden file
  3. ForecastTypeDownloader behaviours based on faulty zips/csvs in hidden file
  4. Modify DataCompiler behaviour based on faulty zips/csvs in hidden file
  • Implement step 1
  • Implement step 2
  • Implement step 3
  • Implement step 4

Smarter `download_raw_data`

  1. Given a set of run_times, generate some dummy forecasted and initiate download
  2. Given a set of forecasted_times use runtime generators to generate relevant run_times

Flow could be as follows:

  • Make all times optional params with None as default

  • Raise error if start and end not provided for run, and/or for forecasted time pairs

  • Depending on which pair is provided, do 1 or 2

  • Implement code changes

  • Write tests

  • Modify docstrings

  • Modify Quick Start in docs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.