├── src ├── rrsm │ ├── rrsm │ │ ├── __init__.py │ │ ├── wsgi.py │ │ ├── urls.py │ │ └── settings.py │ ├── rrsmi │ │ ├── fdsn │ │ │ ├── __init__.py │ │ │ ├── fdsn_event.py │ │ │ ├── base_classes.py │ │ │ └── fdsn_manager.py │ │ ├── tests │ │ │ ├── __init__.py │ │ │ └── test_fdsn_manager.py │ │ ├── migrations │ │ │ ├── __init__.py │ │ │ └── 0001_initial.py │ │ ├── templatetags │ │ │ ├── __init__.py │ │ │ ├── gravatar.py │ │ │ └── form_tags.py │ │ ├── admin.py │ │ ├── __init__.py │ │ ├── apps.py │ │ ├── logger.py │ │ ├── base_classes.py │ │ ├── models.py │ │ └── forms.py │ ├── static_rrsm │ │ ├── css │ │ │ ├── app │ │ │ │ └── app.css │ │ │ ├── accounts │ │ │ │ └── accounts.css │ │ │ ├── baguettebox │ │ │ │ └── baguetteBox.min.css │ │ │ ├── bootstrap │ │ │ │ ├── bootstrap-reboot.min.css │ │ │ │ └── bootstrap-reboot.css │ │ │ ├── datatable │ │ │ │ └── dataTables.bootstrap4.min.css │ │ │ ├── openlayers │ │ │ │ └── ol.css │ │ │ └── simplemde │ │ │ │ └── simplemde.min.css │ │ ├── img │ │ │ ├── logo │ │ │ │ ├── eth.png │ │ │ │ ├── knmi.png │ │ │ │ ├── sed.png │ │ │ │ └── orfeus.png │ │ │ ├── patterns │ │ │ │ ├── tweed.png │ │ │ │ ├── geometry1x.png │ │ │ │ ├── geometry2x.png │ │ │ │ └── pentagon.png │ │ │ └── markers │ │ │ │ ├── marker-blue.png │ │ │ │ ├── marker-pink.png │ │ │ │ ├── marker-red.png │ │ │ │ ├── marker-green.png │ │ │ │ ├── marker-orange.png │ │ │ │ ├── marker-yellow.png │ │ │ │ ├── triangle-blue.png │ │ │ │ ├── triangle-grey.png │ │ │ │ ├── triangle-pink.png │ │ │ │ ├── triangle-red.png │ │ │ │ ├── square-lightblue.png │ │ │ │ ├── triangle-black.png │ │ │ │ ├── triangle-darkred.png │ │ │ │ ├── triangle-green.png │ │ │ │ ├── triangle-orange.png │ │ │ │ ├── triangle-purple.png │ │ │ │ ├── triangle-white.png │ │ │ │ ├── triangle-yellow.png │ │ │ │ ├── triangle-lightblue.png │ │ │ │ └── triangle-lightgreen.png │ │ └── js │ │ │ ├── datatable │ │ │ └── dataTables.bootstrap4.min.js │ │ │ ├── openlayers │ │ │ └── olRrsm.js │ │ │ ├── highcharts │ │ │ ├── offline-exporting.js │ │ │ ├── export-data.js │ │ │ └── exporting.js │ │ │ └── baguettebox │ │ │ └── baguetteBox.min.js │ ├── logs │ │ └── .gitignore │ ├── requirements.txt │ ├── dockerfile │ ├── templates │ │ ├── 404.html │ │ ├── 500.html │ │ ├── links.html │ │ ├── search.html │ │ ├── includes │ │ │ ├── form.html │ │ │ └── pagination.html │ │ ├── stations.html │ │ ├── search_custom.html │ │ ├── base.html │ │ ├── events.html │ │ ├── station_streams.html │ │ └── event_details.html │ ├── manage.py │ └── .env.sample ├── nginx │ ├── Dockerfile │ └── sites-enabled │ │ └── django └── docker-compose.yml ├── .vscode ├── settings.json └── launch.json ├── docs ├── docker-compose.yml └── EXAMPLE_ENVS.MD ├── LICENSE ├── .gitignore └── README.MD /src/rrsm/rrsm/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/rrsm/rrsmi/fdsn/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/rrsm/rrsmi/fdsn/fdsn_event.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/rrsm/rrsmi/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/rrsm/rrsmi/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/rrsm/rrsmi/templatetags/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/rrsm/rrsmi/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin -------------------------------------------------------------------------------- /src/rrsm/rrsmi/__init__.py: -------------------------------------------------------------------------------- 1 | default_app_config = 'rrsmi.apps.RrsmiConfig' -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/css/app/app.css: -------------------------------------------------------------------------------- 1 | .navbar-brand { 2 | font-family: 'Bangers'; 3 | } -------------------------------------------------------------------------------- /src/rrsm/logs/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.pythonPath": "env/bin/python3", 3 | "python.linting.pylintEnabled": true 4 | } -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/logo/eth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/logo/eth.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/logo/knmi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/logo/knmi.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/logo/sed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/logo/sed.png -------------------------------------------------------------------------------- /src/rrsm/rrsmi/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class RrsmiConfig(AppConfig): 5 | name = 'rrsmi' 6 | -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/logo/orfeus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/logo/orfeus.png -------------------------------------------------------------------------------- /src/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM tutum/nginx 2 | 3 | RUN rm /etc/nginx/sites-enabled/default 4 | ADD sites-enabled/ /etc/nginx/sites-enabled -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/patterns/tweed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/patterns/tweed.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/marker-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/marker-blue.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/marker-pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/marker-pink.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/marker-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/marker-red.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/patterns/geometry1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/patterns/geometry1x.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/patterns/geometry2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/patterns/geometry2x.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/patterns/pentagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/patterns/pentagon.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/marker-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/marker-green.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/marker-orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/marker-orange.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/marker-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/marker-yellow.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/triangle-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/triangle-blue.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/triangle-grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/triangle-grey.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/triangle-pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/triangle-pink.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/triangle-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/triangle-red.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/square-lightblue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/square-lightblue.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/triangle-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/triangle-black.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/triangle-darkred.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/triangle-darkred.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/triangle-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/triangle-green.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/triangle-orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/triangle-orange.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/triangle-purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/triangle-purple.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/triangle-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/triangle-white.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/triangle-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/triangle-yellow.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/triangle-lightblue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/triangle-lightblue.png -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/img/markers/triangle-lightgreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EIDA/rrsm/master/src/rrsm/static_rrsm/img/markers/triangle-lightgreen.png -------------------------------------------------------------------------------- /src/rrsm/requirements.txt: -------------------------------------------------------------------------------- 1 | django==3.2.13 2 | python-decouple==3.4 3 | django-cleanup==5.2.0 4 | django-widget-tweaks==1.4.8 5 | numpy==1.20.3 6 | obspy==1.2.2 7 | gunicorn==20.1.0 -------------------------------------------------------------------------------- /src/rrsm/dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8 2 | 3 | # Initialize 4 | RUN mkdir -p /data/rrsm 5 | WORKDIR /data/rrsm 6 | COPY requirements.txt /data/rrsm/ 7 | 8 | # Install deps 9 | RUN pip3 install --upgrade pip 10 | RUN pip3 install -r requirements.txt 11 | 12 | # Prepare 13 | COPY . /data/rrsm/ 14 | -------------------------------------------------------------------------------- /src/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | rrsmweb: 4 | restart: always 5 | build: ./rrsm/ 6 | ports: 7 | - "8000:8000" 8 | networks: 9 | - rrsm_net 10 | command: gunicorn rrsm.wsgi:application --timeout 300 -w 2 -b :8000 11 | 12 | networks: 13 | rrsm_net: -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/css/accounts/accounts.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-image: url(../img/patterns/geometry2x.png); 3 | } 4 | 5 | .logo { 6 | font-family: 'Bangers'; 7 | } 8 | 9 | .logo a { 10 | color: black; 11 | } 12 | 13 | .logo a:hover, 14 | .logo a:active { 15 | text-decoration: none; 16 | } -------------------------------------------------------------------------------- /src/rrsm/templates/404.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block title %}My account{% endblock %} 4 | 5 | {% block breadcrumb %} 6 | 7 | {% endblock %} 8 | 9 | {% block content %} 10 | 13 | {% endblock %} -------------------------------------------------------------------------------- /src/rrsm/templates/500.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block title %}My account{% endblock %} 4 | 5 | {% block breadcrumb %} 6 | 7 | {% endblock %} 8 | 9 | {% block content %} 10 | 13 | {% endblock %} -------------------------------------------------------------------------------- /src/rrsm/rrsm/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for rrsm project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rrsm.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /src/nginx/sites-enabled/django: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8000; 3 | server_name not.configured.example.com; 4 | charset utf-8; 5 | 6 | location /static/ { 7 | alias /data/rrsm/rrsm/static/; 8 | } 9 | 10 | location / { 11 | proxy_pass http://rrsmweb:8000; 12 | proxy_set_header Host $host; 13 | proxy_set_header X-Real-IP $remote_addr; 14 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /src/rrsm/rrsmi/templatetags/gravatar.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | from urllib.parse import urlencode 3 | 4 | from django import template 5 | from django.conf import settings 6 | 7 | register = template.Library() 8 | 9 | 10 | @register.filter 11 | def gravatar(user): 12 | email = user.email.lower().encode('utf-8') 13 | default = 'mm' 14 | size = 256 15 | url = 'https://www.gravatar.com/avatar/{md5}?{params}'.format( 16 | md5=hashlib.md5(email).hexdigest(), 17 | params=urlencode({'d': default, 's': str(size)}) 18 | ) 19 | return url -------------------------------------------------------------------------------- /src/rrsm/rrsmi/templatetags/form_tags.py: -------------------------------------------------------------------------------- 1 | from django import template 2 | 3 | register = template.Library() 4 | 5 | @register.filter 6 | def field_type(bound_field): 7 | return bound_field.field.widget.__class__.__name__ 8 | 9 | @register.filter 10 | def input_class(bound_field): 11 | css_class = '' 12 | if bound_field.form.is_bound: 13 | if bound_field.errors: 14 | css_class = 'is-invalid' 15 | elif field_type(bound_field) != 'PasswordInput': 16 | css_class = 'is-valid' 17 | return 'form-control {}'.format(css_class) -------------------------------------------------------------------------------- /src/rrsm/templates/links.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | {% block breadcrumb %} 5 | 6 | 7 | {% endblock %} 8 | 9 | {% block content %} 10 | 11 | {% if links %} 12 | {% for link in links %} 13 |

Link: {{ link.url }}

14 |

Description: {{ link.description }}

15 |
16 | {% endfor %} 17 | {% else %} 18 |

No links defined!

19 | {% endif %} 20 | 21 | {% endblock %} -------------------------------------------------------------------------------- /src/rrsm/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rrsm.settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /docs/docker-compose.yml: -------------------------------------------------------------------------------- 1 | # This is the original version of the docker-compose file with nginx 2 | version: '2' 3 | services: 4 | rrsmweb: 5 | restart: always 6 | build: ./rrsm/ 7 | expose: 8 | - "8000" 9 | volumes: 10 | - /data/rrsm/rrsm/static 11 | networks: 12 | - rrsm_net 13 | command: gunicorn rrsm.wsgi:application --timeout 300 -w 2 -b :8000 14 | 15 | rrsmnginx: 16 | restart: always 17 | build: ./nginx/ 18 | depends_on: 19 | - rrsmweb 20 | ports: 21 | - "8000:8000" 22 | volumes_from: 23 | - rrsmweb 24 | links: 25 | - rrsmweb:rrsmweb 26 | networks: 27 | - rrsm_net 28 | 29 | networks: 30 | rrsm_net: -------------------------------------------------------------------------------- /src/rrsm/rrsmi/logger.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import logging 3 | 4 | 5 | class RrsmLoggerMixin(): 6 | def __init__(self): 7 | self.class_name = self.__class__.__name__ 8 | self.logger = logging.getLogger(self.class_name) 9 | 10 | def log_information(self, info='No description'): 11 | self.logger.info( 12 | '{0}: {1}'.format(self.class_name, info)) 13 | 14 | def log_warning(self, info='No description'): 15 | self.logger.warning( 16 | '{0}: {1}'.format(self.class_name, info)) 17 | 18 | def log_exception(self, info='No description'): 19 | self.logger.exception( 20 | '{0}: {1}'.format(self.class_name, info)) 21 | -------------------------------------------------------------------------------- /src/rrsm/templates/search.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | {% block breadcrumb %} 5 | 6 | 7 | {% endblock %} 8 | 9 | {% block content %} 10 | 11 | {% if show_info %} 12 |
13 | 14 | To include event location or station location in the search, all 4 coordinates need to be provided. 15 |
16 | {% endif %} 17 | 18 |
19 | {% csrf_token %} 20 | {% include 'includes/form.html' %} 21 | 22 |
23 | {% endblock %} -------------------------------------------------------------------------------- /src/rrsm/rrsmi/base_classes.py: -------------------------------------------------------------------------------- 1 | from django.views.generic import UpdateView 2 | from django.utils import timezone 3 | from django.http import Http404 4 | 5 | from .logger import RrsmLoggerMixin 6 | 7 | 8 | class RrsmHelpers(RrsmLoggerMixin): 9 | def pga_pgv_centimeters_to_meters(self, pga_min, pga_max, pgv_min, pgv_max): 10 | """Convert PGA and PGV values from centimeters to meters. 11 | PGA and PGV values are rendered in the interface in centimerets, 12 | but the underlying web service is operating using meters. 13 | """ 14 | if pga_min: 15 | pga_min = pga_min / 100 16 | if pga_max: 17 | pga_max = pga_max / 100 18 | if pgv_min: 19 | pgv_min = pgv_min / 100 20 | if pgv_max: 21 | pgv_max = pgv_max / 100 22 | return pga_min, pga_max, pgv_min, pgv_max 23 | -------------------------------------------------------------------------------- /docs/EXAMPLE_ENVS.MD: -------------------------------------------------------------------------------- 1 | # /git/rrsm/src/rrsm/.env 2 | SECRET_KEY='#ps1ib&=v%zsgzi5q*qp-ei*b1bg19dxv&861m@4@x+2ww6nx^' 3 | DEBUG=True 4 | ALLOWED_HOSTS=.localhost,127.0.0.1 5 | DATABASE_URL=sqlite:///db.sqlite3 6 | DATABASE_ENGINE = "django.db.backends.sqlite3" 7 | DATABASE_NAME = ".rrsm.db" 8 | DATABASE_USER='admin' 9 | DATABASE_PASS='passwd' 10 | EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend 11 | CACHE_BACKEND=django.core.cache.backends.memcached.MemcachedCache 12 | CACHE_LOCATION='127.0.0.1:11211' 13 | CACHE_TIME_SHORT=60 14 | CACHE_TIME_MEDIUM=300 15 | CACHE_TIME_LONG=1800 16 | RRSM_URL_BASE='rrsm2/' 17 | 18 | # Cache backends 19 | * `django.core.cache.backends.dummy.DummyCache` (development) 20 | * `django.core.cache.backends.memcached.MemcachedCache` 21 | * `django.core.cache.backends.filebased.FileBasedCache` -------------------------------------------------------------------------------- /src/rrsm/.env.sample: -------------------------------------------------------------------------------- 1 | SECRET_KEY='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)' 2 | DEBUG=True 3 | ALLOWED_HOSTS=.localhost,127.0.0.1 4 | # Database configuration 5 | DATABASE_URL=sqlite:///db.sqlite3 6 | DATABASE_ENGINE=django.db.backends.sqlite3 7 | DATABASE_NAME='rrsm.db' 8 | DATABASE_USER='admin' 9 | DATABASE_PASS='passwd' 10 | # Email configuration 11 | EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend 12 | # Cache configuration 13 | CACHE_BACKEND=django.core.cache.backends.filebased.FileBasedCache 14 | CACHE_LOCATION='rrsm_cache' 15 | CACHE_TIME_SHORT=0 16 | CACHE_TIME_MEDIUM=0 17 | CACHE_TIME_LONG=0 18 | # URL base 19 | RRSM_URL_BASE='' 20 | # Configuration for outliers filtering 21 | OUTLIER_FILTERING_ENABLED=True 22 | PGA_MIN=0.001 23 | PGA_MAX=980.6 24 | PGV_MIN=0.0001 25 | PGV_MAX=100 26 | PGV_BROADBAND_MIN=0.0001 27 | PGV_BROADBAND_MAX=1.3 28 | # Outlier flagging ratios 29 | RATIO_PGAX_PGAY_MIN=0.1 30 | RATIO_PGAX_PGAY_MAX=10 31 | RATIO_PGAX_PGAZ_MIN=0.1 32 | RATIO_PGAX_PGAZ_MAX=10 33 | RATIO_PGAY_PGAZ_MIN=0.1 34 | RATIO_PGAY_PGAZ_MAX=10 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 KNMI/RDSA 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/rrsm/rrsmi/tests/test_fdsn_manager.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | from rrsmi.fdsn.base_classes import MotionDataStationChannel 3 | from rrsmi.fdsn import fdsn_manager 4 | 5 | 6 | class FdsnManagerTests(TestCase): 7 | def setUp(self): 8 | self.motion_manager = fdsn_manager.FdsnMotionManager() 9 | 10 | def test_components_invalid(self): 11 | X = MotionDataStationChannel() 12 | Y = MotionDataStationChannel() 13 | Z = MotionDataStationChannel() 14 | result = None 15 | 16 | X.pga_value = 9.9 17 | Y.pga_value = 1 18 | Z.pga_value = 1 19 | components = { 20 | "X": X, 21 | "Y": Y, 22 | "Z": Z, 23 | } 24 | result = self.motion_manager._components_invalid(components) 25 | self.assertFalse(result) 26 | 27 | X.pga_value = 10 28 | Y.pga_value = 1 29 | Z.pga_value = 1 30 | components = { 31 | "X": X, 32 | "Y": Y, 33 | "Z": Z, 34 | } 35 | result = self.motion_manager._components_invalid(components) 36 | self.assertTrue(result) 37 | -------------------------------------------------------------------------------- /src/rrsm/templates/includes/form.html: -------------------------------------------------------------------------------- 1 | {% load form_tags widget_tweaks %} 2 | 3 | {% if form.non_field_errors %} 4 | 9 | {% endif %} 10 | 11 |
12 | {% for field in form %} 13 |
14 |
15 | {{ field.label_tag }} 16 |
17 |
18 | {% if form.is_bound %} 19 | {% render_field field class=field|input_class id=field.name %} 20 | {% for error in field.errors %} 21 |
22 | {{ error }} 23 |
24 | {% endfor %} 25 | {% else %} 26 | {% render_field field class=field|input_class %} 27 | {% endif %} 28 |
29 |
30 | {% if field.help_text %} 31 | 32 | {{ field.help_text|safe }} 33 | 34 | {% endif %} 35 |
36 |
37 | {% endfor %} 38 |
-------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Django", 9 | "type": "python", 10 | "request": "launch", 11 | "python": "${workspaceFolder}/env/bin/python3", 12 | "program": "${workspaceFolder}/src/rrsm/manage.py", 13 | "cwd": "${workspaceFolder}/src/rrsm", 14 | "env": { 15 | "SECRET_KEY": "abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)", 16 | "DEBUG": "True", 17 | "ALLOWED_HOSTS": "localhost,127.0.0.1", 18 | "DATABASE_URL": "sqlite:///db.sqlite3", 19 | "DATABASE_ENGINE": "django.db.backends.sqlite3", 20 | "DATABASE_NAME": "rrsm.db", 21 | "DATABASE_USER": "admin", 22 | "DATABASE_PASS": "passwd", 23 | "EMAIL_BACKEND": "django.core.mail.backends.console.EmailBackend", 24 | "CACHE_BACKEND": "django.core.cache.backends.filebased.FileBasedCache", 25 | "CACHE_LOCATION": "rrsm_cache", 26 | "CACHE_TIME_SHORT": "0", 27 | "CACHE_TIME_MEDIUM": "0", 28 | "CACHE_TIME_LONG": "0", 29 | "RRSM_URL_BASE": "" 30 | }, 31 | "args": ["runserver", "--noreload", "0.0.0.0:8000"], 32 | "django": true 33 | }, 34 | { 35 | "name": "Django Tests", 36 | "type": "python", 37 | "request": "launch", 38 | "program": "${workspaceFolder}/src/rrsm/manage.py", 39 | "args": ["test", "--noinput", "--keepdb", "rrsmi"], 40 | "django": true 41 | } 42 | 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore the sqlite db file 2 | rrsm.db 3 | 4 | # Byte-compiled / optimized / DLL files 5 | __pycache__/ 6 | *.py[cod] 7 | *$py.class 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | .static_storage/ 57 | .media/ 58 | local_settings.py 59 | 60 | # Flask stuff: 61 | instance/ 62 | .webassets-cache 63 | 64 | # Scrapy stuff: 65 | .scrapy 66 | 67 | # Sphinx documentation 68 | docs/_build/ 69 | 70 | # PyBuilder 71 | target/ 72 | 73 | # Jupyter Notebook 74 | .ipynb_checkpoints 75 | 76 | # pyenv 77 | .python-version 78 | 79 | # celery beat schedule file 80 | celerybeat-schedule 81 | 82 | # SageMath parsed files 83 | *.sage.py 84 | 85 | # Environments 86 | .env 87 | .venv 88 | env/ 89 | venv/ 90 | ENV/ 91 | env.bak/ 92 | venv.bak/ 93 | 94 | # Spyder project settings 95 | .spyderproject 96 | .spyproject 97 | 98 | # Rope project settings 99 | .ropeproject 100 | 101 | # mkdocs documentation 102 | /site 103 | 104 | # mypy 105 | .mypy_cache/ -------------------------------------------------------------------------------- /src/rrsm/static_rrsm/js/datatable/dataTables.bootstrap4.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | DataTables Bootstrap 3 integration 3 | ©2011-2015 SpryMedia Ltd - datatables.net/license 4 | */ 5 | (function(b){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(a){return b(a,window,document)}):"object"===typeof exports?module.exports=function(a,d){a||(a=window);if(!d||!d.fn.dataTable)d=require("datatables.net")(a,d).$;return b(d,a,a.document)}:b(jQuery,window,document)})(function(b,a,d,m){var f=b.fn.dataTable;b.extend(!0,f.defaults,{dom:"<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>", 6 | renderer:"bootstrap"});b.extend(f.ext.classes,{sWrapper:"dataTables_wrapper container-fluid dt-bootstrap4",sFilterInput:"form-control form-control-sm",sLengthSelect:"form-control form-control-sm",sProcessing:"dataTables_processing card",sPageButton:"paginate_button page-item"});f.ext.renderer.pageButton.bootstrap=function(a,h,r,s,j,n){var o=new f.Api(a),t=a.oClasses,k=a.oLanguage.oPaginate,u=a.oLanguage.oAria.paginate||{},e,g,p=0,q=function(d,f){var l,h,i,c,m=function(a){a.preventDefault();!b(a.currentTarget).hasClass("disabled")&& 7 | o.page()!=a.data.action&&o.page(a.data.action).draw("page")};l=0;for(h=f.length;l",{"class":t.sPageButton+" "+g,id:0===r&& 8 | "string"===typeof c?a.sTableId+"_"+c:null}).append(b("",{href:"#","aria-controls":a.sTableId,"aria-label":u[c],"data-dt-idx":p,tabindex:a.iTabIndex,"class":"page-link"}).html(e)).appendTo(d),a.oApi._fnBindAction(i,{action:c},m),p++)}},i;try{i=b(h).find(d.activeElement).data("dt-idx")}catch(v){}q(b(h).empty().html('