Add additional logging

develop
Chris Leaman 6 years ago
parent c6cbee8920
commit caee3e033a

@ -12,6 +12,7 @@ import logging.config
logging.config.fileConfig("./src/logging.conf", disable_existing_loggers=False) logging.config.fileConfig("./src/logging.conf", disable_existing_loggers=False)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@click.command() @click.command()
@click.option("--input-csv", required=True, help=".csv file to convert") @click.option("--input-csv", required=True, help=".csv file to convert")
@click.option("--output-shp", required=True, help="where to store .shp file") @click.option("--output-shp", required=True, help="where to store .shp file")
@ -22,7 +23,7 @@ def sites_csv_to_shp(input_csv, output_shp):
:param output_shp: :param output_shp:
:return: :return:
""" """
logger.info('Converting %s to %s', input_csv, output_shp) logger.info("Converting %s to %s", input_csv, output_shp)
df_sites = pd.read_csv(input_csv, index_col=[0]) df_sites = pd.read_csv(input_csv, index_col=[0])
schema = {"geometry": "Point", "properties": {"beach": "str", "site_id": "str"}} schema = {"geometry": "Point", "properties": {"beach": "str", "site_id": "str"}}
@ -31,7 +32,8 @@ def sites_csv_to_shp(input_csv, output_shp):
point = Point(row["lon"], row["lat"]) point = Point(row["lon"], row["lat"])
prop = {"beach": row["beach"], "site_id": index} prop = {"beach": row["beach"], "site_id": index}
output.write({"geometry": mapping(point), "properties": prop}) output.write({"geometry": mapping(point), "properties": prop})
logger.info('Done!') logger.info("Done!")
@click.group() @click.group()
def cli(): def cli():

Loading…
Cancel
Save