示例#1
0
文件: gibs.py 项目: up42/modis
import mercantile
import pytz
import rasterio as rio
import requests
import xmltodict
from dateutil import parser
from requests import Response
from shapely.geometry import box
from rasterio.enums import ColorInterp

from blockutils.exceptions import SupportedErrors, UP42Error
from blockutils.logging import get_logger
from blockutils.stac import STACQuery

logger = get_logger(__name__)


class WMTSException(Exception):
    pass


def move_dates_to_past(date_points: list) -> list:
    """
    Moves dates to the past counting backwards from yesterday if the requested date range extends
    into the future
    Args:
        date_strings -- list of dates

    Returns:
        list of dates
import warnings

import numpy as np
from geojson import FeatureCollection
import rasterio
from rasterio.windows import Window
from rasterio import Affine as A
import pyproj as proj
from blockutils.blocks import ProcessingBlock
from blockutils.logging import get_logger
from blockutils.common import load_metadata
from blockutils.stac import STACQuery
from blockutils.exceptions import UP42Error, SupportedErrors

warnings.filterwarnings(action="ignore", category=FutureWarning)
LOGGER = get_logger(__name__)

# This code is adapted from this repository
# https://github.com/lanha/DSen2 and is distributed under the same
# license.


class Superresolution(ProcessingBlock):
    """
    This class implements a CNN model to obtain a high resolution (10m)
    bands for 20m and 60m resolution.
    """
    def __init__(
        self,
        params: STACQuery,
        output_dir: str = "/tmp/output/",