Fix logging and cli
Logging now uses .yaml file and is stored in the utils.py file. New CLI entrypoint has been created cli.py to deal with relative import issues - when running the analysis, this should be used as the main entrypoint.develop
parent
8033df931c
commit
44b1ac3775
@ -1,15 +0,0 @@
|
||||
import pandas as pd
|
||||
import os
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
data_folder = "./data/interim"
|
||||
df_waves = pd.read_csv(os.path.join(data_folder, "waves.csv"), index_col=[0, 1])
|
||||
df_tides = pd.read_csv(os.path.join(data_folder, "tides.csv"), index_col=[0, 1])
|
||||
df_profiles = pd.read_csv(os.path.join(data_folder, "profiles.csv"), index_col=[0, 1, 2])
|
||||
df_sites = pd.read_csv(os.path.join(data_folder, "sites.csv"), index_col=[0])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -0,0 +1,29 @@
|
||||
"""
|
||||
Entry point to run data processing and analysis commands.
|
||||
"""
|
||||
|
||||
import click
|
||||
|
||||
import data.parse_mat as parse_mat
|
||||
import data.profile_features as profile_features
|
||||
import data.csv_to_shp as csv_to_shp
|
||||
import analysis.forecast_twl as forecast_twl
|
||||
import analysis.forecasted_storm_impacts as forecasted_storm_impacts
|
||||
import analysis.observed_storm_impacts as observed_storm_impacts
|
||||
|
||||
|
||||
@click.group()
|
||||
def cli():
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cli.add_command(parse_mat.create_waves_csv)
|
||||
cli.add_command(parse_mat.create_sites_and_profiles_csv)
|
||||
cli.add_command(parse_mat.create_tides_csv)
|
||||
cli.add_command(profile_features.create_profile_features)
|
||||
cli.add_command(csv_to_shp.sites_csv_to_shp)
|
||||
cli.add_command(forecast_twl.create_twl_forecast)
|
||||
cli.add_command(forecasted_storm_impacts.create_forecasted_impacts)
|
||||
cli.add_command(observed_storm_impacts.create_observed_impacts)
|
||||
cli()
|
@ -1,32 +0,0 @@
|
||||
[loggers]
|
||||
keys=root, matplotlib, fiona
|
||||
|
||||
[handlers]
|
||||
keys=consoleHandler
|
||||
|
||||
[formatters]
|
||||
keys=simpleFormatter
|
||||
|
||||
[logger_root]
|
||||
level=DEBUG
|
||||
handlers=consoleHandler
|
||||
|
||||
[logger_matplotlib]
|
||||
level=WARNING
|
||||
handlers=consoleHandler
|
||||
qualname=matplotlib
|
||||
|
||||
[logger_fiona]
|
||||
level=WARNING
|
||||
handlers=consoleHandler
|
||||
qualname=fiona
|
||||
|
||||
[handler_consoleHandler]
|
||||
class=StreamHandler
|
||||
level=INFO
|
||||
formatter=simpleFormatter
|
||||
args=(sys.stdout,)
|
||||
|
||||
[formatter_simpleFormatter]
|
||||
format=%(asctime)s %(name)-17s %(levelname)-8s %(message)s
|
||||
datefmt=%a, %d %b %Y %H:%M:%S
|
Loading…
Reference in New Issue