lutraconsulting / qgis-crayfish-plugin

Plotting and manipulating mesh data in QGIS.
http://www.lutraconsulting.co.uk/products/crayfish/
Other
62 stars 24 forks source link

Cannot run Rasterize in Python Console #462

Closed jmpmcmanus closed 3 years ago

jmpmcmanus commented 4 years ago

I trying to run crayfish:CrayfishExportRaster in the QGIS Python Console, but get the following error:

Incorrect parameter value for CRAYFISH_INPUT_GROUP

I get the processing.run script from processing/history using previous successful run of crayfish:CrayfishExportRaster, where I used the GUI interface:

----------------------------------------------------------------------------------
import processing

processing.run("crayfish:CrayfishExportRaster", {'CRAYFISH_INPUT_LAYER':'/home/jmcmanus/Work/Surge/Data/florence/maxele.mod.63.nc','CRAYFISH_INPUT_EXTENT':'-97.85833,-60.040029999999994,7.909559999999999,45.83612','MAP_UNITS_PER_PIXEL':0.001,'CRAYFISH_INPUT_GROUP':0,'CRAYFISH_INPUT_TIMESTEP':0,'CRAYFISH_OUTPUT_RASTER':'TEMPORARY_OUTPUT'})
----------------------------------------------------------------------------------

When I run crayfish:CrayfishExportRaster, using the GUI interface, I can select a mesh layer that has been already loaded in QGIS. When I select the layer, in the crayfish:CrayfishExportRaster GUI, the CRAYFISH_INPUT_GROUP and CRAYFISH_INPUT_TIMESTEP are automatically filled with the values of 'maximum water surface elevationabove geoid' and '56 days, 0:00:00', respectively.

I attempted to run crayfish:CrayfishExportRaster, in the python console, using a loaded layer, and those inputs but got the same error message.

----------------------------------------------------------------------------------
import processing

mfile = '/home/jmcmanus/Work/Surge/Data/florence/maxele.mod.63.nc'
meshfile = mfile.strip().split('/')[-1]
meshname = meshfile.split('.')[0]
meshlayer = QgsMeshLayer(mfile, meshname, 'mdal')

processing.run("crayfish:CrayfishExportRaster", \
        {'CRAYFISH_INPUT_LAYER': meshlayer,\
        'CRAYFISH_INPUT_EXTENT':'-97.85833,-60.040029999999994,7.909559999999999,45.83612',\
        'MAP_UNITS_PER_PIXEL':0.001,\
        'CRAYFISH_INPUT_GROUP':'maximum water surface elevationabove geoid',\
        'CRAYFISH_INPUT_TIMESTEP':'56 days, 0:00:00',\
        'CRAYFISH_OUTPUT_RASTER':'TEMPORARY_OUTPUT'})
----------------------------------------------------------------------------------

Jim

PeterPetrik commented 4 years ago

Hi,

what is your QGIS version, crayfish plugin version?

P.

PeterPetrik commented 3 years ago

The algorithm was moved to QGIS native processing algs. Please retest with QGIS master and open the issue in QGIS tracker if still present.