Commit 0b5f3139 authored by Niklas Selke's avatar Niklas Selke
Browse files

modified the topography SRTM service

parent 3d7424c0
Pipeline #97151 passed with stages
in 54 seconds
"""serializer for topography SRTM data
"""
from collections import OrderedDict
import datetime as dt
from utils.agg_serializer import GeneralAggSerializer
......
from django.test import TestCase
from services.topography_srtm.serializers import AggSerializer
from services.topography_srtm.views import TopographyView
from services.topography_srtm.views import TopographySRTMView
import geo_location_services.settings as settings
from collections import OrderedDict
......@@ -18,15 +18,15 @@ class TestSerializers(TestCase):
('mean', 10),
])
serializer = AggSerializer(rawdata)
self.assertEqual(serializer.instance["unit"], 'm')
self.assertEqual(serializer.instance["unit"], "m")
self.assertEqual(serializer.instance["radius"], 5000)
class TestViews(TestCase):
def test_TopographyView(self):
view = TopographyView()
def test_TopographySRTMView(self):
view = TopographySRTMView()
self.assertEqual(view.min_valid, -500.)
self.assertEqual(view.max_valid, 9000)
self.assertEqual(view.max_valid, 9000.)
self.assertTrue(view.AggSerializer is AggSerializer)
self.assertListEqual(view.AGG_ALLOWED, ['mean', 'min', 'max', 'median', 'percentile', 'stddev'])
from django.urls import re_path
from .views import TopographyView
from .views import TopographySRTMView
urlpatterns = [
re_path(r'^$', TopographyView.as_view()),
re_path(r'^$', TopographySRTMView.as_view()),
]
......@@ -16,7 +16,7 @@ from .apps import TopographySRTMConfig as Config
# print("File %s successfully loaded" % FILENAME, datainfo)
class TopographyView(APIView, CommonViews):
class TopographySRTMView(APIView, CommonViews):
def __init__(self):
......@@ -25,10 +25,8 @@ class TopographyView(APIView, CommonViews):
min_valid=-500.,
max_valid=9000.,
serializer=AggSerializer,
service_type=Config.name
)
service_type=Config.name)
# providing `service_type` (and not `data`) will trigger a connection to Rasdaman
CommonViews.__init__(self, **opts)
self.remove_agg_allowed('sum')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment