<commit_before>import datetime
import time
import ee
from flask import current_app, Blueprint, jsonify, request
from gfsad import limiter, create_app


gee = Blueprint('gee', __name__, url_prefix='/gee')

# initialize earth engine with service account credentials
def init_gee():
    ee.Initialize(ee.ServiceAccountCredentials(current_app.config['GOOGLE_SERVICE_ACCOUNT'],
                                               key_data=current_app.config['GOOGLE_API_KEY']))
    return ee


def extract_info(collection='MODIS/MOD13Q1', lat=31.74292, lon=-110.051375, date_start='2008-01-01',
                 date_end=datetime.date.today().isoformat()):
    collection = ee.ImageCollection(collection)
    filter = collection.filterDate(date_start, date_end)
    data = filter.select(['NDVI'])
    points = ee.Geometry.Point(lon, lat)
    results = data.getRegion(points, 231.65).getInfo()

    results_cleaned = []
    for line in results[1:]:
        results_cleaned.append(
            {'date': datetime.datetime.utcfromtimestamp(line[3] / 1000).isoformat().split('T', 1)[
                0], 'ndvi': line[4]})

    return results_cleaned


def add_ndvi_band(image):<commit_msg>different modis<commit_after>import datetime
import time
import ee
from flask import current_app, Blueprint, jsonify, request
from gfsad import limiter, create_app


gee = Blueprint('gee', __name__, url_prefix='/gee')

# initialize earth engine with service account credentials
def init_gee():
    ee.Initialize(ee.ServiceAccountCredentials(current_app.config['GOOGLE_SERVICE_ACCOUNT'],
                                               key_data=current_app.config['GOOGLE_API_KEY']))
    return ee


def extract_info(collection='MODIS/MOD13Q1', lat=31.74292, lon=-110.051375, date_start='2008-01-01',
                 date_end=datetime.date.today().isoformat()):
    collection = ee.ImageCollection(collection)
    collection = collection.map(lambda img: add_ndvi_band(img))
    filter = collection.filterDate(date_start, date_end)
    data = filter.select(['ndvi'])
    points = ee.Geometry.Point(lon, lat)
    results = data.getRegion(points, 231.65).getInfo()

    results_cleaned = []
    for line in results[1:]:
        results_cleaned.append(
            {'date': datetime.datetime.utcfromtimestamp(line[3] / 1000).isoformat().split('T', 1)[
                0], 'ndvi': line[4]})

    return results_cleaned


def add_ndvi_band(image):
{'fraction_non_alphanumeric': 0.12137531068765535, 'fraction_numerical': 0.03396851698425849, 'mean_word_length': 3.591254752851711, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5080142', 'n_tokens_mistral': 796, 'n_tokens_neox': 732, 'n_words': 146}