示例#1
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level2'],
         [],
         {"200": SWAGGER.get_type_response('level2_project', is_list=True)},
         summary="Get list of existing projects"
     )
示例#2
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level2'],
         ['project', 'product', 'min_lat', 'max_lat',
          'min_lon', 'max_lon', 'min_pressure', 'max_pressure',
          'min_altitude', 'max_altitude', 'start_time', 'end_time',
          'min_scanid', 'document_limit'],
         {
             "200": SWAGGER.get_type_response('L2', is_list=True),
             "400": SWAGGER.get_response('Level2BadQuery')
         },
         summary=(
             "Get data in provided area"),
         description=(
             "Get data for a certain area\n"
             "\n"
             "Provide latitude and/or longitude limits to get data for a "
             "certain area of the earth.\n"
             "\n"
             "If no latitude or longitude limits are provided, data for "
             "the whole earth is returned.\n"
             "\n"
             "Choose between min/max altitude and min/max pressure."
             "\n"
             "Example url parameters:\n"
             "\n"
             "    product=p1&product=p2&min_pressure=100&max_pressure=100&"
             "start_time=2015-10-11&end_time=2016-02-20&min_lat=-80&"
             "max_lat=-70&min_lon=150&max_lon=200")
     )
示例#3
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level2'],
         ['project', 'freqmode', 'scanno'],
         {"200": SWAGGER.get_type_response('L2i')},
         summary=(
             "Get level2 info for one scan and freqmode")
     )
示例#4
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level2'],
         ['project', 'freqmode', 'scanno', 'product'],
         {"200": SWAGGER.get_type_response('L2', is_list=True)},
         summary=(
             "Get level2 data for one scan and freqmode")
     )
示例#5
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level1'], ['date'], {
             "200":
             SWAGGER.get_type_response(
                 'freqmode_info', is_list=True, Date=str)
         },
         summary="Get scan counts for a day")
示例#6
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level2'],
         ['project', 'freqmode', 'offset', 'limit'],
         {"200": SWAGGER.get_type_response(
             'level2_scan_comment', is_list=True)},
         summary="Get list of comments for a freqmode"
     )
示例#7
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level2'],
         ['project'],
         {"200": SWAGGER.get_type_response(
             'level2_product_name', is_list=True)},
         summary=(
             "Get available products")
     )
示例#8
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level2'],
         ['project', 'freqmode', 'start_time', 'end_time',
          'comment', 'limit', 'offset'],
         {"200": SWAGGER.get_type_response(
             'level2_scan_info', is_list=True)},
         summary="Get list of matching scans"
     )
示例#9
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level2'],
         ['project'],
         {
             "200": SWAGGER.get_type_response(
                 'L2ProjectAnnotation', is_list=True
             )
         },
         summary='Get annotations for a project',
     )
示例#10
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level2'],
         ['project'],
         {
             "200": SWAGGER.get_type_response(
                 'level2_project_freqmode', is_list=True,
             )
         },
         summary="Get project information"
     )
示例#11
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level2'],
         ['project', 'freqmode', 'scanno'],
         {"200": SWAGGER.get_mixed_type_response(
             [
                 ('L2', True),
                 ('L2i', False),
                 ('L2c', True),
                 ('L2anc', True)])},
         summary=(
             "Get level2 data, info, comments, and ancillary data" +
             " for one scan and freqmode")
     )
示例#12
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level2'],
         ['project', 'date', 'product',
          'min_pressure', 'max_pressure', 'min_altitude', 'max_altitude',
          'min_scanid', 'document_limit'],
         {
             "200": SWAGGER.get_type_response('L2', is_list=True),
             "400": SWAGGER.get_response('Level2BadQuery')
         },
         summary=(
             "Get data for provided day"),
         description=(
             "Get data for a certain day\n"
             "\n"
             "Choose between min/max altitude and min/max pressure.\n"
             "\n"
             "Example query:\n"
             "\n"
             "    product=p1&product=p2&min_pressure=1000&max_pressure=1000"
         )
     )
示例#13
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level2'],
         ['project', 'product', 'location', 'radius',
          'min_pressure', 'max_pressure', 'min_altitude', 'max_altitude',
          'start_time', 'end_time', 'min_scanid', 'document_limit'],
         {
             "200": SWAGGER.get_type_response('L2', is_list=True),
             "400": SWAGGER.get_response('Level2BadQuery')
         },
         summary=(
             "Get data close to provided location"),
         description=(
             "Provide one or more locations and a radius to get "
             "data within the resulting circles on the earth surface.\n"
             "\n"
             "Choose between min/max altitude and min/max pressure.\n"
             "\n"
             "Example query:\n"
             "\n"
             "   product=p1&product=p2&min_pressure=100&max_pressure=1000&"
             "start_time=2015-10-11&end_time=2016-02-20&radius=100&"
             "location=-24.0,200.0&location=-30.0,210.0")
     )
示例#14
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level1'], ['freqmode', 'scanno', 'species', 'aprsource'],
         {"200": SWAGGER.get_type_response('apriori')},
         summary="Get apriori data for a scan and species")
示例#15
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level1'], ['freqmode', 'scanno'],
         {"200": SWAGGER.get_type_response('ptz')},
         summary="Get ptz data for a scan")
示例#16
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level1'], ['date', 'freqmode'],
         {"200": SWAGGER.get_type_response('Log', is_list=True)},
         summary="Get log info for scans in a day and freqmode")
示例#17
0
from odinapi.utils.defs import SPECIES
from .get_odinapi_info import get_config_data_files

from odinapi.views.baseview import register_versions, BaseView
from odinapi.views.urlgen import get_freqmode_raw_url
from odinapi.utils.defs import FREQMODE_TO_BACKEND
from odinapi.utils import time_util
from odinapi.utils.collocations import get_collocations
from odinapi.utils.swagger import SWAGGER
from odinapi.views.views_cached import get_scan_log_data
import odinapi.utils.get_args as get_args

# Make linter happy
use_agg

SWAGGER.add_parameter('date', 'path', str, string_format='date')
SWAGGER.add_type('freqmode_info', {
    'Backend': str,
    'FreqMode': int,
    'NumScan': int,
    'URL': str
})


class DateInfo(BaseView):
    """Get scan counts for a day"""
    @register_versions('swagger', ['v5'])
    def _swagger_def(self, version):
        return SWAGGER.get_path_definition(
            ['level1'], ['date'], {
                "200":
示例#18
0
 def _swagger_def(self, version):
     return SWAGGER.get_path_definition(
         ['level1'], ['freqmode', 'scanno'],
         {"200": SWAGGER.get_type_response('collocation', is_list=True)},
         summary="Get collocations for a scan")
示例#19
0
文件: api.py 项目: Odin-SMR/odin-api
from odinapi.views.level2 import (
    Level2Write, Level2ViewScan, Level2ViewLocations, Level2ViewDay,
    Level2ViewArea, Level2ViewProducts, Level2ViewProjects, Level2ViewProject,
    Level2ViewScans, Level2ViewFailedScans, Level2ViewComments, L2iView,
    L2cView, L2View, L2ancView, Level2ViewProductsFreqmode,
    Level2ProjectPublish, Level2ProjectAnnotations)
from odinapi.views.statistics import (FreqmodeStatistics,
                                      TimelineFreqmodeStatistics)
from odinapi.views.smr_site import (ViewIndex, ViewScanSpec, ViewLevel1,
                                    ViewLevel2, ViewLevel2Scan,
                                    ViewLevel2PeriodOverview, ViewLevel1Stats,
                                    ViewFreqmodeInfoPlot, ViewLevel2DevScan,
                                    ViewDataAccess)
from odinapi.views.data_info import FileInfo, LatestECMF

SWAGGER.add_parameter('freqmode', 'path', int)
SWAGGER.add_parameter('scanno', 'path', int)

DESCRIPTION = ("Odin rest api.\n\n"
               "Geographic coordinate system:\n\n"
               "* Latitude: -90 to 90\n"
               "* Longitude: 0 to 360")


class Odin(Flask):
    """The main app running the odin site"""
    def __init__(self, name):
        super(Odin, self).__init__(name)

        self.add_url_rule('/rest_api/<version>/config_data/data_files/',
                          view_func=ConfigDataFiles.as_view('configdatafiles'))
示例#20
0
import odinapi.utils.get_args as get_args


logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s %(levelname)s %(message)s',
)


DEFAULT_LIMIT = 1000
DOCUMENT_LIMIT = level2db.DOCUMENT_LIMIT
DOCUMENT_LIMIT_MIN = 1000
DEFAULT_OFFSET = 0
DEFAULT_MINSCANID = 0

SWAGGER.add_response('Level2BadQuery', "Unsupported query", {"Error": str})

SWAGGER.add_parameter('project', 'path', str)
SWAGGER.add_parameter(
    'radius', 'query', float, required=True,
    description=(
        "Return data within this radius from the provided locations (km).")
)
SWAGGER.add_parameter(
    'location', 'query', [str], required=True, collection_format="multi",
    description=(
        "Return data close to these locations (lat,lon). "
        "Example location: '-10.1,300.3'.")
)
SWAGGER.add_parameter(
    'min_lat', 'query', float, description="Min latitude (-90 to 90).")