gsflow / gsflow-arcpy

GSFlow ArcPy Tools
Apache License 2.0
18 stars 10 forks source link

error when #31

Open Bingqinglu opened 5 years ago

Bingqinglu commented 5 years ago

I tried to run example-sagehen. When I ran dem_2_stream.py, the following error appeared: arcgisscripting. ExecuteError: ERROR 999999: Error executing function. The field is not nullable.[grid_code] Failed to execute (calculateField). Any help? Thank you

cgmorton commented 5 years ago

I'm not sure what would cause that. What version of ArcGIS are you using? Can you please provide a full copy of the error message and a copy of the "dem_2_stream_log.txt" in the examples/sagehen/hru_params/logs folder.

cgmorton commented 5 years ago

Also, you can pass a "--debug" command line argument to all the scripts, that will set the logging level to debug and may provide more information for determining the cause of the error.

Bingqinglu commented 5 years ago

Dear Charles Morton,

I am using ArcGIS 10.3.

Microsoft Windows [Version 6.1.7601]

Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Bingqing Lu>cd C:\arcpy\examples\sagehen

C:\arcpy\examples\sagehen>python ....\scripts\dem_2_streams.py -i sagehen_param

eters.ini -d

################################################################################

Run Time Stamp: 2019-02-06 15:36:15.497000

Current Directory: C:\arcpy\examples\sagehen

Script: dem_2_streams.py

Reading Field List File

Reading Input File

sagehen_parameters.ini

Fishnet cellsize: 90.0

Fishnet spat. ref.: NAD_1983_UTM_Zone_11N

Fishnet GCS: GCS_North_American_1983

Fishnet extent: 214109.999999999 4366530 221670.000000001 4373550

Fishnet extent: 214110 4366530 221670 4373550

Fishnet shape: 84 78

Fishnet snap: 214110.0 4366530.0

GSFLOW DEM To Streams

Missing INI parameter, setting lake_seg_offset = 0

Checking model points shapefile

Points: .\shapefiles\model_points.shp

Points spat. ref.: NAD_1983_UTM_Zone_11N

Points GCS: GCS_North_American_1983

NOTE: Using FID+1 to set SUB_BASIN

Checking subbasin numbering

1 subbasins

Checking model point types

OUTLET

Adding DEM fields if necessary

Exporting HRU polygon parameters to raster

HRU_TYPE

Unique Lake IDs:

DEM_ADJ

Computing OUTLET point flow direction

Outlet Point: (80, 44)

  1 0.0

  2 0.0

128 0.0

Flow Direction: 1

Building OUTLET point raster

Calculating flow direction

Setting DEM_ADJ values to 20000 for inactivate cells

Setting DEM_ADJ values to NoData for OUTLET cells

Filling DEM_ADJ (8-way)

Resetting OUTLET cell values

Calculating sinks (8-way)

Calculating flow direction

Setting flow direction to NoData for inactive cells

Resetting OUTLET cell flow direction

Resetting DEM_ADJ values for inactive cell

Flow direction points

Traceback (most recent call last):

File "....\scripts\dem_2_streams.py", line 934, in

flow_parameters(config_path=args.ini)

File "....\scripts\dem_2_streams.py", line 528, in flow_parameters

'Reclass(!{}!)'.format('grid_code'), 'PYTHON', remap_cb)

File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\management.py", li

ne 3457, in CalculateField

raise e

arcgisscripting.ExecuteError: ERROR 999999: Error executing function.

The field is not nullable. [grid_code]

Failed to execute (CalculateField).

C:\arcpy\examples\sagehen>

Dem_2_stream_log.txt:

GSFLOW DEM To Streams

Missing INI parameter, setting lake_seg_offset = 0

Checking model points shapefile

Points: .\shapefiles\model_points.shp

Points spat. ref.: NAD_1983_UTM_Zone_11N

Points GCS: GCS_North_American_1983

NOTE: Using FID+1 to set SUB_BASIN

Checking subbasin numbering

1 subbasins

Checking model point types

OUTLET

Adding DEM fields if necessary

Exporting HRU polygon parameters to raster

HRU_TYPE

Unique Lake IDs:

DEM_ADJ

Computing OUTLET point flow direction

Outlet Point: (80, 44)

  1 0.0

  2 0.0

128 0.0

Flow Direction: 1

Building OUTLET point raster

Calculating flow direction

Setting DEM_ADJ values to 20000 for inactivate cells

Setting DEM_ADJ values to NoData for OUTLET cells

Filling DEM_ADJ (8-way)

Resetting OUTLET cell values

Calculating sinks (8-way)

Calculating flow direction

Setting flow direction to NoData for inactive cells

Resetting OUTLET cell flow direction

Resetting DEM_ADJ values for inactive cell

Flow direction points

Thank you for all your kind help. Best regards, Bingqing Lu | Teaching Assistant

[image: Divider line]

Department of Geological Sciences The University of Alabama https://www.ua.edu/ Bevill Building 2072 TUSCALOOSA, AL 35404 Mobile 205-886-7016 blu5@crimson.ua.edu

[image: Divider line] [image: The University of Alabama] https://www.ua.edu/

On Wed, Feb 6, 2019 at 4:14 PM Charles Morton notifications@github.com wrote:

Also, you can pass a "--debug" command line argument to all the scripts, that will set the logging level to debug and may provide more information for determining the cause of the error.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gsflow/gsflow-arcpy/issues/31#issuecomment-461209462, or mute the thread https://github.com/notifications/unsubscribe-auth/AtNMHVb_iJs7Qzp8kXQKxfiavrvgzJuhks5vK1PegaJpZM4amMiD .

Bingqinglu commented 5 years ago

Dear Charles Morton, I am using ArcGIS 10.3. Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Bingqing Lu>cd C:\arcpy\examples\sagehen

C:\arcpy\examples\sagehen>python ....\scripts\dem_2_streams.py -i sagehen_param eters.ini -d

################################################################################

Run Time Stamp: 2019-02-06 15:36:15.497000 Current Directory: C:\arcpy\examples\sagehen Script: dem_2_streams.py

Reading Field List File

Reading Input File sagehen_parameters.ini Fishnet cellsize: 90.0 Fishnet spat. ref.: NAD_1983_UTM_Zone_11N Fishnet GCS: GCS_North_American_1983 Fishnet extent: 214109.999999999 4366530 221670.000000001 4373550 Fishnet extent: 214110 4366530 221670 4373550 Fishnet shape: 84 78 Fishnet snap: 214110.0 4366530.0

GSFLOW DEM To Streams Missing INI parameter, setting lake_seg_offset = 0

Checking model points shapefile Points: .\shapefiles\model_points.shp Points spat. ref.: NAD_1983_UTM_Zone_11N Points GCS: GCS_North_American_1983 NOTE: Using FID+1 to set SUB_BASIN Checking subbasin numbering 1 subbasins Checking model point types OUTLET

Adding DEM fields if necessary

Exporting HRU polygon parameters to raster HRU_TYPE

Unique Lake IDs: DEM_ADJ Computing OUTLET point flow direction Outlet Point: (80, 44) 1 0.0 2 0.0 128 0.0 Flow Direction: 1 Building OUTLET point raster

Calculating flow direction Setting DEM_ADJ values to 20000 for inactivate cells Setting DEM_ADJ values to NoData for OUTLET cells Filling DEM_ADJ (8-way) Resetting OUTLET cell values Calculating sinks (8-way) Calculating flow direction Setting flow direction to NoData for inactive cells Resetting OUTLET cell flow direction Resetting DEM_ADJ values for inactive cell

Flow direction points Traceback (most recent call last): File "....\scripts\dem_2_streams.py", line 934, in flow_parameters(config_path=args.ini) File "....\scripts\dem_2_streams.py", line 528, in flow_parameters 'Reclass(!{}!)'.format('grid_code'), 'PYTHON', remap_cb) File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\management.py", li ne 3457, in CalculateField raise e arcgisscripting.ExecuteError: ERROR 999999: Error executing function. The field is not nullable. [grid_code] Failed to execute (CalculateField).

C:\arcpy\examples\sagehen> Dem_2_stream_log.txt: GSFLOW DEM To Streams Missing INI parameter, setting lake_seg_offset = 0

Checking model points shapefile Points: .\shapefiles\model_points.shp Points spat. ref.: NAD_1983_UTM_Zone_11N Points GCS: GCS_North_American_1983 NOTE: Using FID+1 to set SUB_BASIN Checking subbasin numbering 1 subbasins Checking model point types OUTLET

Adding DEM fields if necessary

Exporting HRU polygon parameters to raster HRU_TYPE

Unique Lake IDs: DEM_ADJ Computing OUTLET point flow direction Outlet Point: (80, 44) 1 0.0 2 0.0 128 0.0 Flow Direction: 1 Building OUTLET point raster

Calculating flow direction Setting DEM_ADJ values to 20000 for inactivate cells Setting DEM_ADJ values to NoData for OUTLET cells Filling DEM_ADJ (8-way) Resetting OUTLET cell values Calculating sinks (8-way) Calculating flow direction Setting flow direction to NoData for inactive cells Resetting OUTLET cell flow direction Resetting DEM_ADJ values for inactive cell

Flow direction points

Thank you for all your kind help.

Bingqinglu commented 5 years ago

if I continue to run the rest scripts, the following errors would appear:

GSFLOW Stream Parameters

ERROR: Stream shapefiles does not exist ERROR: .\hru_params\flow_rasters\streams.shp ERROR: Try re-running dem_2_streams.py

Filling PRMS Parameter File Template Defaulting temperature_calc_method = LAPSE

ERROR: Cascades folder does not exist ERROR: .\hru_params\cascade_work ERROR: Try re-running CRT using stream_parameters.py

cgmorton commented 5 years ago

I'm not sure what would cause that error and I don't have ArcGIS 10.3, so I can't tell if it is related to the version. This won't be very much fun, but since the scripts are basically just a series of ArcGIS toolbox commands, the only thing I can suggest is trying to work through the steps in the script "manually" and try to see where it is breaking.

The error message says the script ended on line 528 (https://github.com/gsflow/gsflow-arcpy/blob/master/scripts/dem_2_streams.py#L528). I would try opening the "flow_dir_points" shapefile (examples\sagehen\hru_params\flow_raster\flow_dir_points.shp) in ArcGIS and first seeing if the points seem reasonable and have a column called "grid_code". There should be a point for each active grid cell. If it does and there are reasonable values in the field (flow direction values like 1, 2, 4, 8, etc.) then see if you can manually run the Calculate Field code block that is in the script. The error makes me think that some of these values are missing or have values that the remap isn't expecting, but that is just a guess.

If the flow_dir_points shapefile doesn't have a grid_code column or doesn't have values in that column, then you will have to go back a couple of steps and see if it is one of the previous steps that is actually causing the problem (maybe the raster to point conversion on line 506 didn't work?)

Also, you have to be able to run dem_2_streams.py for any of the other scripts to work.

Sorry!

Bingqinglu commented 5 years ago

Thank you for the information. The "grid code" exists. I ran the calculate field tool manually. It failed. The error message is Error 000539: Invalid field. Any suggestions? Thank you.

image

image

image

Bingqinglu commented 5 years ago

Thank you for the information. The "grid code" exists. I ran the calculate field tool manually. It failed. The error message is Error 000539: Invalid field. Any suggestions? Thank you.

[image: image.png]

[image: image.png]

[image: image.png] [image: image.png] [image: image.png] Best regards, Bingqing Lu | Teaching Assistant

[image: Divider line]

Department of Geological Sciences The University of Alabama https://www.ua.edu/ Bevill Building 2072 TUSCALOOSA, AL 35404 Mobile 205-886-7016 blu5@crimson.ua.edu

[image: Divider line] [image: The University of Alabama] https://www.ua.edu/

On Thu, Feb 7, 2019 at 12:28 PM Charles Morton notifications@github.com wrote:

I'm not sure what would cause that error and I don't have ArcGIS 10.3, so I can't tell if it is related to the version. This won't be very much fun, but since the scripts are basically just a series of ArcGIS toolbox commands, the only thing I can suggest is trying to work through the steps in the script "manually" and try to see where it is breaking.

The error message says the script ended on line 528 ( https://github.com/gsflow/gsflow-arcpy/blob/master/scripts/dem_2_streams.py#L528). I would try opening the "flow_dir_points" shapefile (examples\sagehen\hru_params\flow_raster\flow_dir_points.shp) in ArcGIS and first seeing if the points seem reasonable and have a column called "grid_code". There should be a point for each active grid cell. If it does and there are reasonable values in the field (flow direction values like 1, 2, 4, 8, etc.) then see if you can manually run the Calculate Field code block that is in the script. The error makes me think that some of these values are missing or have values that the remap isn't expecting, but that is just a guess.

If the flow_dir_points shapefile doesn't have a grid_code column or doesn't have values in that column, then you will have to go back a couple of steps and see if it is one of the previous steps that is actually causing the problem (maybe the raster to point conversion on line 506 didn't work?)

Also, you have to be able to run dem_2_streams.py for any of the other scripts to work.

Sorry!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gsflow/gsflow-arcpy/issues/31#issuecomment-461542781, or mute the thread https://github.com/notifications/unsubscribe-auth/AtNMHY9mSyueLLrRiC98LbzYBhq5iQN3ks5vLHBYgaJpZM4amMiD .