from pathlib import Path
from dateutil.tz import tzutc
from dateutil.relativedelta import relativedelta
import click

from sqlalchemy.exc import DBAPIError

from datacube.ui import click as ui
from datacube.ui.click import CLICK_SETTINGS
from datacube.model import Range
from datacube.ingest import index_datasets, store_datasets
from datacube.storage.storage import stack_storage_units
from datacube.storage import tile_datasets_with_storage_type

PASS_INDEX = ui.pass_index(app_name='datacube-ingest')


@click.group(help="Data Management Tool", context_settings=CLICK_SETTINGS)
@ui.global_cli_options
def cli():
    pass


@cli.command('stack', help='Stack storage units')
@ui.executor_cli_options
@click.argument('types', nargs=-1)
@PASS_INDEX
def stack(index, executor, types):
    if not types:
        storage_types = index.storage.types.get_all()
Beispiel #2
0
"""

import csv
import datetime
import sys
from functools import partial

import click
from dateutil import tz
from psycopg2._range import Range
from functools import singledispatch

from datacube.ui import click as ui
from datacube.ui.click import CLICK_SETTINGS

PASS_INDEX = ui.pass_index('datacube-search')


def printable_values(d):
    return {k: printable(v) for k, v in d.items()}


def write_pretty(out_f,
                 field_names,
                 search_results,
                 terminal_size=click.get_terminal_size()):
    """
    Output in a human-readable text format. Inspired by psql's expanded output.
    """
    terminal_width = terminal_size[0]
    record_num = 1
Beispiel #3
0
from pathlib import Path
from dateutil.tz import tzutc
from dateutil.relativedelta import relativedelta
import click

from sqlalchemy.exc import DBAPIError

from datacube.ui import click as ui
from datacube.ui.click import CLICK_SETTINGS
from datacube.model import Range
from datacube.ingest import index_datasets, store_datasets
from datacube.storage.storage import stack_storage_units
from datacube.storage import tile_datasets_with_storage_type

PASS_INDEX = ui.pass_index(app_name='datacube-ingest')


@click.group(help="Data Management Tool", context_settings=CLICK_SETTINGS)
@ui.global_cli_options
def cli():
    pass


@cli.command('stack', help='Stack storage units')
@ui.executor_cli_options
@click.argument('types', nargs=-1)
@PASS_INDEX
def stack(index, executor, types):
    if not types:
        storage_types = index.storage.types.get_all()
Beispiel #4
0
from pathlib import Path
import yaml

import click
from click import echo

from datacube.index import index_connect
from datacube.ui import read_documents
from datacube.ui.click import global_cli_options, pass_index, pass_config, CLICK_SETTINGS

USER_ROLES = ('user', 'ingest', 'manage', 'admin')

_LOG = logging.getLogger(__name__)

PASS_INDEX = pass_index(app_name='datacube-config')


@click.group(help="Configure the Data Cube", context_settings=CLICK_SETTINGS)
@global_cli_options
def cli():
    pass


@cli.group(help='Initialise the database')
def database():
    pass


@database.command('init', help='Initialise the database')
@click.option(
import csv
import datetime
import sys
from functools import partial

import click
from dateutil import tz
from psycopg2._range import Range
from singledispatch import singledispatch

from datacube.ui import click as ui
from datacube.ui.click import CLICK_SETTINGS
from datacube.ui.expression import parse_expressions

PASS_INDEX = ui.pass_index('datacube-search')


def printable_values(d):
    return {k: printable(v) for k, v in d.items()}


def write_pretty(out_f, field_names, search_results, terminal_size=click.get_terminal_size()):
    """
    Output in a human-readable text format. Inspired by psql's expanded output.
    """
    terminal_width = terminal_size[0]
    record_num = 1

    field_header_width = max(map(len, field_names))
    field_output_format = '{:<' + str(field_header_width) + '} | {}'