Пример #1
0
def raster_conf(dsn, global_config, ensemble_name, data_base=None):
    if data_base is None:
        data_base = '/' + ensemble_name
    root_url = global_config['data_root'].rstrip('/') + data_base + '/'
    with session_scope(dsn) as sesh:
        conf = db_raster_configurator(
            sesh, "Download Data", 0.1, 0, ensemble_name,
            root_url=root_url
        )
    return conf
Пример #2
0
def raster_conf(dsn, global_config, ensemble_name, data_base=None):
    if data_base is None:
        data_base = '/' + ensemble_name
    root_url = global_config['data_root'].rstrip('/') + data_base + '/'
    with session_scope(dsn) as sesh:
        conf = db_raster_configurator(sesh,
                                      "Download Data",
                                      0.1,
                                      0,
                                      ensemble_name,
                                      root_url=root_url)
    return conf
Пример #3
0
def test_db_raster_configurator(mm_session):
    args = [mm_session, "A name", "Version 0.0.0.1", "0.0", "bc_prism", "http://basalt.pcic.uvic.ca:8080/data/"]
    result = db_raster_configurator(*args)
    assert all(
        [
            x in result.items()
            for x in {
                "root_url": "http://basalt.pcic.uvic.ca:8080/data/",
                "name": "A name",
                "version": "Version 0.0.0.1",
                "ensemble": "bc_prism",
                "api_version": "0.0",
            }.items()
        ]
    )
Пример #4
0
def test_db_raster_configurator_handlers(mm_session):
    # Handlers must be tested seperately because they are a list and order cannot be guaranteed on database query
    args = [mm_session, "A name", "Version 0.0.0.1", "0.0", "bc_prism", "http://basalt.pcic.uvic.ca:8080/data/"]
    handlers = [
        {
            "url": "tmax_monClim_PRISM_historical_run1_197101-200012.nc",
            "file": "/home/data/climate/PRISM/dataportal/tmax_monClim_PRISM_historical_run1_197101-200012.nc",
        },
        {
            "url": "pr_monClim_PRISM_historical_run1_197101-200012.nc",
            "file": "/home/data/climate/PRISM/dataportal/pr_monClim_PRISM_historical_run1_197101-200012.nc",
        },
        {
            "url": "tmin_monClim_PRISM_historical_run1_197101-200012.nc",
            "file": "/home/data/climate/PRISM/dataportal/tmin_monClim_PRISM_historical_run1_197101-200012.nc",
        },
    ]
    result = db_raster_configurator(*args)
    assert all([x in result["handlers"] for x in handlers])