Beispiel #1
0
    def __init__(self, lib: ImportLib, product: Type[Product]):
        '''
        :param lib: Instance of the import-lib
        :param product: A radolan product
        '''

        if not is_known_product(product):
            raise ValueError("Unknown product")
        self.__product = product
        self.__dim_x, self.__dim_y = 900, 900
        if self.__product == SF:
            self.__dim_x, self.__dim_y = 900, 900
        if self.__product == RW:
            self.__dim_x, self.__dim_y = 900, 900

        self.__lib = lib
        self.__logger = get_logger(__name__)

        self.__proj_radolan = wradlib.georef.create_osr("dwd-radolan")
        self.__proj_ll = osr.SpatialReference()
        epsg = self.__lib.get_config("EPSG", 4326)
        self.__proj_ll.ImportFromEPSG(epsg)
        self.__epsg = epsg

        self.__bboxes = self.__lib.get_config("BBOXES", None)
        if not isinstance(self.__bboxes, List):
            self.__logger.error("Invalid config for BBOXES will not be used")
            self.__bboxes = None
        self.__ftp_loader = FtpLoader(product=self.__product)
        radolan_grid_xy = wradlib.georef.get_radolan_grid(
            self.__dim_x, self.__dim_y)
        self.__radolan_grid_ll = wradlib.georef.reproject(
            radolan_grid_xy,
            projection_source=self.__proj_radolan,
            projection_target=self.__proj_ll)
        self.__logger.debug("Preparing mask...")
        self.__mask = create_mask(self.__radolan_grid_ll, self.__bboxes)
Beispiel #2
0
#  See the License for the specific language governing permissions and
#  limitations under the License.

import time
from datetime import datetime

import schedule
from import_lib.import_lib import ImportLib, get_logger

from radolan_lib.radolan.Products import str_to_product
from radolan_lib.radolan.RadolanImport import RadolanImport

if __name__ == '__main__':

    lib = ImportLib()
    logger = get_logger(__name__)
    product = lib.get_config("PRODUCT", "SF")
    try:
        product = str_to_product(product)
    except ValueError as e:
        logger.error(e)
        logger.error("Can't run with this product name. Exiting!")
        quit(1)

    radolan_import = RadolanImport(lib, product=product)

    state, _ = lib.get_last_published_datetime()
    if state is None:
        logger.info("Import is starting fresh")
    else:
        logger.info("Import is continuing previous import")