<gh_stars>1-10
"""
  cmds/cmd_preprocess.py

  FIT3162 - Team 10 - Final Year Computer Science Project
  Copyright <NAME>, <NAME>, <NAME> 2019
  
  Script to preprocess datasets by,
    - dropping columns
    - adding vicmap coordinates
    - adding environmental data from provided vector and rastor files
"""

import pandas as pd

from lib.transform import add_vic_coordinates
from lib.filter_columns import filter_columns
from lib.vector import ProcessPoints
from lib.add_env_data import add_columns


def preprocess(args):
    """
    :param args: the arguments parsed from the command line interface
    :return: the preprocessed dataset
    """
    if not args.outfile:
        print("Warning: Preprocessing data without an outfile is useless...")

    print("Reading csv...", flush=True)
    dataset = pd.read_csv(args.infile)
    print("Filtering columns...", flush=True)

    data = filter_columns(dataset)
    print("Adding vicmap coordinates", flush=True)
    data = add_vic_coordinates(data)

    print("Adding environmental data", flush=True)
    data = add_columns(data)

    if args.outfile:
        print("Writing to file...", flush=True)
        data.to_csv(args.outfile)

    print("Done", flush=True)
    return data

"""
  cmds/cmd_preprocess.py

  FIT3162 - Team 10 - Final Year Computer Science Project
  Copyright <NAME>, <NAME>, <NAME> 2019
  
  Script to preprocess datasets by,
    - dropping columns
    - adding vicmap coordinates
    - adding environmental data from provided vector and rastor files
"""

import pandas as pd

from lib.transform import add_vic_coordinates
from lib.filter_columns import filter_columns
from lib.vector import ProcessPoints
from lib.add_env_data import add_columns


def preprocess(args):
    """
    :param args: the arguments parsed from the command line interface
    :return: the preprocessed dataset
    """
    if not args.outfile:
        print("Warning: Preprocessing data without an outfile is useless...")

    print("Reading csv...", flush=True)
    dataset = pd.read_csv(args.infile)
    print("Filtering columns...", flush=True)

    data = filter_columns(dataset)
    print("Adding vicmap coordinates", flush=True)
    data = add_vic_coordinates(data)

    print("Adding environmental data", flush=True)
    data = add_columns(data)

    if args.outfile:
        print("Writing to file...", flush=True)
        data.to_csv(args.outfile)

    print("Done", flush=True)
    return data
cmds/cmd_preprocess.py    FIT3162 - Team 10 - Final Year Computer Science Project   Copyright <NAME>, <NAME>, <NAME> 2019      Script to preprocess datasets by,     - dropping columns     - adding vicmap coordinates     - adding environmental data from provided vector and rastor files :param args: the arguments parsed from the command line interface     :return: the preprocessed dataset