예제 #1
0
from osgeo import gdal
import sys
import pandas as pd

import common.config.config as config
from common.types import *

ACCESS_KEY = config.get_config_var("aws_s3", "access_key")
SECRET_KEY = config.get_config_var("aws_s3", "secret_key")


def get_id_from_coords(lat, lon):

    path = os.path.abspath("resources/volcanos.csv")

    all_volcanos = pd.read_csv(path)

    lats = all_volcanos['Latitude']

    lat_sorted = all_volcanos.ix[(lats - lat).abs().argsort()]
    lat_sorted = lat_sorted[:10]
    lat_sorted = lat_sorted.reset_index(drop=True)

    lons = lat_sorted['Longitude']

    lon_sorted = lat_sorted.ix[(lons - lon).abs().argsort()]

    return all_volcanos.loc[all_volcanos['Volcano Number'] ==
                            lon_sorted.iloc[0]['Volcano Number']]

예제 #2
0
from datetime import timedelta, timezone
import logging
from random import randint
import rasterio
import rasterio.plot as plot

from common.database import Database
from common.config import config
from common.types import *
from common.rsmas_logging import RsmasLogger, loglevel

import summary as summary
import image_manipulation as immanip
import image_saveing as save

ACCESS_KEY = config.get_config_var("aws_s3", "access_key")
SECRET_KEY = config.get_config_var("aws_s3", "secret_key")
BUCKET_NAME = config.get_config_var("aws_s3", "bucket_name")


def get_list_of_images():

    s3 = boto3.resource('s3',
                        aws_access_key_id=ACCESS_KEY,
                        aws_secret_access_key=SECRET_KEY)
    bucket = s3.Bucket(BUCKET_NAME)
    objects = list(bucket.objects.all())

    today = datetime.now(timezone.utc)
    delta = timedelta(days=-1)