You saved your reservoir.txt with a byte order mark (BOM). This adds some bytes
at the beginning of your file that cannot be seen. I changed this and the
preprocessing works for me. I attached a file that should work.
To prevent this, make sure you turn off the BOM when exporting from Excel
or other tools. Good editors, such as Notepad++ on Windows, allow you to remove
the BOM [1].
This is my output:
setting new values for path
setting new values for bathymetry
setting new values for bathymetry
preprocessing is running ...
total_volume n = 61.562878471959 Mio m3
total_volume entire lake= 61.562878471959 Mio m3
set bottom_elevation to: 1150.00
surface_area 930432.2743462626
runtime was 112.4 seconds
Looks like your lake is in the mountains. ;)
[1]
https://stackoverflow.com/questions/8432584/how-to-make-notepad-to-save-text-in-utf-8-without-bom
Am 13.02.20 um 20:07 schrieb Anna Klein:
> I am trying to follow the preprocessing steps for a new project but I keep
> getting an error message during the preprocessing step that I believe is
> connected to my reservoir.txt file.
>
> I have followed the format of the reservoir.txt file from the pitlakq
> tutorials, but I cannot seem to make the preprocessing working. Everytime I
> try to run it I get the following error:
>
>>>> preprocess.main('yer_test_project')
> setting new values for path
> setting new values for bathymetry
> setting new values for bathymetry
> preprocessing is running ...
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File
> "C:\Users\anna.klein\AppData\Local\Continuum\anaconda3\envs\pitlakq36\lib\site-packages\pitlakq\preprocessing\preprocess.py",
> line 76, in main
> lake.make_bathymetry()
> File
> "C:\Users\anna.klein\AppData\Local\Continuum\anaconda3\envs\pitlakq36\lib\site-packages\pitlakq\preprocessing\preprocessor.py",
> line 490, in make_bathymetry
> sub_lake.make_bathymetry()
> File
> "C:\Users\anna.klein\AppData\Local\Continuum\anaconda3\envs\pitlakq36\lib\site-packages\pitlakq\preprocessing\preprocessor.py",
> line 442, in make_bathymetry
> self.read_geometry_def()
> File
> "C:\Users\anna.klein\AppData\Local\Continuum\anaconda3\envs\pitlakq36\lib\site-packages\pitlakq\preprocessing\preprocessor.py",
> line 228, in read_geometry_def
> if global flag == 'c':
> UnboundLocalError: local variable 'flag' referenced before assignment
>
>
> From what I understand, this error means that the program is trying to use the
> "flag" variable before it has been defined. In the preprocessor.py script, I
> can see that the first place "flag" appears is in line 221:
>
> for line in geometry:
> if line[0] == 'Columns':
> flag = 'c'
> continue
> elif line[0] == 'Layers':
> flag = 'l'
> continue
> if flag == 'c':
> geometry_columns.append(float(line[1]))
> elif flag == 'l':
> geometry_zu.append(float(line[1]))
>
> However, since my reservoir.txt file matches the format of the example file, I
> can't figure out why I'm getting this error message.
>
> I've attached the files I've generated so far.
>
> --
> You received this message because you are subscribed to the Google Groups
> "pitlakq-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to
pitlakq-user...@googlegroups.com
> <mailto:
pitlakq-user...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/pitlakq-users/29a5d0da-373c-4970-9302-f9a7b7a4bee9%40googlegroups.com
> <
https://groups.google.com/d/msgid/pitlakq-users/29a5d0da-373c-4970-9302-f9a7b7a4bee9%40googlegroups.com?utm_medium=email&utm_source=footer>.