From b33db6f5f754bc9e7bce78f684ef3ce0b819764e Mon Sep 17 00:00:00 2001 From: Sven Seeberg Date: Sun, 3 Dec 2023 11:17:44 +0100 Subject: [PATCH] Add simulation documentation, fix #69 --- README.md | 2 +- .../leeway/templates/base.html | 2 +- .../leewaysimulation_documentation.html | 19 +++++++++++++++++++ opendrift_leeway_webgui/leeway/urls.py | 6 ++++++ opendrift_leeway_webgui/leeway/views.py | 13 +++++++++++++ 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 opendrift_leeway_webgui/leeway/templates/leeway/leewaysimulation_documentation.html diff --git a/README.md b/README.md index 0b2c123..9106b76 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Authentication can be provided in two ways: 1. Clone this repository and change into the new directory: ```bash - gh repo clone digitalfabrik/leeway + git clone git@github.com:digitalfabrik/opendrift-leeway-webgui.git leeway cd leeway ``` 2. Create a virtual environment outside of the project directory and activate it: diff --git a/opendrift_leeway_webgui/leeway/templates/base.html b/opendrift_leeway_webgui/leeway/templates/base.html index 179b55b..dbb99f1 100644 --- a/opendrift_leeway_webgui/leeway/templates/base.html +++ b/opendrift_leeway_webgui/leeway/templates/base.html @@ -24,7 +24,7 @@

Source Code {% if user.is_authenticated %} - | List of simulations | New Simulation | Logout + | Documentation | List of simulations | New Simulation | Logout {% endif %}

diff --git a/opendrift_leeway_webgui/leeway/templates/leeway/leewaysimulation_documentation.html b/opendrift_leeway_webgui/leeway/templates/leeway/leewaysimulation_documentation.html new file mode 100644 index 0000000..5aba898 --- /dev/null +++ b/opendrift_leeway_webgui/leeway/templates/leeway/leewaysimulation_documentation.html @@ -0,0 +1,19 @@ +{% extends "base.html" %} +{% block content %} +

Leeway Simulation Documentation

+

Background

+

This software acts as a web user interface for the OpenDrift Leeway model. The basis for the simulation are experiments performed by the US Coast Guard in 1999. The results are published on https://ntrl.ntis.gov, which include desriptions of the objects that were tested (2-13 and following pages).

+

E-Mail Interface

+

If you have a low bandwidth connection, you can use the e-mail interface. The simulation parameters can be set in the e-mail subject. Your e-mail address needs to be registered for you user account in this tool first.

+
    +
  1. Create a new e-mail
  2. +
  3. Enter simulation parameters with adjusted values in the subject:
    latitude=33.333;longitude=14.444;duration=48;start_time=2022-12-10 00:00:00
  4. +
  5. Send the mail to
    {{ SERVER_EMAIL }}
  6. +
+ The result of the simulation will be sent to your e-mail address within a couple of minutes. +

Interpreting Simulation Result

+

When the simulation is finished, you will receive an e-mail that contains an attached image with the simulation results.

+

The simulation will randomly distribute 100 test particles around your entered coordinates. The default radius for distributing the particles is 1000 meters. If the coordinates are not very clear, you can increase this radius.

+

The starting points of the simulated particles are marked with green dots. If the particle ends up floating in water at the end of the simulation, the particle is marked blue. If the particle ends up on shore, it is marked green.

+

The image shows the trajectories of particles from the starting points to the ending points. The color of the trajectories incdicates the position of a particle at a given time. For example the color green always shows the position of the particles after ~50% of the simulated time range, while orange shows the positions at ~75%.

+{% endblock content %} diff --git a/opendrift_leeway_webgui/leeway/urls.py b/opendrift_leeway_webgui/leeway/urls.py index 77304ef..6445637 100644 --- a/opendrift_leeway_webgui/leeway/urls.py +++ b/opendrift_leeway_webgui/leeway/urls.py @@ -10,6 +10,7 @@ from .views import ( IndexRedirectView, + LeewaySimulationDocumentation, LeewaySimulationCreateView, LeewaySimulationDetailView, LeewaySimulationListView, @@ -18,6 +19,11 @@ #: The url patterns of this module (see :doc:`django:topics/http/urls`) urlpatterns = [ path("", IndexRedirectView.as_view(), name="index"), + path( + "documentation/", + LeewaySimulationDocumentation.as_view(), + name="simulation_documentation", + ), path( "simulations/", include( diff --git a/opendrift_leeway_webgui/leeway/views.py b/opendrift_leeway_webgui/leeway/views.py index abab51d..328c0f1 100644 --- a/opendrift_leeway_webgui/leeway/views.py +++ b/opendrift_leeway_webgui/leeway/views.py @@ -6,6 +6,7 @@ from django.views.generic.detail import DetailView from django.views.generic.edit import CreateView from django.views.generic.list import ListView +from django.views.generic import TemplateView from .forms import LeewaySimulationForm from .models import LeewaySimulation @@ -21,6 +22,18 @@ class IndexRedirectView(RedirectView): pattern_name = settings.LOGIN_REDIRECT_URL +class LeewaySimulationDocumentation(TemplateView): + """ + Display end user documentation for using the tool + """ + template_name = 'leeway/leewaysimulation_documentation.html' + + def get_context_data(self, **kwargs): + context = super(LeewaySimulationDocumentation, self).get_context_data(**kwargs) + context['SERVER_EMAIL'] = settings.SERVER_EMAIL + return context + + class LeewaySimulationCreateView(LoginRequiredMixin, CreateView): """ The view for rendering and submitting the simulation form