pierluigiderosa / Qgis2Ras

QGIS plugin for HEC-RAS data input
7 stars 0 forks source link

traceback issue #5

Open indyhaan opened 9 years ago

indyhaan commented 9 years ago

Running simple river center line and cross section export of version 0.21. Get the following error:

An error has occured while executing Python code:

Traceback (most recent call last): File "C:/Users/Chris.Hann/.qgis2/python/plugins\Qgis2Ras\qras_dialog.py", line 113, in runProfile main(self.river,self.XSection,self.textfile,self.dem,resolution) File "C:/Users/Chris.Hann/.qgis2/python/plugins\Qgis2Ras\RASout.py", line 287, in main output_xsections(xsections, outfile, rlayer, res, river) File "C:/Users/Chris.Hann/.qgis2/python/plugins\Qgis2Ras\RASout.py", line 246, in output_xsections outfile.write( "\t%.4f, %.4f, %.4f" %(X,Y,Z)) TypeError: float argument required, not NoneType

indyhaan commented 9 years ago

appears issue is when it encounters null data in a raster. Is there a fix for this apart from editing the ascii as a work around?

pierluigiderosa commented 9 years ago

Yes for now it's missing a procedure to jump Null values in the Raster DEM. Moreover if you have null data in raster what should be the value to assign to the elevation? For now the user have to digitize the cross sections only where raster data are available. You have other ideas?

indyhaan commented 9 years ago

It would be ideal if it could either:

1) identify and cope with null values (usually assigned -9999 in raster) and put them in as 0 or some other place holder value 2) interpolate over the top of the missing data.

If I knew more Python I'd love to help out developing this. Very useful.

Chris Hann +447501555857 chris@cjwhassociates.co.uk

www.cjwhassociates.co.uk

On 23 April 2015 at 12:26, pierluigi de rosa notifications@github.com wrote:

Yes for now it's missing a procedure to jump Null values in the Raster DEM. Moreover if you have null data in raster what should be the value to assign to the elevation? For now the user have to digitize the cross sections only where raster data are available. You have other ideas?

— Reply to this email directly or view it on GitHub https://github.com/pierluigiderosa/Qgis2Ras/issues/5#issuecomment-95548025 .

pierluigiderosa commented 9 years ago

It should be easy the first solution. Should be useful a box where user can set the value to assign in case of null values.

Take a look here where is defined the function where query raster https://github.com/pierluigiderosa/Qgis2Ras/blob/master/tools/RASout.py#L141 where you can add a check for null values

then the function is used here: https://github.com/pierluigiderosa/Qgis2Ras/blob/master/tools/RASout.py#L129

if you like fork the project and start work on it let me know