|
|
@ -1,6 +1,6 @@
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
from functools import partial
|
|
|
|
from functools import partial
|
|
|
|
|
|
|
|
import click
|
|
|
|
import fiona
|
|
|
|
import fiona
|
|
|
|
import numpy as np
|
|
|
|
import numpy as np
|
|
|
|
import pandas as pd
|
|
|
|
import pandas as pd
|
|
|
@ -8,6 +8,11 @@ import pyproj
|
|
|
|
from shapely.geometry import LineString, Point
|
|
|
|
from shapely.geometry import LineString, Point
|
|
|
|
from shapely.geometry import shape
|
|
|
|
from shapely.geometry import shape
|
|
|
|
from shapely.ops import transform
|
|
|
|
from shapely.ops import transform
|
|
|
|
|
|
|
|
import logging.config
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logging.config.fileConfig("./src/logging.conf", disable_existing_loggers=False)
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def shapes_from_shp(shp_file):
|
|
|
|
def shapes_from_shp(shp_file):
|
|
|
@ -142,12 +147,26 @@ def parse_profile_features(df_sites, df_profiles, dune_crest_shp, dune_toe_shp):
|
|
|
|
return df_profile_features
|
|
|
|
return df_profile_features
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
@click.command(short_help='create .csv of dune toe and crest positions')
|
|
|
|
data_folder = "./data/interim"
|
|
|
|
@click.option("--dune-crest-shp", required=True, help=".csv file to convert")
|
|
|
|
df_sites = pd.read_csv(os.path.join(data_folder, "sites.csv"), index_col=[0])
|
|
|
|
@click.option("--dune-toe-shp", required=True, help="where to store .shp file")
|
|
|
|
df_profiles = pd.read_csv(os.path.join(data_folder, "profiles.csv"), index_col=[0, 1, 2])
|
|
|
|
@click.option("--sites-csv", required=True, help="where to store .shp file")
|
|
|
|
|
|
|
|
@click.option("--profiles-csv", required=True, help="where to store .shp file")
|
|
|
|
dune_crest_shp = "./data/raw/profile_features/dune_crests.shp"
|
|
|
|
@click.option("--output-csv", required=True, help="where to store .shp file")
|
|
|
|
dune_toe_shp = "./data/raw/profile_features/dune_toes.shp"
|
|
|
|
def create_profile_features(dune_crest_shp, dune_toe_shp, sites_csv, profiles_csv, output_csv):
|
|
|
|
|
|
|
|
logger.info("Creating .csv of dune crests and toes")
|
|
|
|
|
|
|
|
df_sites = pd.read_csv(sites_csv, index_col=[0])
|
|
|
|
|
|
|
|
df_profiles = pd.read_csv(profiles_csv, index_col=[0, 1, 2])
|
|
|
|
df_profile_features = parse_profile_features(df_sites, df_profiles, dune_crest_shp, dune_toe_shp)
|
|
|
|
df_profile_features = parse_profile_features(df_sites, df_profiles, dune_crest_shp, dune_toe_shp)
|
|
|
|
df_profile_features.to_csv("./data/interim/profile_features.csv")
|
|
|
|
df_profile_features.to_csv(output_csv)
|
|
|
|
|
|
|
|
logger.info("Done!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@click.group()
|
|
|
|
|
|
|
|
def cli():
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
|
|
|
cli.add_command(create_profile_features)
|
|
|
|
|
|
|
|
cli()
|
|
|
|