Exemple #1
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":
Exemple #2
0
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'))
Exemple #3
0
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).")
SWAGGER.add_parameter(
    'max_lat', 'query', float, description="Max latitude (-90 to 90).")