Пример #1
0
import os
import pathlib
import shutil

# Midgard imports
from midgard.dev import plugins
from midgard import writers as mg_writers
from midgard.writers import names, write as write_one  # noqa

# Where imports
from where.lib import config
from where.lib import log
from where.data import dataset3 as dataset

# Add Where writers to Midgard writers
plugins.add_alias(mg_writers.__name__, __name__)


def write(default_dset):
    """Call all writers specified in the configuration

    The list of writers to use is taken from the config file of the given technique. Each writer is passed a
    :class:`~where.data.dataset.Dataset` with data for the modelrun and should write the relevant parts of the data to
    file.

    By default the last dataset for the default_stage is sent to the writer, but that is possible to override with the
    following notation:

        output = writer_1                 # Use default dataset
        output = writer_1:calculate       # Use last dataset of "calculate" stage
        output = writer_1:calculate/2     # Use dataset 2 of "calculate" stage
Пример #2
0
"""

# Midgard imports
from midgard.parsers import names, parse_file  # noqa
from midgard import parsers as mg_parsers
from midgard.dev import plugins
from midgard.files import dependencies

# Where imports
from where.lib import config
from where.lib import files
from where.lib import log

# Add Where parsers to Midgard parsers
plugins.add_alias(mg_parsers.__name__, __name__)


def setup_parser(parser_name=None, file_key=None, **kwargs):
    """Set up the given parser.

    Note that this only sets up the parser, no data will be read and parsed.

    It is possible to give file key instead of parser name. In that case the name of the parser will be read from the
    file list.

    TODO: This is the old style of running parsers, can be deleted when all parsers are new style.

    Args:
        parser_name (String):   Name of parser.
        file_key (String):      Used to look up parser in the Where file list.
Пример #3
0
"""Field types that can be used by Dataset

"""
# Midgard imports
from midgard.data.fieldtypes import names, function  # noqa
from midgard.data import fieldtypes as mg_fieldtypes
from midgard.dev import plugins

# Add Where fieldtypes to Midgard fieldtypes
plugins.add_alias(mg_fieldtypes.__name__, __name__)