Skip to content

Conversation

@dwolfsch
Copy link
Contributor

@dwolfsch dwolfsch commented Jan 23, 2025

Adds functionality for generating raster files for mu and
xsi values from a DEM and shapefiles including:
A main script to rasterize mu and xsi based on polygon shapefiles and attribute fields.
A corresponding run script and configuration file for user customization

  • as with the other PR add input setup for files -> @dwolfsch

…enerate rasters from shapes

Adds functionality for generating raster files for mu and
xsi values from a DEM and shapefiles including:
A main script to rasterize mu and xsi based on polygon shapefiles and attribute fields.
A corresponding run script and configuration file for user customization.
@pep8speaks
Copy link

Hello @dwolfsch! Thanks for opening this PR.

Line 20:1: E302 expected 2 blank lines, found 1

Line 431:52: E203 whitespace before ':'
Line 429:48: E203 whitespace before ':'
Line 428:48: E203 whitespace before ':'
Line 143:35: W291 trailing whitespace

Line 54:1: E305 expected 2 blank lines after class or function definition, found 1
Line 15:1: E302 expected 2 blank lines, found 1

Do see the Hitchhiker's guide to code style

@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit d5624ec and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

The test coverage on the diff in this pull request is 8.9% (50% is the threshold).

This pull request will bring the total coverage in the repository to 69.0%.

View more on Code Climate.

@fso42 fso42 self-requested a review January 24, 2025 08:37
@fso42 fso42 added the enhancement New feature or request label Jan 24, 2025
@fso42 fso42 changed the title spatial Voellmy friction model: add VariableVoellmyShapeToRaster to generate rasters from shapes spatial Voellmy friction model: add VariableVoellmyShapeToRaster to generate rasters from shapes [com6] Jan 29, 2025
Comment on lines 2 to 14
# Input DEM raster file path
# Example: /path/to/dem.asc
dem =

# Input shapefile for mu
# Example: /path/to/mu_shapefile.shp
# be aware, that the attribute name has to be "mu"
mu_shapefile =

# Input shapefile for xsi
# Example: /path/to/xsi_shapefile.shp
# be aware, that the attribute name has to be "xsi"
xsi_shapefile =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need to be setup as with the avalanche Dir info

Comment on lines 24 to 33
# Important: For the variable Voellmy calculations in the com1DFA algorithm to work, it is mandatory, that the files are stored in:
# avaframe\data\*yourAvalancheDir*\Inputs\RASTERS\
# also, the file names need to be of format *_mu.asc and *_xi.asc and both are required and same extent as DEM
# Output raster mu
# Example: /path/to/output_mu.asc
mu_raster =

# Output raster xsi
# Example: /path/to/output_xi.asc
xsi_raster =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would autoset a name based on the avaDir and some extension, so this can be removed

demShape = demData.shape

# Helper function to rasterize shapefiles
def rasterizeShapefile(shapefilePath, defaultValue, attributeName):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function can be moved to ascUtils in in2Trans

help='Path to the configuration file')

args = parser.parse_args()
runMuXsiWorkflow(str(args.configPath))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be switched over to avaDir, (best to contact me for more explanation)

Update variableVoellmyShapeToRaster so that inputs are fetched automatically and no file paths are needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants