Giter Club home page Giter Club logo

catchments_simulation's Introduction

Documentation Status License: MIT PyPI version fury.io GitHub Actions Build Status GitHub Actions Build Status codecov

Catchment simulation

Package include method for simulate subcatchment with different features values from Storm Water Management Model. Currently, some of the 'catchment simulation' functionality available in the app - catchment simulation

Examples of How To Use

Creating SWMM object for analyse

Inslall catchment_simulation package using pip

pip install catchment-simulation

Example of simulation subcatchment area in selected range.

from catchment_simulation.catchment_features_simulation import FeaturesSimulation

subcatchment_id = "S1"
raw_file = "catchment_simulation/example.inp"
model = FeaturesSimulation(subcatchment_id=subcatchment_id, raw_file=raw_file)
df = model.simulate_area(start=1, stop: = 10, step = 1)

More code examples at the end of the notebook.

Catchment simulation app

The application was built in django share some of the functionality from the 'catchment simulation' package.

It is designed to analyze and predict water flow behavior in catchments. The application contain two main components: the Catchment Simulation package and Catchment Calculation. On the main page you can find information of the 'catchments simulation' package and examples of use.

Application at - https://catchment-simulations.onrender.com/

Simulations in a web application

The 'Simulations' tab allows the user to upload a file and select components for simulation. Once the simulation is executed, the window will display an interactive graph of the obtained data and a button to download the results in an excel spreadsheet.

Warning

You will be asked to register and log in before performing the simulation.

Appendix - ANN and SWMM predictions

The 'Calculations' tab contains a neural network model trained to predict catchment area runoff. The user, after uploading the file, receives the results of calculations performed SWMM and ANN model prediction.

Warning

You will be asked to register and log in before performing the simulation.

More examples of package usage

Simulate subcatchment percent impervious in selected range.

from catchment_simulation.catchment_features_simulation import FeaturesSimulation

subcatchment_id = "S1"
raw_file = "catchment_simulation/example.inp"
model = FeaturesSimulation(subcatchment_id=subcatchment_id, raw_file=raw_file)
df = model.simulate_percent_impervious(start=1, stop: = 10, step = 1)

Simulate subcatchment percent slope in selected range.

from catchment_simulation.catchment_features_simulation import FeaturesSimulation

subcatchment_id = "S1"
raw_file = "catchment_simulation/example.inp"
model = FeaturesSimulation(subcatchment_id=subcatchment_id, raw_file=raw_file)
df = model.simulate_percent_slope(start=1, stop: = 10, step = 1)

Simulate subcatchment width in selected range.

from catchment_simulation.catchment_features_simulation import FeaturesSimulation

subcatchment_id = "S1"
raw_file = "catchment_simulation/example.inp"
model = FeaturesSimulation(subcatchment_id=subcatchment_id, raw_file=raw_file)
df = model.simulate_width(start=1, stop: = 10, step = 1)

Simulate subcatchment curb length in selected range.

from catchment_simulation.catchment_features_simulation import FeaturesSimulation

subcatchment_id = "S1"
raw_file = "catchment_simulation/example.inp"
model = FeaturesSimulation(subcatchment_id=subcatchment_id, raw_file=raw_file)
df = model.simulate_curb_length(start=1, stop: = 10, step = 1)

Simulate subcatchment N-Imperv in selected range.

from catchment_simulation.catchment_features_simulation import FeaturesSimulation

subcatchment_id = "S1"
raw_file = "catchment_simulation/example.inp"
model = FeaturesSimulation(subcatchment_id=subcatchment_id, raw_file=raw_file)
df = model.simulate_n_imperv(param="Imperv")

Simulate subcatchment N-Perv in selected range.

from catchment_simulation.catchment_features_simulation import FeaturesSimulation

subcatchment_id = "S1"
raw_file = "catchment_simulation/example.inp"
model = FeaturesSimulation(subcatchment_id=subcatchment_id, raw_file=raw_file)
df = model.simulate_n_perv(param="Perv")

Simulate subcatchment Destore-Imperv in selected range.

from catchment_simulation.catchment_features_simulation import FeaturesSimulation

subcatchment_id = "S1"
raw_file = "catchment_simulation/example.inp"
model = FeaturesSimulation(subcatchment_id=subcatchment_id, raw_file=raw_file)
df = model.simulate_s_imperv(param="Imperv")

Simulate subcatchment Destore-Perv in selected range.

from catchment_simulation.catchment_features_simulation import FeaturesSimulation

subcatchment_id = "S1"
raw_file = "catchment_simulation/example.inp"
model = FeaturesSimulation(subcatchment_id=subcatchment_id, raw_file=raw_file)
df = model.simulate_s_imperv(param="Perv")

Simulate subcatchment Percent Zero Imperv in selected range.

from catchment_simulation.catchment_features_simulation import FeaturesSimulation

subcatchment_id = "S1"
raw_file = "catchment_simulation/example.inp"
model = FeaturesSimulation(subcatchment_id=subcatchment_id, raw_file=raw_file)
df = model.simulate_percent_zero_imperv(start=0, stop=100, step=10)

Bugs

If you encounter any bugs or issues while using our software, please feel free to report them on the project's issue tracker. When reporting a bug, please provide as much information as possible to help us reproduce and resolve the issue, including:

  • A clear and concise description of the issue
  • Steps to reproduce the problem
  • Expected behavior and actual behavior
  • Any error messages or logs that may be relevant

Your feedback is invaluable and will help us improve the software for all users.

Contributing

We welcome and appreciate contributions from the community! If you're interested in contributing to this project, please follow these steps:

  1. Fork the repository on GitHub.
  2. Create a new branch for your changes.
  3. Make your changes, including updates to documentation if needed.
  4. Write tests to ensure your changes are working as expected.
  5. Ensure all tests pass and there are no linting or code style issues.
  6. Commit your changes and create a pull request, providing a detailed description of your changes.

We will review your pull request as soon as possible and provide feedback. Once your contribution is approved, it will be merged into the main branch.

For more information about contributing to the project, please see our contributing guide.

License

License This project is licensed under the MIT License. By using, distributing, or contributing to this project, you agree to the terms and conditions of the license. Please refer to the LICENSE.md file for the full text of the license.

catchments_simulation's People

Contributors

buczynskirafal avatar

Stargazers

 avatar Simon Delmas avatar Sourcery AI avatar Adam Erispaha avatar

Watchers

Kostas Georgiou avatar  avatar

Forkers

sourcery-ai-bot

catchments_simulation's Issues

Add CI/CD for PyPI Package and Django Application

Description: Implement a Continuous Integration and Continuous Deployment (CI/CD) pipeline for our Python package hosted on PyPI and our Django web application. The pipeline should automate the process of testing, building, and deploying both the package and the application, ensuring a seamless and efficient workflow.

Tasks:

  • Set up a GitHub Actions workflow for the Python package:

    • Run unit tests and linting checks on every push and pull request.

    • Build and publish the package to PyPI automatically on new releases.

  • Set up a GitHub Actions workflow for the Django application:

    • Run unit tests, linting checks, and security scans on every push and pull request.

    • Deploy the application to the chosen hosting platform (e.g., Heroku, AWS, or GCP) automatically on new releases.

  • Configure notifications to alert the development team about the status of the CI/CD pipeline, including any failed tests or deployment issues.

  • Update project documentation to include information about the CI/CD pipeline, its requirements, and its usage.

  • Provide training and support to the development team on how to effectively utilize the CI/CD pipeline and troubleshoot any issues that may arise.

By completing these tasks, we will significantly improve the development and deployment process for both our Python package and Django application, ensuring higher quality and more reliable releases.

Add project documentation

It's nessesary to add documentation to project.

The documentation should include:

  • Instructions on how to set up the project locally

  • Explanation of any custom libraries or modules used in the project

  • Contribution guidelines and code of conduct

I propose that we use a tool like Sphinxto generate the documentation, and we can host it on https://readthedocs.org/.

Add API to Existing Django Application Functionality

Objective: Create a REST API for the existing Django application to provide users with programmatic access to its features and data.

Steps

  • Design the API endpoints

    • Define the API endpoints and their corresponding request and response structures.
  • Implement the API components

    • Create the API views, serializers, and URL routing for each endpoint.
  • Add authentication and permissions

    • Ensure the security of the API by implementing authentication and permissions as needed.
  • Test the API functionality

    • Verify that the API works as expected by testing each endpoint.

Achieve Full Test Coverage for Django Application

Objective: Improve the quality and stability of the Django application by achieving full test coverage for all models, views, and utility functions.

Requirements:

  • Analyze the current test coverage: Utilize a test coverage tool, such as Coverage.py, to determine which parts of the application are not covered by existing tests.

  • Write unit tests: Create unit tests for all models, views, and utility functions that are not currently tested. Ensure that these tests cover edge cases and various input scenarios.

  • Write integration tests: Develop integration tests to verify that the various components of the application work together as expected. This includes testing communication between different app modules, as well as any external APIs or services that the application relies on.

  • Configure test settings: Update the Django project's settings to include a dedicated test configuration, including any necessary database settings, test runners, and other configurations specific to testing.

  • Run tests continuously: Set up a continuous integration (CI) pipeline that automatically runs tests whenever changes are pushed to the codebase. This will help catch potential issues early in the development process.

  • Document testing process: Update the project documentation, such as the README or a separate testing guide, to include information on running tests, the tools used for testing, and any necessary setup steps.

  • Monitor and maintain test coverage: Regularly review test coverage reports to ensure that the application remains fully covered by tests as it evolves. Make any necessary updates to tests as the codebase changes.

Deliverables:

  • A complete set of unit tests for all models, views, and utility functions in the Django application.
  • A set of integration tests that verify the proper functioning of the application as a whole.
  • An updated settings configuration for testing purposes.
  • A continuous integration pipeline that runs tests automatically.
  • Updated project documentation that includes information on testing, tools used, and setup instructions.
    By achieving full test coverage for the Django application, we will ensure that the application is more robust, reliable, and maintainable for future development.

Ran out of memory.

Server unhealthy
Ran out of memory (used over 512MB) while running your code.

  • Add memory usage profiling.

  • Optimize memory usage - smaller variables if possible int8, max float16.

  • Remove unnecessary objects.

  • Apply generators where possible.

  • Check whether to perform data processing in batches.

Train a Model and Add to Application

Train a machine learning model using a dataset and integrate it into the application to enhance its performance.

Deliverables:

  • Trained machine learning model.

  • Code changes for model integration.

  • Updated project documentation.

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.