Hi Elias,
Thanks for being persistent. There were a few issues with non-equidistant layer
thicknesses. I published a new version 1.7.2. Please install this. It now
supports Python 3.9, 3.10, and 3.11.
I recommend to create a new environment, for example with Python 3.10:
conda create -n pitlakq_py310 python=3.10
(You can also use mamba instead of conda if you work with mamba.)
Activate:
conda activate pitlakq_py310
and install:
conda install pitlakq
You should update your .pitlakq accordingly for the templates and resources
paths.
Please re-do the preprocessing, creating the
bath.nc. The recommendation for
the bottom level might be different. Please use the new
bath.nc for the
calculation. Let me know if it works for or if you still have issues.
Best,
Mike
Am 05.06.23 um 13:15 schrieb Elias Pentti:
> Hello! The plots you created do look fine, but did you check the "zu" list
> in
out.nc? Because I'm sure that the program does not generate it correctly,
> the error becoming evident when layer heights are uneven. (Of course I'm
> going to use much thinner layers to improve accuracy once I'm ready to start
> actual modelling, but first I want to ensure that I understand how the
> program works and to be convinced that it does exactly what it should.)
> Despite my very basic knowledge of Python, I think I was able to fix the
> error with the following corrections to ncoutput.py:
>
> 1. Remove (or comment away) the line (#170 in my version of the file)
> bottom_index += 1
>
> 2. On lines #174 & #175, change zu[:bottom_index] =
> (numpy.add.accumulate(deltaz[*:bottom_index*])[::-1] + bottom) into
> (differing parts in bold) zu[:bottom_index] =
> (numpy.add.accumulate(deltaz[*bottom_index:0:-1*])[::-1] + bottom) This way,
> the cumulative summation of layer heights in deltaz starts from the lake
> bottom upwards, not from the top of the model downwards as in the original
> code. Then, bottom_elevation value in waterbody_coordinates of w2.yaml must
> be set at the bottom elevation of the deepest active cell actually within
> the lake (not the bottom elevation of the lake grid if the lake does not
> reach it) in order to make the resulting "zu" equal to the user-defined
> layer bottom elevations. The correction to the line between these two (#173)
> that you posted earlier in another thread, the correct line being zu =
> numpy.zeros_like(output.variables['zu']) must also be done, at least in my
> environment.
>
> With best regards, Elias keskiviikko 31. toukokuuta 2023 klo 17.12.19 UTC+3
> mmueller kirjoitti:
>
> I tried to e-create your problem. With attached bathymetry I get the
> attached temperature. Looks like expected. The thick layers create
> considerable dispersion. In general I would recommend to keep the upper 10 m
> in 1-m layers. Are you sure you copied the generated
bath.nc
> <
http://bath.nc> to input/w2?
>
>
> Am 31.05.23 um 11:03 schrieb Elias Pentti:
>> Yes, I did update the number_of_layers and number_of_constituent_layers
>> values in w2.yaml so that they correspond to my bathymetry grid, as well
>> as bottom_elevation in waterbody_coordinates to equal the lowest layer
>> boundary defined in reservoir.txt just like in the tutorial. To be
> clear, my
>> reservoir.txt reads Layers ZU 1140 2147 3153 4158 5166 6178 7189 8193
>> 9197.5 10200 so there are 11 layers, including the extra 1-metre layers
>> below 140 m and above 200 m. show_bath plots the grid correctly, now that
>> I've fixed the alignment: uneven_lakegrid.png To continue
> troubleshooting, I
>> added lines "print(deltaz)" and "print(zu)" in the file ncoutput.py, and
>> this is the output: [ 1. 2.5 4.5 4. 11. 12. 8. 5. 6. 7. 1. ] [201.0 194.0
>> 188.0 183.0 175.0 163.0 152.0 148.0 143.5 141.0 140.0] So, "deltaz"
>> contains the layer heights from
bath.nc <
http://bath.nc>,
> topmost layer first, but
>> "zu" is a list of where the bottom elevations of the layers would be if
>> the order of "deltaz" were from bottom upwards and if the bottom of the
>> lowest layer were at 140 m. In addition to the obviously incorrect order
>> of layer heights, I wonder if I should have set the bottom_elevation value
>> at 139 m instead on 140 m, not to the lowest layer boundary that I defined
>> myself
> but
>> to the actual bottom of the model grid, because that way the first and
>> last two values in "zu" would at least coincide with the correct layer
>> boundaries.
>>
>> Regards, Elias
>>
>> tiistai 30. toukokuuta 2023 klo 20.41.00 UTC+3 mmueller kirjoitti:
>>
>> Hi Elias,
>>
>> Looks like you changed the number of layers. Did adjust the values in
>> input/w2/w2.yaml accordingly? These are the ones from the tutorial model:
>>
>> general: titel: value: A simple PITLAKQ test model bounds:
>> number_of_segments: value: 10 number_of_layers: value: 52
>> number_of_constituents_segments: value: 10 number_of_constituents_layers:
>> value: 52 times: start: value: 01.01.1998 end: value: 31.01.2009 ---
>> !File name:
bath.nc <
http://bath.nc> <
http://bath.nc <
http://bath.nc>>
> <
http://out.nc <
http://out.nc>> (supposed to
>> be the bottom
>>> elevations of the layers), it's {201, 196, 191, 186, 181, 176, 171,
>>> 166, 161, 156, 151, 146, 141, 140}. T_result_top.png After this curious
>> result, I
>>> experimented a little and made the layer structure uneven, setting the
>>> layers at 140, 147, 153, 158, 166, 178, 189, 193, 197.5 and 200 m. This
>> time
>>> "zu" in
out.nc <
http://out.nc> <
http://out.nc <
http://out.nc>> is {201,
> <
https://groups.google.com/d/msgid/pitlakq-users/7d852ef4-8a07-41ca-af1b-43fc3c513238n%40googlegroups.com?utm_medium=email&utm_source=footer
> <
https://groups.google.com/d/msgid/pitlakq-users/7d852ef4-8a07-41ca-af1b-43fc3c513238n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
https://groups.google.com/d/msgid/pitlakq-users/1bcf6575-6907-4275-8028-e76669f457fbn%40googlegroups.com
> <
https://groups.google.com/d/msgid/pitlakq-users/1bcf6575-6907-4275-8028-e76669f457fbn%40googlegroups.com?utm_medium=email&utm_source=footer>.