diff --git a/lib/commons/rscommons/__version__.py b/lib/commons/rscommons/__version__.py index 56dadec6e..bde00312c 100644 --- a/lib/commons/rscommons/__version__.py +++ b/lib/commons/rscommons/__version__.py @@ -1 +1 @@ -__version__ = "1.4.5" +__version__ = "1.4.6" diff --git a/packages/anthro/anthro/__version__.py b/packages/anthro/anthro/__version__.py index bbab0242f..d3ec452c3 100644 --- a/packages/anthro/anthro/__version__.py +++ b/packages/anthro/anthro/__version__.py @@ -1 +1 @@ -__version__ = "0.1.4" +__version__ = "0.2.0" diff --git a/packages/anthro/anthro/anthro.py b/packages/anthro/anthro/anthro.py index 66d0f96bc..23a34ab91 100644 --- a/packages/anthro/anthro/anthro.py +++ b/packages/anthro/anthro/anthro.py @@ -19,7 +19,7 @@ from rscommons import Logger, initGDALOGRErrors, RSLayer, RSProject, ModelConfig, dotenv from rscommons.database import create_database, SQLiteCon from rscommons.copy_features import copy_features_fields -from rscommons.moving_window import get_moving_windows, moving_window_dgo_ids +from rscommons.moving_window import moving_window_dgo_ids from rscommons.augment_lyr_meta import augment_layermeta, add_layer_descriptions, raster_resolution_meta from anthro.utils.conflict_attributes import conflict_attributes diff --git a/packages/anthro/anthro/utils/igo_vegetation.py b/packages/anthro/anthro/utils/igo_vegetation.py index 3209f10c5..dad04c2b8 100644 --- a/packages/anthro/anthro/utils/igo_vegetation.py +++ b/packages/anthro/anthro/utils/igo_vegetation.py @@ -44,7 +44,8 @@ def igo_vegetation(windows: dict, landuse_raster: str, out_gpkg_path: str): for dgo_ftr, *_ in dgo_lyr.iterate_features(): dgoid = dgo_ftr.GetFID() dgo_ogr = dgo_ftr.GetGeometryRef() - dgo_geom = VectorBase.ogr2shapely(dgo_ogr) + dgo_g = VectorBase.ogr2shapely(dgo_ogr) + dgo_geom = dgo_g.buffer(geo_transform[1] / 2) # buffer by raster resolution to ensure we get all cells try: raw_raster = mask(src, [dgo_geom], crop=True)[0] mask_raster = np.ma.masked_values(raw_raster, src.nodata) diff --git a/packages/anthro/database/anthro_schema.sql b/packages/anthro/database/anthro_schema.sql index 9710ab44d..45f2fe596 100644 --- a/packages/anthro/database/anthro_schema.sql +++ b/packages/anthro/database/anthro_schema.sql @@ -61,8 +61,6 @@ CREATE TABLE IGOAttributes ( LevelPathI REAL, seg_distance REAL, stream_size INTEGER, - window_area REAL, - window_length REAL, LUI REAL, Road_len REAL, Road_dens REAL, @@ -83,15 +81,10 @@ CREATE TABLE DGOAttributes ( segment_area REAL, LUI REAL, Road_len REAL, - Road_dens REAL, Rail_len REAL, - Rail_dens REAL, Canal_len REAL, - Canal_dens REAL, RoadX_ct INTEGER, - RoadX_dens REAL, - DivPts_ct INTEGER, - DivPts_dens REAL); + DivPts_ct INTEGER); CREATE TABLE ReachAttributes ( ReachID INTEGER PRIMARY KEY NOT NULL, diff --git a/packages/rcat/.vscode/launch.json b/packages/rcat/.vscode/launch.json index 591361005..bf56f200a 100644 --- a/packages/rcat/.vscode/launch.json +++ b/packages/rcat/.vscode/launch.json @@ -24,6 +24,7 @@ "${input:HUC}", "{env:DATA_ROOT}/rs_context/${input:HUC}/vegetation/existing_veg.tif", "{env:DATA_ROOT}/rs_context/${input:HUC}/vegetation/historic_veg.tif", + "{env:DATA_ROOT}/rs_context/${input:HUC}/topography/dem_hillshade.tif", "{env:DATA_ROOT}/taudem/${input:HUC}/intermediates/pitfill.tif", "{env:DATA_ROOT}/anthro/${input:HUC}/outputs/anthro.gpkg/vwIgos", "{env:DATA_ROOT}/anthro/${input:HUC}/outputs/anthro.gpkg/vwDgos", diff --git a/packages/rcat/rcat/__version__.py b/packages/rcat/rcat/__version__.py index 6ed01825f..f5f41e567 100644 --- a/packages/rcat/rcat/__version__.py +++ b/packages/rcat/rcat/__version__.py @@ -1 +1 @@ -__version__ = "3.0.6" +__version__ = "3.1.0" diff --git a/packages/rcat/rcat/rcat.py b/packages/rcat/rcat/rcat.py index 1692884b2..f3fd748a9 100644 --- a/packages/rcat/rcat/rcat.py +++ b/packages/rcat/rcat/rcat.py @@ -44,6 +44,7 @@ LYR_DESCRIPTIONS_JSON = os.path.join(os.path.dirname(__file__), 'layer_descriptions.json') LayerTypes = { + 'HILLSHADE': RSLayer('Hillshade', 'HILLSHADE', 'Raster', 'inputs/hillshade.tif'), 'EXVEG': RSLayer('Existing Vegetation', 'EXVEG', 'Raster', 'inputs/existing_veg.tif'), 'HISTVEG': RSLayer('Historic Vegetation', 'HISTVEG', 'Raster', 'inputs/historic_veg.tif'), 'EXRIPARIAN': RSLayer('Existing Riparian', 'EXRIPARIAN', 'Raster', 'intermediates/ex_riparian.tif'), @@ -79,7 +80,7 @@ } -def rcat(huc: int, existing_veg: Path, historic_veg: Path, pitfilled: Path, igo: Path, dgo: Path, +def rcat(huc: int, existing_veg: Path, historic_veg: Path, hillshade: Path, pitfilled: Path, igo: Path, dgo: Path, reaches: Path, roads: Path, rails: Path, canals: Path, valley: Path, output_folder: Path, flow_areas: Path, waterbodies: Path, meta: Dict[str, str]): @@ -104,6 +105,7 @@ def rcat(huc: int, existing_veg: Path, historic_veg: Path, pitfilled: Path, igo: log.info('Adding input rasters to project') _prj_existing_path_node, prj_existing_path = project.add_project_raster(proj_nodes['Inputs'], LayerTypes['EXVEG'], existing_veg) _prj_historic_path_node, prj_historic_path = project.add_project_raster(proj_nodes['Inputs'], LayerTypes['HISTVEG'], historic_veg) + project.add_project_raster(proj_nodes['Inputs'], LayerTypes['HILLSHADE'], hillshade) project.add_project_raster(proj_nodes['Inputs'], LayerTypes['PITFILL'], pitfilled) project.add_project_geopackage(proj_nodes['Inputs'], LayerTypes['INPUTS']) @@ -381,6 +383,7 @@ def main(): parser.add_argument('huc', help='HUC identifier', type=str) parser.add_argument('existing_veg', help='National existing vegetation raster', type=str) parser.add_argument('historic_veg', help='National historic vegetation raster', type=str) + parser.add_argument('hillshade', help='Hillshade raster', type=str) parser.add_argument('pitfilled', help='Pit filled DEM raster', type=str) parser.add_argument('igo', help='Integrated geographic object with anthro attributes', type=str) parser.add_argument('dgo', help='Discrete geographic objects', type=str) @@ -410,14 +413,14 @@ def main(): from rscommons.debug import ThreadRun memfile = os.path.join(args.output_dir, 'rcat_mem.log') retcode, max_obj = ThreadRun(rcat, memfile, args.huc, - args.existing_veg, args.historic_veg, args.pitfilled, args.igo, + args.existing_veg, args.historic_veg, args.hillshade, args.pitfilled, args.igo, args.dgo, args.reaches, args.roads, args.rails, args.canals, args.valley, args.output_folder, args.flow_areas, args.waterbodies, meta=meta) log.debug(f'Return code: {retcode}, [Max process usage] {max_obj}') else: - rcat(args.huc, args.existing_veg, args.historic_veg, args.pitfilled, args.igo, args.dgo, + rcat(args.huc, args.existing_veg, args.historic_veg, args.hillshade, args.pitfilled, args.igo, args.dgo, args.reaches, args.roads, args.rails, args.canals, args.valley, args.output_folder, args.flow_areas, args.waterbodies, meta=meta) diff --git a/scripts/automation/FargateRCAT.sh b/scripts/automation/FargateRCAT.sh index f4bfe1903..2ca964d0f 100644 --- a/scripts/automation/FargateRCAT.sh +++ b/scripts/automation/FargateRCAT.sh @@ -80,7 +80,7 @@ cd /usr/local/src # Get the RSCli project we need to make this happen rscli download $RSCONTEXT_DIR --id $RSCONTEXT_ID \ - --file-filter "(vegetation|nhdplushr.gpkg|project_bounds.geojson)" \ + --file-filter "(vegetation|nhdplushr.gpkg|dem_hillshade.tif|project_bounds.geojson)" \ --no-input --no-ui --verbose # Go get vbet result for this to work @@ -110,6 +110,7 @@ try() { rcat $HUC \ $RSCONTEXT_DIR/vegetation/existing_veg.tif \ $RSCONTEXT_DIR/vegetation/historic_veg.tif \ + $RSCONTEXT_DIR/topography/dem_hillshade.tif \ $TAUDEM_DIR/intermediates/pitfill.tif \ $ANTHRO_DIR/outputs/anthro.gpkg/vwIgos \ $ANTHRO_DIR/inputs/inputs.gpkg/dgo \