Okay, I saw the issue. rho_Pk
and dz_Pk
are initialized with Constants::eps2
, not 0. I think this is not ideal. It leads to confusion, and gives rho_Pk==1
in case there is no snow.
I made a commit to initialize them to 0., and have the function return nodata
when a slab is not determined (in case of no snow).
Please let me know if you have seen any other cases where the function returns non-sensical values, that the try ... catch block needs to catch.
Nander Wever (1eabfbfd) at 27 Mar 08:48
Function compPenetrationDepth now returns nodata when no slab can b...
Interestingly, on my system, when rho_Pk /= dz_Pk
is executed with dz_Pk == 0
and rho_Pk == 0
, rho_Pk == 1
afterwards. Would not have expected that.
I also don't mind looking into it, if you have any cases of invalid output. I already see that the function executes:
rho_Pk /= dz_Pk;
And this can happen with dz_Pk == 0, in case there are no snow layers. We should probably fix those cases. I can look into that too.
Thank you, sounds good! I will look into that and modify accordingly. --after Easter ;-)
Thanks a lot for your contribution!
Is the try-catch block really necessary? If the function compPenetrationDepth
indeed returns invalid values, we should probably fix that function, instead of catching problems when producing the output.
Add skier penetration depth to .smet files in haz section of SmetIO
plugin.
As discussed, putting the ski pen depth into the SMET file seems more appropriate than putting it intop the PRO file (as suggested in #889). Penetration depth is computed during time of writing with a try-catch block to prevent failing of write routine.
Florian Herla (52f504a8) at 26 Mar 12:19
Florian Herla (97ee78db) at 26 Mar 12:18
Add skier penetration depth to SMET file output
Add skier penetration depth to .pro files as code 0607 in AsciiIO::writeProfileProAddDefault()
(#889).
Penetration depth is computed during time of writing with a try-catch block to prevent failing of write routine.
We decided to add skier pen depth to the SMET file instead of the PRO file, because the SMET file contains all the timeseries scalars.
Nander Wever (9eff3a56) at 10 Mar 22:22
If LW_NET is provided, and in addition also a TSS, calculate incomi...
Nander Wever (2d1c245a) at 08 Mar 10:59
Providing proper header information in *pro file regarding whether ...
Nander Wever (6fd77b10) at 05 Mar 11:12
Bug fix: sea water density was wrongly calculated, due to missing p...
Add skier penetration depth to .pro files as code 0607 in AsciiIO::writeProfileProAddDefault()
(#889).
Penetration depth is computed during time of writing with a try-catch block to prevent failing of write routine.
Florian Herla (52f504a8) at 29 Feb 09:09
Add include statement and fix error
Florian Herla (5741db44) at 29 Feb 09:01
Include error handling during ski pen computation
Florian Herla (4fb6d99c) at 29 Feb 08:41
Add skier penetration depth to .pro files