Skip to main content

Bootstrapped wind/load risk calculations

Project description

Student: Geoffrey De Sena

This package represents the final project for the course Advanced Scientific Programming with Python. In the project directory some data, some tests, and a driver script are provided for showing the functionality of the package.

For context, this package performs some of the final calculations needed for an ongoing research project in which I propose a method for estimating the risk that a certain penetration of offshore wind energy will lead to a shortage of electricity generation. The sample data are based on some exaggerated power flow modeling, so the probabilities are much higher than any sane system planner would ever accept. But it gives an indication of what the method does.

GenAI declaration: basically all of the code here was written by ChatGPT. Do I understand every line? No, but I built the code with Chat piece by piece, requiring it to provide checks at each stage to ensure that the functions were performing as desired. This also doesn't make the course any less valuable. Previously, my code quickly became unmanageable monoliths of complexity. After last week's course, I started paying much more attention to code structure. What you see here is a major improvement over previous projects, which is important because I will want to share this code as supplementary material for the article I'm working on.

The following course topics are addressed:

Git

  • This project has obviously been pushed to the Github repository where you found it.

Modularity

  • Functions have been broken into modules within the risk_tools package
  • Functions are called by other modules instead of repeating code

Linting and formatting

  • ran ruff and black on all the code
    • it didn't actually do much (ruff caught nothing) because Chat already writes clean code

Debugging

  • I have a new method of debugging that is superior to everything you showed us: Ask Chat to regenerate the code. Works every time.

Profiling

  • I asked Chat to generate some code and decorate the functions to help identify which operations were taking the most amount of time
  • It turned out that the main bottleneck is fitting distributions to the massive wind speed data set. I think the only way to speed that up is to create my own optimized fitting algorithm, which I think is safely beyond the scope of this course.
  • I have left the decorators and Chat's profiling function so that you can see it, but I will remove them when I continue developing this code.

Testing

  • in the test/ directory, there are some tests for each of the functions
  • these mostly just test that the outputs are the right shape because these are all statistical operations that a) depend on the input data and b) don't have a deterministic answer
  • If I have time, I'll add some more detailed tests, but that's gonna take some thinking

Documentation

Packaging

Pandas

  • I'll put this in here because it was part of the course, but I was already working primarily with pandas before the course so most of the data is handled using dataframes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gds_risk_tools-0.1.1.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gds_risk_tools-0.1.1-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file gds_risk_tools-0.1.1.tar.gz.

File metadata

  • Download URL: gds_risk_tools-0.1.1.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for gds_risk_tools-0.1.1.tar.gz
Algorithm Hash digest
SHA256 98206b301d3009233b5a695a29c087076e585862e827e0a4f227a439e86debb3
MD5 f3cc324e5b606c48dbd7922b8ff85cdd
BLAKE2b-256 ebc4942aa3908c61e422400fe62a29f8bcf151861c163f66a0a31fd0897f0ee8

See more details on using hashes here.

File details

Details for the file gds_risk_tools-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gds_risk_tools-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for gds_risk_tools-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba2cd00862a234615a21c9bd1b78e1dbcebddc21f23a15cb2ad46c95cafef94d
MD5 3e8a18309a2a003ac3658c3c7bab71ef
BLAKE2b-256 020a6d81b62b9ec6c654e137c98ea4a26098bb838d20c0f3f4103051dc676604

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page