Update title in file headings. Slight change to ArmorLineToTrans_PD. Sort values in print.

parent 4f88deb3
# -*- coding: utf-8 -*-
"""
Standard values for CoastalVarExtractor.
Standard values for bi-transect-extractor.
They should not need to be changed except to include more site value mappings.
They do not require any input values.
"""
......
# -*- coding: utf-8 -*-
#! python3
'''
Barrier Island Geomorphology Extraction along transects (BI-geomorph-extraction module)
Barrier Island Geomorphology Extraction along transects (bi-transect-extractor module)
Author: Emily Sturdivant
email: esturdivant@usgs.gov;
......@@ -94,8 +94,10 @@ def join_columns_id_check(df1, df2, id_fld='ID', how='outer', fill=-99999):
"""Join columns after performing QC on ID field."""
# If both DFs should be joined on index field, must remove duplicate names
# If one should be joined on index and the other not, must remove one of the
if not 'SplitSort' in df1.columns: # Should this be hard-coded as 'SplitSort'? Should it be id_fld instead?
if not id_fld in df1.columns: # Should this be hard-coded as 'SplitSort'? Should it be id_fld instead?
print('...checking ID field(s) for df1 (target)...')
check_id_fld(df1, id_fld)
print('...checking ID field(s) for df2 (join)...')
check_id_fld(df2, id_fld)
df1 = df1.drop(df1.axes[1].intersection(df2.axes[1]), axis=1, errors='ignore') # remove matching columns from target dataframe
df1 = df1.join(df2, how=how)
......@@ -423,7 +425,7 @@ def report_fc_values(df, field_defs, xmlfile, fill=-99999):
elif field_defs[fld]['type'] == 'enumerated':
# for val in ptscol.unique():
# eavals += enum_xml.format(val, field_defs['enum_domain'][val], field_defs['producer'])
print('{:.<20} {:}'.format(fld, ' | '.join(str(x) for x in sorted(ptscol.unique()))))
print('{:.<20} {:}'.format(fld, ' | '.join((x) for x in sorted(ptscol.astype(str).unique()))))
eainfo += '<attr>xxx{}xxx</attr>'.format(fld)
# Unique domain fields
elif field_defs[fld]['type'] == 'unique':
......
# -*- coding: utf-8 -*-
#! python3
'''
Barrier Island Geomorphology Extraction along transects (BI-geomorph-extraction module)
Barrier Island Geomorphology Extraction along transects (bi-transect-extractor module)
Author: Emily Sturdivant
email: esturdivant@usgs.gov;
......@@ -17,7 +17,6 @@ from operator import add
import sys
import arcpy
import core.functions as fun
import time
"""
# General use functions
......@@ -860,7 +859,7 @@ def ArmorLineToTrans_PD(in_trans, armorLines, sl2trans_df, tID_fld, proj_code, e
2. Extract the elevation value at each intersection point from the DEM (Extract Multi Values to Points tool from Spatial Analyst);
"""
#FIXME: How do I know which point will be encountered first? - don't want those in back to take the place of
arm2trans = os.path.join(arcpy.env.scratchGDB, "arm2trans")
arm2trans = os.path.join(arcpy.env.scratchGDB, "arm2trans{}".format(time.strftime("%H%M%S", time.gmtime())))
flds = ['Arm_x', 'Arm_y', 'Arm_z']
if not arcpy.Exists(armorLines) or not int(arcpy.GetCount_management(armorLines).getOutput(0)):
print('\nArmoring file either missing or empty so we will proceed without armoring data. If shorefront tampering is present at this site, cancel the operations to digitize.')
......@@ -868,9 +867,12 @@ def ArmorLineToTrans_PD(in_trans, armorLines, sl2trans_df, tID_fld, proj_code, e
else:
# Create armor points with XY fields
arcpy.Intersect_analysis((armorLines, in_trans), arm2trans+'_multi', output_type='POINT')
print('Getting elevation of beach armoring by extracting elevation values to arm2trans points.')
print('Getting elevation of beach armoring by extracting elevation values to arm2trans points...')
print('...MultipartToSinglepart_management...')
arcpy.MultipartToSinglepart_management(arm2trans+'_multi', arm2trans)
print('...ExtractMultiValuesToPoints...')
arcpy.sa.ExtractMultiValuesToPoints(arm2trans, [[elevGrid_5m, 'Arm_z']])
print('...FCtoDF...')
df = FCtoDF(arm2trans, xy=True, dffields=[tID_fld, 'Arm_z'])
df.index = df.pop(tID_fld)
df.rename(columns={'SHAPE@X':'Arm_x','SHAPE@Y':'Arm_y'}, inplace=True)
......
'''
Configuration file for DeepDive Transect Extraction (CoastalVarExtractor module)
Configuration file for bi-transect-extractor
Author: Emily Sturdivant
email: esturdivant@usgs.gov;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment