Skip to content

max(nbands) in format_snow_params returning empty sequence #29

@Saadi4469

Description

@Saadi4469

Hi Dr. Markert,

I have a VIC mask grid raster and 30 meter DEM, and I am trying to create the VIC 4.2.d elevation band file by using the following code Now, I am getting an empty sequence error at line 188 of the original "format_snow_params.py"script, what can I do to fix this issue please? My data can be accessed from here https://app.box.com/s/8qg5e8qif9r8hqr7han440zdw61mlxfn

On Conda prompt I wrote:

python format_snow_params.py ~/VIC_GRID_Rstr1.tif ~/DEM.tif ~/snow_params.txt 492 Where VIC_GRID_Rstr1.tif is the lower resolution grid raster (basinMask), DEM is a high resolution raster(elvHiRes), snow_params.txt (outsnow) is the output file to generated and lastly 492 (interval) is the elevation interval in meters.

While running the script I get the following error:

F```
ile "format_snow_params.py", line 218, in
main()
File "format_snow_params.py", line 212, in main
format_snow_params(sys.argv[1],sys.argv[2],sys.argv[3],sys.argv[4])
File "format_snow_params.py", line 70, in format_snow_params
elvhires[np.where(elvhires<0)] = np.nan
ValueError: cannot convert float NaN to integer

I exported (using ArcGIS) the DEM (DEM_0-n2) again in .tif format and set no data to 0, but the Float Nan error still remains. And if I remove the line

`elvhires[np.where(elvhires<0)] = np.nan
`then I get the error at line 188, which is:

`ValueError: max() arg is an empty sequence
`                                        
  Even when I view the DEM values in array form in Python, the actual values of the DEM start at column 910-1134. The rest of the columns are all zeros. I am attaching an screenshot of the array just for reference. The script can also be downloaded from the same link. I also tried the script both in Python 2.7 and 3.6, but the error still remains the same. Please let me know if there are data access issues.
![DEM_Array](https://user-images.githubusercontent.com/55733842/97129997-775c3280-16fd-11eb-9c68-6a7644607550.PNG)
                         
                            
    
        
 

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions