Ejemplo n.º 1
0
from datetime import datetime
import logging
from subprocess import Popen
from sys import stdout

import click
from colorama import Fore, Style
from pathlib2 import Path

from spacetimegis import (
    app, settings
)

config = app.config
celery_app = settings.get_celery_app(config)

@app.cli.command()
def init():
    """Inits the spacetimegis application"""
    pass

def create_app(script_info=None):
    return app


def debug_run(app, port):
    return app.run(
        host='0.0.0.0',
        port=int(port),
        threaded=True,
Ejemplo n.º 2
0
# Created on 2019-05-06 08:30:56
# Author: javy@xu
# Email: [email protected]
# Description: create_samples.py
'''
import os
import os.path
import random
from PIL import Image
from .image_folder import is_image_file

from spacetimegis.settings import get_celery_app
from spacetimegis import app
from spacetimegis.utils.logging_mixin import logger

celery_app = get_celery_app(app.config)


def oversample_num(
        wind):  # return how many to oversample (according to wind level)
    if wind < 60:
        return 1
    if wind < 80:
        return 1 + random.randint(0, 1)
    if wind < 100:
        return 1 + random.randint(0, 2)
    return 1 + random.randint(0, 10)


def save_file(f, fname, f_root):  # oversample specific copies
    wind = int(fname.split('_')[4])
Ejemplo n.º 3
0
# Description: download_api.py
'''

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from flask import Blueprint, request

from spacetimegis.utils.logging_mixin import logger
from spacetimegis.settings import get_celery_app
from spacetimegis import app

config = app.config
celery_app = get_celery_app(config)

from .utils import json_result, image_success, task_progress

index_bp = Blueprint('index', __name__)


@index_bp.route('/', methods=['GET'])
def index():
    return json_result(200, msg='Hello Blueprint!')


@index_bp.route('/getimage', methods=['GET'])
def getimg():
    with open(
            '/Users/xujavy/Documents/Work/srccode/space-time-gis/examples_data/test_00.tif',