I'm working in Qgis with python cnsole. I have a file**.asc** whose structure is:
Ncols 49
Nrows 52
Xllcorner 2611187.75
Yllcorner 4336914.199
Cellsize 1000
NODATA_value -9999
0.5081 0.679 0.7024 0.6603 0.5643 0.4668 0.4865 0.4715 0.3534 0.4496 0.4205 0.442 0.4031 0.4352 0.3941 0.3504 0.2506 0.2586 0.3519 0.2247 0.2494 0.3148 0.3963 0.4558 0.4613 0.4471 0.4366 0.4119 0.4474 0.3852 0.4362 0.3907 0.4118 0.5387 0.4045 0.4721 0.5246 0.6007 0.5516 0.5795 0.6485 0.6084 0.6288 0.4513 -9999 -9999 -9999 -9999 -9999
0.5434 0.5707 0.5578 0.5205 0.5995 0.5414 0.5542 0.4757 0.4744 0.4276 0.3882 0.4132 0.4445 0.5414 0.3823 0.2908 0.2554 0.2356 0.2631 0.3037 0.3778 0.4221 0.4259 0.5337 0.4998 0.4603 0.3888 0.4412 0.4615 0.453 0.4019 0.4295 0.4321 0.4383 0.4226 0.4113 0.3462 0.5567 0.3907 0.3432 0.6684 0.7217 0.7315 0.6078 0.6322 0.529 -9999 -9999 -9999 ...
I have to find the maximum value in the file and I tried:
GridFile = open('filepath \ file.asc', 'r')
MaxValue = max (GridFile)
But the procedure returns the following error
ValueError: max () is an empty sequence.
What I understand is that I have to skip the first 6 lines and find the maximum of successive values, but I do not know how to do it.
Can anyone help me solve this problem?
Thanks