Skip to content

Commit

Permalink
path and xml updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jtgilbert authored and philipbaileynar committed Feb 13, 2024
1 parent f773a87 commit 727f93b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
1 change: 0 additions & 1 deletion packages/rme/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"{env:DATA_ROOT}/vbet/${input:HUC}/outputs/vbet.gpkg/vbet_centerlines",
"{env:DATA_ROOT}/rs_context/${input:HUC}/topography/dem.tif",
"{env:DATA_ROOT}/rs_context/${input:HUC}/topography/dem_hillshade.tif",
"{env:DATA_ROOT}/rs_context/${input:HUC}/climate/precipitation.tif",
//"{env:DATA_ROOT}/rs_context/${input:HUC}/transportation/roads.shp",
//"{env:DATA_ROOT}/rs_context/${input:HUC}/transportation/railways.shp",
//"{env:DATA_ROOT}/rs_context/${input:HUC}/ecoregions/ecoregions.shp",
Expand Down
2 changes: 1 addition & 1 deletion packages/rme/rme/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.6.4"
__version__ = "0.6.5"
2 changes: 2 additions & 0 deletions packages/rme/rme/layer_descriptions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"JUNCTION_POINTS": ["Points where flowlines converge or diverge","",""],
"RME_DGO": ["Discrete geographic objects (DGO) polygon geometries for storing RME attributes","",""],
"RME_IGO": ["Integrated geographic objects (IGO) point geometries for storing RME moving window attributes","",""],
"DGO_METRICS": ["Riverscape metrics summarized within and attributed onto discrete geographic object (DGO) polygons","",""],
"IGO_METRICS": ["Riverscape metrics summarized onto integrated geographic objects (IGO) points using a moving window analysis","",""],
"DGO_MEASUREMENTS": ["Measurements taken from DEM input stored for each DGO","",""]
Expand Down
21 changes: 10 additions & 11 deletions packages/rme/rme/metric_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
# 'OWNERSHIP': RSLayer('Ownership', 'OWNERSHIP', 'Vector', 'ownership'),
# 'STATES': RSLayer('States', 'STATES', 'Vector', 'states'),
'COUNTIES': RSLayer('Counties', 'COUNTIES', 'Vector', 'counties'),
'VBET_DGOS': RSLayer('Vbet DGOs', 'VBET_DGOS', 'Vector', 'dgos'),
'VBET_IGOS': RSLayer('Vbet IGOs', 'VBET_IGOS', 'Vector', 'igos'),
'VBET_DGOS': RSLayer('Vbet DGOs', 'VBET_DGOS', 'Vector', 'vbet_dgos'),
'VBET_IGOS': RSLayer('Vbet IGOs', 'VBET_IGOS', 'Vector', 'vbet_igos'),
'VBET_CENTERLINES': RSLayer('VBET Centerline', 'VBET_CENTERLINE', 'Vector', 'valley_centerlines'),
# 'ECOREGIONS': RSLayer('Ecoregions', 'ECOREGIONS', 'Vector', 'ecoregions'),
# 'ROADS': RSLayer('Roads', 'Roads', 'Vector', 'roads'),
Expand All @@ -70,11 +70,12 @@
}),
'DEM': RSLayer('DEM', 'DEM', 'Raster', 'inputs/dem.tif'),
'HILLSHADE': RSLayer('Hillshade', 'HILLSHADE', 'Raster', 'inputs/hillshade.tif'),
'PPT': RSLayer('Precipitation', 'Precip', 'Raster', 'inputs/precipitation.tif'),
'INTERMEDIATES': RSLayer('Intermediates', 'INTERMEDIATES', 'Geopackage', 'intermediates/rme_intermediates.gpkg', {
'JUNCTION_POINTS': RSLayer('Junction Points', 'JUNCTION_POINTS', 'Vector', 'junction_points'),
}),
'RME_OUTPUTS': RSLayer('Riverscapes Metrics', 'RME_OUTPUTS', 'Geopackage', 'outputs/riverscapes_metrics.gpkg', {
'RME_DGO': RSLayer('RME DGO', 'RME_DGO', 'Vector', 'dgos'),
'RME_IGO': RSLayer('RME IGO', 'RME_IGO', 'Vector', 'igos'),
'DGO_METRICS': RSLayer('DGO Metrics', 'DGO_METRICS', 'Vector', 'vw_dgo_metrics'),
'IGO_METRICS': RSLayer('IGO Metrics', 'IGO_METRICS', 'Vector', 'vw_igo_metrics'),
'DGO_MEASUREMENTS': RSLayer('DGO Measurements', 'DGO_MEASUREMENTS', 'Vector', 'vw_measurements')
Expand All @@ -91,7 +92,7 @@


def metric_engine(huc: int, in_flowlines: Path, in_vaa_table: Path, in_counties: Path, in_segments: Path, in_points: Path,
in_vbet_centerline: Path, in_dem: Path, in_hillshade: Path, in_ppt: Path, project_folder: Path,
in_vbet_centerline: Path, in_dem: Path, in_hillshade: Path, project_folder: Path,
in_confinement_dgos: Path = None, in_anthro_dgos: Path = None, in_rcat_dgos: Path = None, level_paths: list = None, meta: dict = None):
"""Generate Riverscapes Metric Engine project and calculate metrics
Expand All @@ -103,7 +104,6 @@ def metric_engine(huc: int, in_flowlines: Path, in_vaa_table: Path, in_counties:
in_points (Path): vbet segmentation points
in_vbet_centerline (Path): vbet centerlines
in_dem (Path): input dem raster
in_ppt (Path): input prism precpitation raster
project_folder (Path): output folder for RME project
level_paths (list, optional): level paths to process. Defaults to None.
meta (dict, optional): key-value pairs of metadata. Defaults to None.
Expand Down Expand Up @@ -164,15 +164,17 @@ def metric_engine(huc: int, in_flowlines: Path, in_vaa_table: Path, in_counties:
copy_feature_class(in_flowlines, flowlines)
counties_f = os.path.join(inputs_gpkg, LayerTypes['INPUTS'].sub_layers['COUNTIES'].rel_path)
copy_feature_class(in_counties, counties_f)
segments = os.path.join(outputs_gpkg, LayerTypes['INPUTS'].sub_layers['VBET_DGOS'].rel_path)
segments = os.path.join(outputs_gpkg, LayerTypes['RME_OUTPUTS'].sub_layers['RME_DGO'].rel_path)
copy_feature_class(in_segments, os.path.join(inputs_gpkg, LayerTypes['INPUTS'].sub_layers['VBET_DGOS'].rel_path))
copy_feature_class(in_segments, segments)
points = os.path.join(outputs_gpkg, LayerTypes['INPUTS'].sub_layers['VBET_IGOS'].rel_path)
points = os.path.join(outputs_gpkg, LayerTypes['RME_OUTPUTS'].sub_layers['RME_IGO'].rel_path)
copy_feature_class(in_points, os.path.join(inputs_gpkg, LayerTypes['INPUTS'].sub_layers['VBET_IGOS'].rel_path))
copy_feature_class(in_points, points)
centerlines = os.path.join(inputs_gpkg, LayerTypes['INPUTS'].sub_layers['VBET_CENTERLINES'].rel_path)
copy_feature_class(in_vbet_centerline, centerlines)
_dem_node, dem = project.add_project_raster(proj_nodes['Inputs'], LayerTypes['DEM'], in_dem)
_hs_node, hillshade = project.add_project_raster(proj_nodes['Inputs'], LayerTypes['HILLSHADE'], in_hillshade)
_ppt_node, ppt = project.add_project_raster(proj_nodes['Inputs'], LayerTypes['PPT'], in_ppt)

in_gpkg_node, *_ = project.add_project_geopackage(proj_nodes['Inputs'], LayerTypes['INPUTS'])
if in_confinement_dgos:
confinement_dgos = os.path.join(inputs_gpkg, 'confinement_dgo')
Expand Down Expand Up @@ -1667,7 +1669,6 @@ def main():
help='vbet centerline feature class')
parser.add_argument('dem', help='dem')
parser.add_argument('hillshade', help='hillshade')
parser.add_argument('ppt', help='Precipitation Raster')
parser.add_argument('output_folder', help='Output folder', type=str)
parser.add_argument('--confinement_dgos',
help='confinement dgos', type=str)
Expand Down Expand Up @@ -1703,7 +1704,6 @@ def main():
args.valley_centerline,
args.dem,
args.hillshade,
args.ppt,
args.output_folder,
args.confinement_dgos,
args.anthro_dgos,
Expand All @@ -1721,7 +1721,6 @@ def main():
args.valley_centerline,
args.dem,
args.hillshade,
args.ppt,
args.output_folder,
args.confinement_dgos,
args.anthro_dgos,
Expand Down
5 changes: 2 additions & 3 deletions packages/rme/rme/rme_rs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
'counties': 'Counties',
'DEM': 'DEM',
'HILLSHADE': 'HILLSHADE',
'Precip': 'Precip',
'dgos': 'vbet_dgos',
'igos': 'vbet_igos',
'vbet_dgos': 'vbet_dgos',
'vbet_igos': 'vbet_igos',
'valley_centerlines': 'vbet_centerlines',
# 'confinement_dgo': 'confinement_dgos',
'anthro_dgo': 'vwDgos',
Expand Down
3 changes: 1 addition & 2 deletions scripts/automation/FargateRME.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ RME_DIR=$DATA_DIR/output/rme

# Get the RSCli project we need to make this happen
rscli download $RS_CONTEXT_DIR --id $RSCONTEXT_ID \
--file-filter "(nhdplushr\.gpkg|hydro_derivatives\.gpkg|dem.tif|dem_hillshade.tif|precipitation.tif|political_boundaries|project_bounds.geojson)" \
--file-filter "(nhdplushr\.gpkg|hydro_derivatives\.gpkg|dem.tif|dem_hillshade.tif|political_boundaries|project_bounds.geojson)" \
--no-input --no-ui --verbose

rscli download $VBET_DIR --id $VBET_ID \
Expand Down Expand Up @@ -112,7 +112,6 @@ try() {
$VBET_DIR/outputs/vbet.gpkg/vbet_centerlines \
$RS_CONTEXT_DIR/topography/dem.tif \
$RS_CONTEXT_DIR/topography/dem_hillshade.tif \
$RS_CONTEXT_DIR/climate/precipitation.tif \
$RME_DIR \
--anthro_dgos $ANTHRO_DIR/outputs/anthro.gpkg/vwDgos \
--rcat_dgos $RCAT_DIR/outputs/rcat.gpkg/vwDgos \
Expand Down

0 comments on commit 727f93b

Please sign in to comment.